diff --git a/.buckconfig b/.buckconfig index 07ec813646f1..76d22bf86f5e 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,6 +1,6 @@ [android] - target = android-30 + target = android-31 [download] max_number_of_retries = 3 diff --git a/.circleci/Dockerfiles/Dockerfile.android b/.circleci/Dockerfiles/Dockerfile.android index cc31fbcea436..262c4f8ebfae 100644 --- a/.circleci/Dockerfiles/Dockerfile.android +++ b/.circleci/Dockerfiles/Dockerfile.android @@ -14,7 +14,7 @@ # and build a Android application that can be used to run the # tests specified in the scripts/ directory. # -FROM reactnativecommunity/react-native-android:4.0 +FROM reactnativecommunity/react-native-android:5.2 LABEL Description="React Native Android Test Image" LABEL maintainer="Héctor Ramos " diff --git a/.circleci/Dockerfiles/scripts/run-android-ci-instrumentation-tests.js b/.circleci/Dockerfiles/scripts/run-android-ci-instrumentation-tests.js index 06a9c2a45e75..f34e8d30eb46 100644 --- a/.circleci/Dockerfiles/scripts/run-android-ci-instrumentation-tests.js +++ b/.circleci/Dockerfiles/scripts/run-android-ci-instrumentation-tests.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/.circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh b/.circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh index b6a2427324e7..64f0ee465642 100644 --- a/.circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh +++ b/.circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/.circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh b/.circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh index c7886e5ed18b..93a38f46318f 100644 --- a/.circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh +++ b/.circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh b/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh index 3176638424e7..07a8779f60c4 100755 --- a/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh +++ b/.circleci/Dockerfiles/scripts/run-ci-e2e-tests.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/.circleci/Dockerfiles/scripts/run-instrumentation-tests-via-adb-shell.sh b/.circleci/Dockerfiles/scripts/run-instrumentation-tests-via-adb-shell.sh index 1c6396f5601b..d095b972a427 100755 --- a/.circleci/Dockerfiles/scripts/run-instrumentation-tests-via-adb-shell.sh +++ b/.circleci/Dockerfiles/scripts/run-instrumentation-tests-via-adb-shell.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/.circleci/config.yml b/.circleci/config.yml index 1118ce028b7e..7dc2e3a83759 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -28,20 +28,19 @@ executors: <<: *defaults docker: # Note: Version set separately for Windows builds, see below. - - image: circleci/node:14 + - image: circleci/node:16 nodeprevlts: <<: *defaults docker: - - image: circleci/node:12 + - image: circleci/node:14 reactnativeandroid: <<: *defaults docker: - - image: reactnativecommunity/react-native-android:4.0 + - image: reactnativecommunity/react-native-android:5.2 resource_class: "large" environment: - TERM: "dumb" - ADB_INSTALL_TIMEOUT: 10 - - _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" - GRADLE_OPTS: '-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-XX:+HeapDumpOnOutOfMemoryError"' - BUILD_THREADS: 2 # Repeated here, as the environment key in this executor will overwrite the one in defaults @@ -79,7 +78,9 @@ commands: steps: - restore_cache: keys: - - v4-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} + - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }} + - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }} + - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }} - run: name: "Yarn: Install Dependencies" command: | @@ -91,7 +92,7 @@ commands: - save_cache: paths: - ~/.cache/yarn - key: v4-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} + key: v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }} install_buck_tooling: steps: @@ -167,7 +168,7 @@ commands: steps: - restore_cache: keys: - - v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} + - v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }} - run: name: Download Dependencies Using Gradle command: ./scripts/circleci/gradle_download_deps.sh @@ -176,7 +177,7 @@ commands: - ~/.gradle - ReactAndroid/build/downloads - ReactAndroid/build/third-party-ndk - key: v1-gradle-{{ checksum "ReactAndroid/build.gradle" }}-{{ checksum "scripts/circleci/gradle_download_deps.sh" }} + key: v1-gradle-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "ReactAndroid/gradle.properties" }} download_buck_dependencies: steps: @@ -210,7 +211,7 @@ commands: - install_github_bot_deps - run: name: Report size of RNTester.app (analysis-bot) - command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> + command: GITHUB_TOKEN="$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A""$PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B" scripts/circleci/report-bundle-size.sh << parameters.platform >> || true # ------------------------- # JOBS @@ -237,7 +238,7 @@ jobs: command: | curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - apt update && apt install -y shellcheck jq - apt-get install openssl ca-certificates + apt-get -y install openssl ca-certificates update-ca-certificates curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - apt update && apt install -y shellcheck jq @@ -353,10 +354,6 @@ jobs: description: Specifies whether unit tests should run. type: boolean default: false - run_detox_tests: - description: Specifies whether Detox e2e tests should run. - type: boolean - default: false run_disabled_tests: description: Specifies whether disabled tests should run. Set this to true to debug failing tests. type: boolean @@ -379,7 +376,7 @@ jobs: - run: name: Configure Environment Variables command: | - echo 'export PATH=/usr/local/opt/node@14/bin:$PATH' >> $BASH_ENV + echo 'export PATH=/usr/local/opt/node@16/bin:$PATH' >> $BASH_ENV source $BASH_ENV - with_brew_cache_span: @@ -396,7 +393,7 @@ jobs: name: Configure Node # Sourcing find-node.sh will ensure nvm is set up. # It also helps future invocation of find-node.sh prevent permission issue with nvm.sh. - command: source scripts/find-node.sh && nvm install 14 && nvm alias default 14 + command: source scripts/find-node.sh && nvm install 16 && nvm alias default 16 - run: name: Configure Watchman @@ -434,13 +431,6 @@ jobs: - run: name: "Run Tests: iOS Unit and Integration Tests" command: yarn test-ios - # Runs iOS Detox e2e tests - - when: - condition: << parameters.run_detox_tests >> - steps: - - run: - name: "Run Tests: Detox iOS End-to-End Tests" - command: yarn run build-ios-e2e && yarn run test-ios-e2e # Optionally, run disabled tests - when: @@ -515,7 +505,7 @@ jobs: - run: name: Compile Native Libs for Unit and Integration Tests command: ./gradlew :ReactAndroid:packageReactNdkLibsForBuck -Pjobs=$BUILD_THREADS - no_output_timeout: 6m + no_output_timeout: 30m # Build JavaScript Bundle for instrumentation tests - run: @@ -579,24 +569,56 @@ jobs: steps: - checkout - run_yarn + - attach_workspace: + at: . - run: - name: Setup the Android Template + name: Create Android template project command: | + REPO_ROOT=$(pwd) + PACKAGE=$(cat build/react-native-package-version) + PATH_TO_PACKAGE="$REPO_ROOT/build/$PACKAGE" cd template - sed -i 's/1000\.0\.0/file\:\.\./g' package.json + npm add $PATH_TO_PACKAGE npm install - # react-native-community/cli is needed as the Android template is referencing a .gradle file inside it. - npm i @react-native-community/cli - - - run: - name: Bundle the latest version of ReactAndroid - command: ./gradlew :ReactAndroid:publishReleasePublicationToNpmRepository - run: name: Build the template application command: cd template/android/ && ./gradlew assembleDebug + # ------------------------- + # JOBS: Test iOS Template + # ------------------------- + test_ios_template: + executor: reactnativeios + environment: + - PROJECT_NAME: "iOSTemplateProject" + + steps: + - checkout + - run_yarn + - attach_workspace: + at: . + + - run: + name: Create iOS template project + command: | + REPO_ROOT=$(pwd) + PACKAGE=$(cat build/react-native-package-version) + PATH_TO_PACKAGE="$REPO_ROOT/build/$PACKAGE" + node ./scripts/set-rn-template-version.js "file:$PATH_TO_PACKAGE" + mkdir -p ~/tmp + cd ~/tmp + node "$REPO_ROOT/cli.js" init "$PROJECT_NAME" --template "$REPO_ROOT" + + - run: + name: Build template project + command: | + xcodebuild build \ + -workspace ~/tmp/$PROJECT_NAME/ios/$PROJECT_NAME.xcworkspace \ + -scheme $PROJECT_NAME \ + -sdk iphonesimulator + # ------------------------- # JOBS: Windows # ------------------------- @@ -610,10 +632,9 @@ jobs: environment: - ANDROID_HOME: "C:\\Android\\android-sdk" - ANDROID_NDK: "C:\\Android\\android-sdk\\ndk\\20.1.5948944" - - ANDROID_BUILD_VERSION: 30 - - ANDROID_TOOLS_VERSION: 30.0.2 + - ANDROID_BUILD_VERSION: 31 + - ANDROID_TOOLS_VERSION: 31.0.0 - GRADLE_OPTS: -Dorg.gradle.daemon=false - - NDK_VERSION: 21.4.7075529 steps: - checkout @@ -621,8 +642,8 @@ jobs: name: Install Node # Note: Version set separately for non-Windows builds, see above. command: | - nvm install 14.17.0 - nvm use 14.17.0 + nvm install 16 + nvm use 16 # Setup Dependencies - run: @@ -659,7 +680,6 @@ jobs: sdkmanager "build-tools;%ANDROID_TOOLS_VERSION%" sdkmanager "add-ons;addon-google_apis-google-23" sdkmanager "extras;android;m2repository" - sdkmanager "ndk;%NDK_VERSION%" # ------------------------- # Run Tests @@ -710,6 +730,25 @@ jobs: # ------------------------- # JOBS: Releases # ------------------------- + prepare_package_for_release: + parameters: + version: + type: string + latest: + type: boolean + default: false + executor: reactnativeios + steps: + - checkout + - run_yarn + - add_ssh_keys: + fingerprints: + - "1c:98:e0:3a:52:79:95:29:12:cd:b4:87:5b:41:e2:bb" + - run: + name: "Set new react-native version and commit changes" + command: | + node ./scripts/prepare-package-for-release.js -v << parameters.version >> -l << parameters.latest >> + build_npm_package: parameters: publish_npm_args: @@ -750,9 +789,15 @@ jobs: mkdir -p build FILENAME=$(npm pack) mv $FILENAME build/ + echo $FILENAME > build/react-native-package-version - store_artifacts: path: ~/react-native/build/ destination: build + - persist_to_workspace: + root: . + paths: + - build/* + - when: condition: matches: { pattern: '^pull\/.*$', value: << pipeline.git.branch >> } @@ -760,7 +805,19 @@ jobs: - install_github_bot_deps - run: name: Post link to PR build artifacts (pull-bot) - command: GITHUB_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" scripts/circleci/post-artifacts-link.sh + command: GITHUB_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" scripts/circleci/post-artifacts-link.sh || true + + - when: + condition: + equal: [ --release, << parameters.publish_npm_args >> ] + steps: + - run: + name: Update rn-diff-purge to generate upgrade-support diff + command: | + curl -X POST https://api.github.com/repos/react-native-community/rn-diff-purge/dispatches \ + -H "Accept: application/vnd.github.v3+json" \ + -u "$PAT_USERNAME:$PAT_TOKEN" \ + -d "{\"event_type\": \"publish\", \"client_payload\": { \"version\": \"${CIRCLE_TAG:1}\" }}" # ------------------------- # JOBS: Nightly @@ -774,14 +831,39 @@ jobs: command: | echo "Nightly build run" + +# ------------------------- +# PIPELINE PARAMETERS +# ------------------------- +parameters: + run_package_release_workflow_only: + default: false + type: boolean + + release_latest: + default: false + type: boolean + + release_version: + default: "9999" + type: string + # ------------------------- # WORK FLOWS +# +# When creating a new workflow, make sure to include condition `unless: << pipeline.parameters.run_package_release_workflow_only >>` +# It's setup this way so we can trigger a release via a POST +# See limitations: https://support.circleci.com/hc/en-us/articles/360050351292-How-to-trigger-a-workflow-via-CircleCI-API-v2 # ------------------------- workflows: version: 2 tests: + unless: << pipeline.parameters.run_package_release_workflow_only >> jobs: + - build_npm_package: + # Build a release package on every untagged commit, but do not publish to npm. + publish_npm_args: --dry-run - test_js: run_disabled_tests: false filters: @@ -793,6 +875,14 @@ workflows: branches: ignore: gh-pages - test_android_template: + requires: + - build_npm_package + filters: + branches: + ignore: gh-pages + - test_ios_template: + requires: + - build_npm_package filters: branches: ignore: gh-pages @@ -820,15 +910,6 @@ workflows: # use_hermes: true # use_frameworks: true # run_unit_tests: true - # DISABLED: Detox tests need to be fixed - # - test_ios: - # name: test_ios_detox - # run_detox_tests: true - # DISABLED: USE_FRAMEWORKS=1 not supported by Flipper - # - test_ios: - # name: test_ios_detox_frameworks - # use_frameworks: true - # run_detox_tests: true - test_js: name: test_js_prev_lts executor: nodeprevlts @@ -841,11 +922,27 @@ workflows: ignore: gh-pages run_disabled_tests: false - releases: + # This workflow should only be triggered by release script + package_release: + when: << pipeline.parameters.run_package_release_workflow_only >> + jobs: + # This job will trigger publish_release workflow + - prepare_package_for_release: + name: prepare_package_for_release + version: << pipeline.parameters.release_version >> + latest : << pipeline.parameters.release_latest >> + + publish_release: + unless: << pipeline.parameters.run_package_release_workflow_only >> jobs: + # This job will trigger when a version tag is pushed (by package_release) - build_npm_package: name: build_and_publish_npm_package + context: react-native-bot publish_npm_args: --release + # CircleCI filters are OR-ed, with all branches triggering by default and tags excluded by default + # CircleCI env-vars are only set with the branch OR tag that triggered the job, not both. + # In this case, CIRCLE_BRANCH is unset, but CIRCLE_TAG is set filters: # Both of the following conditions must be included! # Ignore any commit on any branch by default. @@ -854,19 +951,9 @@ workflows: # Only act on version tags. tags: only: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ - - build_npm_package: - # Build a release package on every untagged commit, but do not publish to npm. - publish_npm_args: --dry-run - filters: - branches: - only: - - main - - /^pull\/.*$/ - - /^(\d+)\.(\d+)-stable$/ - tags: - ignore: /v[0-9]+(\.[0-9]+)*(\-rc(\.[0-9]+)?)?/ analysis: + unless: << pipeline.parameters.run_package_release_workflow_only >> jobs: # Run lints on every commit other than those to the gh-pages branch - analyze_code: @@ -887,6 +974,7 @@ workflows: ignore: gh-pages nightly: + unless: << pipeline.parameters.run_package_release_workflow_only >> triggers: - schedule: cron: "0 20 * * *" diff --git a/.eslintrc b/.eslintrc index f990717831de..c05c62620cbf 100644 --- a/.eslintrc +++ b/.eslintrc @@ -6,7 +6,7 @@ ], "plugins": [ - "@react-native/eslint-plugin-codegen" + "@react-native/eslint-plugin-specs" ], "overrides": [ @@ -18,7 +18,7 @@ "@react-native-community/no-haste-imports": 2, "@react-native-community/error-subclass-name": 2, "@react-native-community/platform-colors": 2, - "@react-native/codegen/react-native-modules": 2 + "@react-native/specs/react-native-modules": 2 } }, { diff --git a/.flowconfig b/.flowconfig index a7e698c44212..d7d4aae80bb4 100644 --- a/.flowconfig +++ b/.flowconfig @@ -14,6 +14,8 @@ ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js +.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$ + [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -30,7 +32,6 @@ flow/ emoji=true exact_by_default=true -indexed_access=false format.bracket_spacing=false @@ -71,4 +72,4 @@ untyped-import untyped-type-import [version] -^0.162.0 +^0.170.0 diff --git a/.flowconfig.android b/.flowconfig.android index 10a1f58d0d1b..bcb9dcca1d26 100644 --- a/.flowconfig.android +++ b/.flowconfig.android @@ -14,6 +14,8 @@ ; Flow doesn't support platforms .*/Libraries/Utilities/LoadingView.js +.*/node_modules/resolve/test/resolver/malformed_package_json/package\.json$ + [untyped] .*/node_modules/@react-native-community/cli/.*/.* @@ -30,7 +32,6 @@ flow/ emoji=true exact_by_default=true -indexed_access=false format.bracket_spacing=false @@ -71,4 +72,4 @@ untyped-import untyped-type-import [version] -^0.162.0 +^0.170.0 diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 083ab18aa096..000000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -name: "🐛 Bug Report" -about: Report a reproducible bug or regression in React Native. -title: '' -labels: 'Needs: Triage :mag:' - ---- - -Please provide all the information requested. Issues that do not follow this format are likely to stall. - -## Description -Please provide a clear and concise description of what the bug is. Include screenshots if needed. -Please test using the latest React Native release to make sure your issue has not already been fixed: https://reactnative.dev/docs/upgrading.html - -## React Native version: -Run `react-native info` in your terminal and copy the results here. - -## Steps To Reproduce -Provide a detailed list of steps that reproduce the issue. - -1. -2. - -## Expected Results -Describe what you expected to happen. - -## Snack, code example, screenshot, or link to a repository: -Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. -You may provide a screenshot of the application if you think it is relevant to your bug report. -Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 000000000000..8b6f8c0f12ae --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,47 @@ +name: 🐛 Bug Report +description: Report a reproducible bug or regression in React Native. +labels: ["Needs: Triage :mag:"] +body: + - type: markdown + attributes: + value: | + Please provide all the information requested. Issues that do not follow this format are likely to stall. + - type: textarea + id: description + attributes: + label: Description + description: Please provide a clear and concise description of what the bug is. Include screenshots if needed. Please test using the latest React Native release to make sure your issue has not already been fixed - https://reactnative.dev/docs/upgrading.html + validations: + required: true + - type: input + id: version + attributes: + label: Version + description: What react-native version does this appear on? + placeholder: ex. 0.66.0 + validations: + required: true + - type: textarea + id: react-native-info + attributes: + label: Output of `npx react-native info` + description: Run `npx react-native info` in your terminal, copy and paste the results here. + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Steps to reproduce + description: Provide a detailed list of steps that reproduce the issue. + validations: + required: true + - type: textarea + id: extra + attributes: + label: Snack, code example, screenshot, or link to a repository + description: | + Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. + You may provide a screenshot of the application if you think it is relevant to your bug report. + Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 7821e038ec89..c50c3e2a4f2f 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -3,9 +3,6 @@ contact_links: - name: 📃 Documentation Issue url: https://github.com/facebook/react-native-website/issues about: Please report documentation issues in the React Native website repository. - - name: ⤴️ Upgrade Issue - url: https://github.com/react-native-community/upgrade-support - about: Need help upgrading to a newer React Native version? Visit the Upgrade Support repository. - name: 🤔 Questions and Help url: https://reactnative.dev/help about: Looking for help with your app? Please refer to the React Native community's support resources. diff --git a/.github/ISSUE_TEMPLATE/release_blocker_form.yml b/.github/ISSUE_TEMPLATE/release_blocker_form.yml deleted file mode 100644 index c0310da2a80f..000000000000 --- a/.github/ISSUE_TEMPLATE/release_blocker_form.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release Candidate Blocker -description: File an issue against the current release candidate. -labels: ["Needs: Triage :mag:", "pre-release"] -body: - - type: markdown - attributes: - value: | - Please use this form to file an issue against the current release candidate. See current releases [here](https://github.com/facebook/react-native/releases). - - type: input - id: version - attributes: - label: Version - description: What release candidate version does this appear on? Please refer to [release candidate versions](https://github.com/facebook/react-native/releases). - placeholder: ex. 0.66.0-rc.2 - validations: - required: true - - type: input - id: target - attributes: - label: Build Target(s) - description: What target(s) are encountering this issue? - placeholder: iOS simulator in release flavor - validations: - required: true - - type: textarea - id: environment - attributes: - label: Developer Environment - description: Please list relevant versions of system, tooling. Ex. OS, processor, Xcode, etc. - validations: - required: true - - type: textarea - id: reproduction - attributes: - label: Issue and Reproduction Steps - description: Please describe the issue and list out commands run to reproduce. - validations: - required: true diff --git a/.github/ISSUE_TEMPLATE/upgrade-regression-form.yml b/.github/ISSUE_TEMPLATE/upgrade-regression-form.yml new file mode 100644 index 000000000000..4dede5ee379e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/upgrade-regression-form.yml @@ -0,0 +1,46 @@ +name: Upgrade - Build Regression +description: If you are upgrading to a new React Native version (stable or pre-release) and encounter a build regression. +labels: ["Needs: Triage :mag:", "Type: Upgrade Issue"] +body: + - type: markdown + attributes: + value: | + Please use this form to file an issue if you have upgarded or are upgrading to [latest stable release](https://github.com/facebook/react-native/releases/latest) and have experienced a regression (something that used to work in previous version). + - type: input + id: new-version + attributes: + label: New Version + description: This is the version you are attempting to upgrade to. + placeholder: ex. 0.66.1 + validations: + required: true + - type: input + id: old-version + attributes: + label: Old Version + description: This is the version you were on where the behavior was working. + placeholder: ex. 0.65.1 + validations: + required: true + - type: input + id: target + attributes: + label: Build Target(s) + description: What target(s) are encountering this issue? + placeholder: iOS simulator in release flavor + validations: + required: true + - type: textarea + id: react-native-info + attributes: + label: Output of `react-native info` + description: Run `react-native info` in your terminal, copy and paste the results here. + validations: + required: true + - type: textarea + id: reproduction + attributes: + label: Issue and Reproduction Steps + description: Please describe the issue and list out commands run to reproduce. + validations: + required: true diff --git a/.github/respond-to-issue-based-on-label.yml b/.github/respond-to-issue-based-on-label.yml index 65131ff0840d..57cc3eeb02a6 100644 --- a/.github/respond-to-issue-based-on-label.yml +++ b/.github/respond-to-issue-based-on-label.yml @@ -10,10 +10,6 @@ comment: > Please report documentation issues in the [`react-native-website`](https://github.com/facebook/react-native-website/issues) repository. close: true -"Type: Upgrade Issue": - comment: > - Do you need help upgrading to a newer React Native version? Visit the [Upgrade Support repository](https://github.com/react-native-community/upgrade-support) or use the [upgrade helper](https://react-native-community.github.io/upgrade-helper/) to see the changes that need to be made to upgrade your app. - close: true "Resolution: For Stack Overflow": comment: > We are using GitHub issues exclusively to track bugs in the core React Native library. Please try asking over on [Stack Overflow](http://stackoverflow.com/questions/tagged/react-native) as it is better suited for this type of question. diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index e0896503e04b..000000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 90 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Issues with these labels will never be considered stale -exemptLabels: - - Good first issue - - "Type: Discussion" - - Partner - - Core Team - - "Help Wanted :octocat:" - - "Impact: Regression" - - "Resolution: PR Submitted" - - "Resolution: Backlog" -# Label to use when marking an issue as stale -staleLabel: Stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. - You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. - Thank you for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: > - Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information. -only: issues diff --git a/.github/workflows/apply-version-label-issue.yml b/.github/workflows/apply-version-label-issue.yml new file mode 100644 index 000000000000..816d29876a20 --- /dev/null +++ b/.github/workflows/apply-version-label-issue.yml @@ -0,0 +1,16 @@ +name: Apply version label to issue + +on: + issues: + types: [opened, edited] + +jobs: + add-version-label-issue: + runs-on: ubuntu-latest + continue-on-error: true + + steps: + - uses: react-native-community/actions-apply-version-label@v0.0.3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + required-label: "Type: Upgrade Issue" diff --git a/.gitignore b/.gitignore index c60f27e2a091..31239be19569 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,7 @@ project.xcworkspace /packages/rn-tester/android/app/gradlew /packages/rn-tester/android/app/gradlew.bat /ReactAndroid/build/ +/ReactAndroid/.cxx/ /ReactAndroid/gradle/ /ReactAndroid/gradlew /ReactAndroid/gradlew.bat @@ -95,7 +96,8 @@ package-lock.json /vendor /template/vendor -# CocoaPods +# iOS / CocoaPods +/template/ios/build/ /template/ios/Pods/ /template/ios/Podfile.lock /packages/rn-tester/Gemfile.lock diff --git a/.prettierrc b/.prettierrc index bc951b8e09ab..600a26c49518 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,8 +1,8 @@ { + "arrowParens": "avoid", + "bracketSameLine": true, + "bracketSpacing": false, "requirePragma": true, "singleQuote": true, - "trailingComma": "all", - "bracketSpacing": false, - "jsxBracketSameLine": true, - "arrowParens": "avoid" + "trailingComma": "all" } diff --git a/BUCK b/BUCK index 9434d821f8b3..b9d639adff92 100644 --- a/BUCK +++ b/BUCK @@ -17,6 +17,7 @@ load( "RCT_IMAGE_URL_LOADER_SOCKET", "RCT_URL_REQUEST_HANDLER_SOCKET", "YOGA_CXX_TARGET", + "get_react_native_ios_target_sdk_version", "react_fabric_component_plugin_provider", "react_module_plugin_providers", "react_native_root_target", @@ -196,6 +197,32 @@ rn_xplat_cxx_library2( ], ) +rn_xplat_cxx_library2( + name = "RCTCxxLogUtils", + srcs = glob([ + "React/CxxLogUtils/*.mm", + ]), + header_namespace = "", + exported_headers = subdir_glob( + [ + ( + "React/CxxLogUtils", + "*.h", + ), + ], + prefix = "React", + ), + contacts = ["oncall+react_native@xmail.facebook.com"], + fbobjc_enable_exceptions = True, + labels = ["supermodule:xplat/default/public.react_native.infra"], + preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(), + visibility = ["PUBLIC"], + deps = [ + "//xplat/js/react-native-github:ReactInternal", + react_native_xplat_target("logger:logger"), + ], +) + RCTLIB_PATH = "Libraries/" RCTBASE_PATH = "React/Base/" @@ -253,6 +280,7 @@ REACT_PUBLIC_HEADERS = { "React/RCTLayoutAnimationGroup.h": RCTMODULES_PATH + "RCTLayoutAnimationGroup.h", "React/RCTLog.h": RCTBASE_PATH + "RCTLog.h", "React/RCTManagedPointer.h": RCTBASE_PATH + "RCTManagedPointer.h", + "React/RCTMockDef.h": RCTBASE_PATH + "RCTMockDef.h", "React/RCTModalHostViewController.h": RCTVIEWS_PATH + "RCTModalHostViewController.h", "React/RCTModalHostViewManager.h": RCTVIEWS_PATH + "RCTModalHostViewManager.h", "React/RCTModalManager.h": RCTVIEWS_PATH + "RCTModalManager.h", @@ -260,9 +288,11 @@ REACT_PUBLIC_HEADERS = { "React/RCTModuleMethod.h": RCTBASE_PATH + "RCTModuleMethod.h", "React/RCTMultipartStreamReader.h": RCTBASE_PATH + "RCTMultipartStreamReader.h", "React/RCTNullability.h": RCTBASE_PATH + "RCTNullability.h", + "React/RCTPLTag.h": RCTBASE_PATH + "RCTPLTag.h", "React/RCTPackagerClient.h": RCTDEVSUPPORT_PATH + "RCTPackagerClient.h", "React/RCTPackagerConnection.h": RCTDEVSUPPORT_PATH + "RCTPackagerConnection.h", "React/RCTPerformanceLogger.h": RCTBASE_PATH + "RCTPerformanceLogger.h", + "React/RCTPerformanceLoggerLabels.h": RCTBASE_PATH + "RCTPerformanceLoggerLabels.h", "React/RCTPointerEvents.h": RCTVIEWS_PATH + "RCTPointerEvents.h", "React/RCTProfile.h": "React/Profiler/RCTProfile.h", "React/RCTPushNotificationManager.h": RCTLIB_PATH + "PushNotificationIOS/RCTPushNotificationManager.h", @@ -307,6 +337,7 @@ REACT_PUBLIC_HEADERS = { "React/RCTVersion.h": RCTBASE_PATH + "RCTVersion.h", "React/RCTView.h": RCTVIEWS_PATH + "RCTView.h", "React/RCTViewManager.h": RCTVIEWS_PATH + "RCTViewManager.h", + "React/RCTViewUtils.h": RCTVIEWS_PATH + "RCTViewUtils.h", "React/RCTWeakProxy.h": RCTBASE_PATH + "RCTWeakProxy.h", "React/RCTWeakViewHolder.h": RCTVIEWS_PATH + "RCTWeakViewHolder.h", "React/RCTWrapperViewController.h": RCTVIEWS_PATH + "RCTWrapperViewController.h", @@ -409,6 +440,7 @@ rn_xplat_cxx_library2( "//xplat/js/react-native-github/ReactCommon/react/nativemodule/core:", "//xplat/js/react-native-github/ReactCommon/react/nativemodule/samples:", "//xplat/js/react-native-github/packages/rn-tester:", + "//xplat/rtc/manul/...", ], deps = [ YOGA_CXX_TARGET, @@ -439,7 +471,6 @@ rn_xplat_cxx_library2( "React/RCTComponentViewRegistry.h": "React/Fabric/Mounting/RCTComponentViewRegistry.h", "React/RCTFabricSurface.h": "React/Fabric/Surface/RCTFabricSurface.h", "React/RCTFabricSurfaceHostingProxyRootView.h": "React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h", - "React/RCTFabricSurfaceHostingView.h": "React/Fabric/Surface/RCTFabricSurfaceHostingView.h", "React/RCTGenericDelegateSplitter.h": "React/Fabric/Utils/RCTGenericDelegateSplitter.h", "React/RCTLegacyViewManagerInteropComponentView.h": "React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h", "React/RCTLocalizationProvider.h": "React/Fabric/RCTLocalizationProvider.h", @@ -466,7 +497,7 @@ rn_xplat_cxx_library2( ], contacts = ["oncall+react_native@xmail.facebook.com"], fbobjc_enable_exceptions = True, - fbobjc_target_sdk_version = "11.0", + fbobjc_target_sdk_version = get_react_native_ios_target_sdk_version(), frameworks = [ "$SDKROOT/System/Library/Frameworks/Foundation.framework", "$SDKROOT/System/Library/Frameworks/QuartzCore.framework", @@ -505,6 +536,7 @@ rn_xplat_cxx_library2( ":RCTFabricComponentViewsBase", "//fbobjc/Libraries/FBReactKit/RCTFabricComponent/RCTFabricComponentPlugin:RCTFabricComponentPlugin", "//xplat/js/react-native-github:RCTCxxBridge", + "//xplat/js/react-native-github:RCTCxxLogUtils", "//xplat/js/react-native-github:RCTCxxUtils", "//xplat/js/react-native-github:RCTImage", "//xplat/js/react-native-github:RCTPushNotification", @@ -549,6 +581,7 @@ rn_apple_library( ], ), autoglob = False, + complete_nullability = True, contacts = ["oncall+react_native@xmail.facebook.com"], extension_api_only = True, frameworks = [ @@ -690,12 +723,12 @@ rn_library( "//xplat/js:node_modules__abort_19controller", "//xplat/js:node_modules__anser", "//xplat/js:node_modules__base64_19js", + "//xplat/js:node_modules__deprecated_19react_19native_19prop_19types", "//xplat/js:node_modules__event_19target_19shim", "//xplat/js:node_modules__invariant", "//xplat/js:node_modules__nullthrows", "//xplat/js:node_modules__pretty_19format", "//xplat/js:node_modules__promise", - "//xplat/js:node_modules__prop_19types", "//xplat/js:node_modules__react_19devtools_19core", "//xplat/js:node_modules__react_19refresh", "//xplat/js:node_modules__react_19shallow_19renderer", diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000000..af18fc21009c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4016 @@ +# Changelog + +## v0.67.1 + +### Fixed + +#### Android specific + +- Do not remove libjscexecutor.so from release builds ([574a773f8f](https://github.com/facebook/react-native/commit/574a773f8f55fe7808fbb672066be8174c64d76d) by [@cortinico](https://github.com/cortinico)) + +#### iOS specific + +- Remove alert's window when call to `hide`. ([a46a99e120](https://github.com/facebook/react-native/commit/a46a99e12039c2b92651af1996489d660e237f1b) by [@asafkorem](https://github.com/asafkorem)) + +## v0.67.0 + +### Added + +#### Android specific +- Add `ACCESS_MEDIA_LOCATION` permission to PermisionsAndroid library. ([79db483568](https://github.com/facebook/react-native/commit/79db4835681f5d0149620ec8e0990411cb882241) by [@Skrilltrax](https://github.com/Skrilltrax)) +- Implement `SnapToAlignment` in `ReactScrollView` ([e774c037bc](https://github.com/facebook/react-native/commit/e774c037bce40a4b48e78d2d0a1085a1e4f5a328)), `ReactScrollViewManager` ([c6e5640e87](https://github.com/facebook/react-native/commit/c6e5640e87e7cb5b514ded2c8d4cbb039bd02c5f)), `ReactHorizontalScrollView` ([b12256394e](https://github.com/facebook/react-native/commit/b12256394e34c375942ca508ef79a8c816317976)), `ReactHorizontalScrollViewManager` ([deec1db9fd](https://github.com/facebook/react-native/commit/deec1db9fdf2848941326ba5bebc11f3592a301e)) and update `ScrollView.js` ([a54cfb9e57](https://github.com/facebook/react-native/commit/a54cfb9e5794f196d3834e19762f3aacf47a177d)) and reach parity with iOS ([04184ef851](https://github.com/facebook/react-native/commit/04184ef851c71141009c523ba59838ae6af19ba5)) by [@mdvacca](https://github.com/mdvacca) +- Show Redbox for C++ errors. ([d6c879edba](https://github.com/facebook/react-native/commit/d6c879edbad068d0f461381875b7fae6db99d18d) by [@sota000](https://github.com/sota000)) +- Added an experimental touch dispatch path ([a2feaeb5f1](https://github.com/facebook/react-native/commit/a2feaeb5f1121a860a9416b5d4e0e96debd45b09) by [@ShikaSD](https://github.com/ShikaSD)) + +#### iOS specific +- Added `cancelButtonTintColor` prop for `ActionSheetIOS` to change only the text color of the cancel button ([01856633a1](https://github.com/facebook/react-native/commit/01856633a1d42ed3b26e7cc93a007d7948e1f76e) by [@nomi9995](https://github.com/nomi9995)) +- Added [`LSApplicationQueriesSchemes`](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/LaunchServicesKeys.html#//apple_ref/doc/uid/TP40009250-SW14) in info.plist with entries tel, telprompt, http, fb, geo ([b26f277262](https://github.com/facebook/react-native/commit/b26f2772624c863c91fa1ff627b481c92d7562fb) by [@utkarsh-dixit](https://github.com/utkarsh-dixit)) +- Add `UIAccessibilityTraitUpdatesFrequently` to progressBar role ([1a42bd6e97](https://github.com/facebook/react-native/commit/1a42bd6e97ae44a3b38ca552865bac63a6f35da5) by [@jimmy623](https://github.com/jimmy623)) +- Add `asdf-vm` support in `find-node.sh` ([3e7c310b1d](https://github.com/facebook/react-native/commit/3e7c310b1dcf5643920535eea70afa451888792a) by [@pastleo](https://github.com/pastleo)) + + +### Changed +- `ImageBackground` now respects `imageStyle` width and height ([dbd5c3d8e5](https://github.com/facebook/react-native/commit/dbd5c3d8e5e35685be89156194a96cead553a330) by [@Naturalclar](https://github.com/Naturalclar)) +- Rename deprecated `Keyboard.removeEventListener` to `Keyboard.removeListener`. ([8880c09076](https://github.com/facebook/react-native/commit/8880c09076e4727768ace26a74766cbe6f64021c) by [@yungsters](https://github.com/yungsters)) +- Update `Modal`'s mock to not render its children when it is not visible ([ec614c16b3](https://github.com/facebook/react-native/commit/ec614c16b331bf3f793fda5780fa273d181a8492) by [@AntoineDoubovetzky](https://github.com/AntoineDoubovetzky)) +- Upgraded `react-devtools-core` dependency to 4.19.1 ([356236471a](https://github.com/facebook/react-native/commit/356236471abc6b5b8c139223e15388fd1eecd2d1) by [@jstejada](https://github.com/jstejada)) +- React-native/normalize-color now supports Node.js ([65e58f26e1](https://github.com/facebook/react-native/commit/65e58f26e1fbd06b1ae32e2ab3a2616c8eef08e0) by [@yungsters](https://github.com/yungsters)) +- Updated to Contributor Covenant v2.1 ([19f8d2f7da](https://github.com/facebook/react-native/commit/19f8d2f7da13f4524f31acf7aa10cc0aa91b5da4)) + + +#### Android specific +- Hermes initialization will no longer need an explicit configuration. ([a40f973f58](https://github.com/facebook/react-native/commit/a40f973f58609ca717fac63bc501d5cf93b748ad) by [@Ashoat](https://github.com/Ashoat)) +- Setting `overflow: scroll` in View component style will clip the children in the View container ([93beb83abe](https://github.com/facebook/react-native/commit/93beb83abef42b92db43ee3bb8b156f486a6c00f) by [@ryancat](https://github.com/ryancat)) +- Native views backing `Animated.View` (w/ JavaScript-driven animations) will no longer be flattened; this should be a transparent change. ([4fdbc44ab5](https://github.com/facebook/react-native/commit/4fdbc44ab5945399338e4ed94ea5611098bd2142) by [@yungsters](https://github.com/yungsters)) +- Use new Locale API on Android 11 (API 30)+ ([b7c023a8c1](https://github.com/facebook/react-native/commit/b7c023a8c1122500c6ceb7de2547569b3b9251ba)) +- Changed `react.gradle` `detectCliPath` function logic for `cliPath` case ([ce51b62494](https://github.com/facebook/react-native/commit/ce51b6249449361ee50b8c99a427c28af7ab3531) by [@vitalyiegorov](https://github.com/vitalyiegorov)) +- Remove `"high"` and `"balanced"` as values for `android_hyphenationFrequency` on `Text` ([a0d30b848a](https://github.com/facebook/react-native/commit/a0d30b848a07480d0fccec608a62a505c71f8cac)) +- Bump Gradle version to 7.2, Bump Kotlin version to 1.5.31 ([9ae3367431](https://github.com/facebook/react-native/commit/9ae3367431428748f5486c782199beb4f9c6b477) by [@svbutko](https://github.com/svbutko)) +- Move mavenCentral repo below local paths ([046b02628d](https://github.com/facebook/react-native/commit/046b02628d32eadd6d44160ab79932f6c26b188d) by [@friederbluemle](https://github.com/friederbluemle)) + +#### iOS specific +- Optimized font handling for iOS ([4ac42d88ef](https://github.com/facebook/react-native/commit/4ac42d88ef60ae3fed7319851d47b93e98ac9afa) by [@Adlai-Holler](https://github.com/Adlai-Holler)) +- Remove iOS 11 version check as minimum deployment is iOS 11 ([398595e074](https://github.com/facebook/react-native/commit/398595e07483fa8f45579de4ca1aee9585e20620) by [@ken0nek](https://github.com/ken0nek)) +- Don't hang app for 60s if packager can't be reached, changed to 10s ([c0e04460f5](https://github.com/facebook/react-native/commit/c0e04460f546dfef2623bff367eb8db8fd75fa34) by [@radex](https://github.com/radex)) + +### Removed + +- Removed unnecessary global variable `GLOBAL`. ([a101fc768c](https://github.com/facebook/react-native/commit/a101fc768cedc7ac9754006e5b7292bb7084ab54) by [@rubennorte](https://github.com/rubennorte)) +- Removed unused files: `StaticContainer.react.js`, `ensurePositiveDelayProps.js`, `InteractionMixin.js`, `queryLayoutByID.js` ([64aa1e5ffe](https://github.com/facebook/react-native/commit/64aa1e5ffe5d577c04cabb3692246b956f65597b) by [@ecreeth](https://github.com/ecreeth)) + +#### Android specific + +- Remove `DatePickerAndroid` from react-native. ([7a770526c6](https://github.com/facebook/react-native/commit/7a770526c626e6659a12939f8c61057a688aa623) by [@andresantonioriveros](https://github.com/andresantonioriveros)) + +#### iOS specific + +### Fixed + +- Update metro config language to `blockList` ([7923804c28](https://github.com/facebook/react-native/commit/7923804c28aac731396f0db112cb6c3a9d30c08f) by [@rh389](https://github.com/rh389)) +- Ignores global npm prefix ([6334ac35ac](https://github.com/facebook/react-native/commit/6334ac35ac3cbc2c84b2d46d46ec118bf9bf714d) by [@redreceipt](https://github.com/redreceipt)) +- Support `Animated.ValueXY` when validating `Animated.event`. ([27dd2ecb70](https://github.com/facebook/react-native/commit/27dd2ecb70f1d08787c93a2e18250ffaff328e5f) by [@javache](https://github.com/javache)) +- Add a function `getIgnorePatterns` in `LogBoxData.js` for tests or other usecases. ([a950634424](https://github.com/facebook/react-native/commit/a950634424cddf31c0adb6c9799adf1cc5f83bf0)) + +#### Android specific + +- TextInput Drawable to avoid Null Pointer Exception RuntimeError https://github.com/facebook/react-native/issues/17530 ([254493e1fb](https://github.com/facebook/react-native/commit/254493e1fb0c3a1e279e2c957e83edac6252d041) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Nested Text Android `onPress` does not work with last character ([132d1d00f8](https://github.com/facebook/react-native/commit/132d1d00f885fe5a45d712fd7698db285c22bc4b) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fix non selectable Text in FlatList ([c360b1d92b](https://github.com/facebook/react-native/commit/c360b1d92b69e1d298b390ec88c4d29c1023945a) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Set `textBreakStrategy` default to be `'highQuality'` ([3b2d541989](https://github.com/facebook/react-native/commit/3b2d5419899363d84aea4f5cc3a4c75253dd6406)) +- Fix error handling when loading JSC or Hermes ([d839b24b06](https://github.com/facebook/react-native/commit/d839b24b06d31b4ce91fb459742831b942972f56) by [@iqqmuT](https://github.com/iqqmuT)) +- Fix encoding for gradlew.bat files ([ab2bdee735](https://github.com/facebook/react-native/commit/ab2bdee735cd0d53d3dbfbac5cd31f96eefb7e61) by [@yungsters](https://github.com/yungsters)) +- Fix `hermesFlags` not working with multiple variants ([91adb761cf](https://github.com/facebook/react-native/commit/91adb761cf1583598d4d63ce879fd7e0f4ae793c) by [@grit96](https://github.com/grit96)) +- `ScrollTo` API in ScrollView will check the actual scroll position before setting the scroll state ([1a9e2d5d55](https://github.com/facebook/react-native/commit/1a9e2d5d5589ce5cee92868ea5bccceb6e161eff) by [@ryancat](https://github.com/ryancat)) +- Compute Android Notch in `keyboardDidShow` height calculation API 28+ ([8bef3b1f11](https://github.com/facebook/react-native/commit/8bef3b1f1136ab5c2f2309a3101a7d9626ced1f5) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fix `currentActivity` being null when launching Redbox ([f4fdf4b55e](https://github.com/facebook/react-native/commit/f4fdf4b55e4489c21f4552b4ac01ef253c038b2d)) +- When sending OS intents, always set `"FLAG_ACTIVITY_NEW_TASK"` flag (required by OS). ([04fe3ed80d](https://github.com/facebook/react-native/commit/04fe3ed80d9c201a483a2b477aeebd3d4169fd6d) by [@Krizzu](https://github.com/Krizzu)) +- Fix missing WebView provider crash in ForwardingCookieHandler ([d40cb0e1b0](https://github.com/facebook/react-native/commit/d40cb0e1b0fb233a27b9d476167814d2853acf2a) by [@RodolfoGS](https://github.com/RodolfoGS)) +- Fix `keyboardDismissMode="on-drag"` on Android ([7edf9274cf](https://github.com/facebook/react-native/commit/7edf9274cf6d3398075c19cd1cb020a5d6a346a2) by [@janicduplessis](https://github.com/janicduplessis)) +- Fixed `alignItems: baseline` for elements on Android ([1acf334614](https://github.com/facebook/react-native/commit/1acf33461451834097463f43e70d90bae0f67198)) +- `OnKeyPress` event not fired with numeric keys ([ee3e71f536](https://github.com/facebook/react-native/commit/ee3e71f536127295ba4ea377e618499409a2e9ba) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Exclude unused .so files for reduce android .apk and .aab ([6f126740fa](https://github.com/facebook/react-native/commit/6f126740fa560d7a831979b9f3747baacfb28dba) by [@enniel](https://github.com/enniel)) + +#### iOS specific + +- Fixed an edge case when scroll to item/index is called without animation, the offset position is not updated. This caused the measurement of the position to be wrong. ([55392f65a6](https://github.com/facebook/react-native/commit/55392f65a6addbdd8214b61d4ae286f26d63a94f) by [@ryancat](https://github.com/ryancat)) +- Fixed the issue when moving cursor in multi-line TextInput. ([22801870f0](https://github.com/facebook/react-native/commit/22801870f0613c2544ade1ebc5363e6e2f015c79) by [@xiankuncheng](https://github.com/xiankuncheng)) +- Fix NSInvalidArgumentException for invalid font family names. ([5683932862](https://github.com/facebook/react-native/commit/5683932862ab870e735342342c68e03fb5ca9e09) by [@yungsters](https://github.com/yungsters)) +- Fix Image `defaultSource` not showing on iOS ([900210cacc](https://github.com/facebook/react-native/commit/900210cacc4abca0079e3903781bc223c80c8ac7) by [@cristianoccazinsp](https://github.com/cristianoccazinsp)) +- Warn if Rosetta2 is being used (x86_64 on arm64) ([51bf557948](https://github.com/facebook/react-native/commit/51bf55794899284e1c465d346a3f6ebd8a485da2) by [@barbieri](https://github.com/barbieri)) +- Source map path for schemes containing whitespaces ([f3fe7a0fb5](https://github.com/facebook/react-native/commit/f3fe7a0fb5fc0325fbe062c6df4cbf8b58779189) by [@andersonvom](https://github.com/andersonvom)) +- Fix build error after running `pod install` with `--project-directory=ios` ([ef5ff3e055](https://github.com/facebook/react-native/commit/ef5ff3e055482771cbe866d4961ee2d0a9e00e45) by [@sonicdoe](https://github.com/sonicdoe)) +- Fixed inability to build apps when gflags is installed ([ab8dbdf663](https://github.com/facebook/react-native/commit/ab8dbdf66363f3d65f0dfbcc4ec7c71b1cd69b2a) by [@KDederichs](https://github.com/KDederichs)) + +### Security + +- Avoiding logging root view params outside of dev / debug mode builds ([e612d3a116](https://github.com/facebook/react-native/commit/e612d3a116f39ab354169643bab0d4bb9cfc1a85) by [@sterlingwes](https://github.com/sterlingwes)) + +## v0.66.4 + +### Fixed + +#### iOS specific + +- Revert "Fix Deadlock in RCTi18nUtil (iOS)" ([70ddf46](https://github.com/facebook/react-native/commit/70ddf46c8afcd720e188b6d82568eac6ac8125e6) by [@Saadnajmi](https://github.com/Saadnajmi)) +- `apply_Xcode_12_5_M1_post_install_workaround` causing pods targetting iOS 12 and above to fail ([a4a3e67554](https://github.com/facebook/react-native/commit/a4a3e675542827bb281a7ceccc7b8f5533eae29f) by [@Yonom](https://github.com/Yonom)) + +## v0.66.3 + +### Changed + +- Rename deprecated `Keyboard.removeEventListener` to `Keyboard.removeListener`. ([8880c09076](https://github.com/facebook/react-native/commit/8880c09076e4727768ace26a74766cbe6f64021c) by [@yungsters](https://github.com/yungsters)) + +### Fixed + +- Revert changes in Jest preprocessor to fix tests in external projects ([142090a5f3fa7](https://github.com/facebook/react-native/commit/142090a5f3fa7c3ab2ed4c536792e3f26582bd3b) by [@rubennorte](https://github.com/rubennorte)) + +## v0.66.2 + +### Fixed + +- Add a function `getIgnorePatterns` in `LogBoxData.js` for tests or other usecases. ([a950634424](https://github.com/facebook/react-native/commit/a950634424cddf31c0adb6c9799adf1cc5f83bf0)) +- Reintroduce generated codegen files ([7382f556d3](https://github.com/facebook/react-native/commit/7382f556d327d51bd09456efda83edec7e05ecd2) by [@kelset](https://github.com/kelset)) + +#### iOS specific + +- Hide the logbox window explicitly. New behavior in iOS SDK appears to retain UIWindow while visible. ([72ea0e111f](https://github.com/facebook/react-native/commit/72ea0e111fccd99456abf3f974439432145585e3) by [@paddlefish](https://github.com/paddlefish)) + +## v0.66.1 + +### Fixed + +- For Android, general fixes to Appearance API and also fixes AppCompatDelegate.setDefaultNightMode(). For iOS, now works correctly when setting window.overrideUserInterfaceStyle ([25a2c608f7](https://github.com/facebook/react-native/commit/25a2c608f790f42cbc4bb0a90fc06cc7bbbc9b95) by [@mrbrentkelly](https://github.com/mrbrentkelly)) + +#### Android specific + +- Fix Android border positioning regression ([d1a33cd139](https://github.com/facebook/react-native/commit/d1a33cd139fab4565b1fc691f5751c4af99d5849) by [@oblador](https://github.com/oblador)) + +#### iOS specific + +- Fix for unable to find `find-node.sh` in `react-native-xcode.sh` script ([cc59a7cbde](https://github.com/facebook/react-native/commit/cc59a7cbde1c0fc6d6ef059321d23bf287f08218) by [@garethknowles](https://github.com/garethknowles)) + +## v0.66.0 + +### Highlights + +- Hermes 0.9.0 + - This Hermes release is primarily about closing gap between Hermes cut and this React Native release. Among ~400 commits, contains memory and size wins, bugfixes and other progress behind the scenes. See [issue for more details](https://github.com/facebook/hermes/issues/586). +- Allow taps on views outside the bounds of a parent with `overflow: visible` ([e35a963bfb](https://github.com/facebook/react-native/commit/e35a963bfb93bbbdd92f4dd74d14e2ad6df5e14a) by [@hsource](https://github.com/hsource)) +- Fixes for building on Apple Silicon and Xcode 13 ([ac4ddec542](https://github.com/facebook/react-native/commit/ac4ddec542febda744de218dae3a3d34edc7da84) thanks to [@mikehardy](https://github.com/mikehardy)) +- New bluetooth permissions for Android ([2bcc6fac38](https://github.com/facebook/react-native/commit/2bcc6fac3844f0752bc7067517c92a643679575e), [eeb8e58](https://github.com/facebook/react-native/commit/eeb8e5829e183f6b5cd5fd327cf6da03a7db0541) by [@iBotPeaches](https://github.com/iBotPeaches)) + +### Breaking + +- Remove Picker and PickerIOS components + [cddb97ad18](https://github.com/facebook/react-native/commit/cddb97ad18cfdb663dcf015af3c9426d5414e396), [77366cd869](https://github.com/facebook/react-native/commit/77366cd8696cb8ada3f84d7fb4d36a27f7007b06), [ad0ccac0d6](https://github.com/facebook/react-native/commit/ad0ccac0d6471fa5428bf137c3aa0646883e8446) +- Remove StatusBarIOS component ([7ce0f40f5c](https://github.com/facebook/react-native/commit/7ce0f40f5cd8c0928ce720d6d121bcc5963958a2) by [@ecreeth](https://github.com/ecreeth)) + +#### Android specific + +- Updated `autoCompleteType` prop of `TextInput` to `autoComplete` ([27fec9569e](https://github.com/facebook/react-native/commit/27fec9569e08a04e0dbdbd5de063a599ad0416fa) by [@jeswinsimon](https://github.com/jeswinsimon)) + +### Added + +- Add `global.queueMicrotask` ([be189cd819](https://github.com/facebook/react-native/commit/be189cd81905a735f08a8519c62a707658c7fb27) by [@Huxpro](https://github.com/Huxpro)) +- Added data field to `markerPoint` to allow callers to add additional arbitrary string data to logged points ([aa98978302](https://github.com/facebook/react-native/commit/aa9897830293955b7cc77fd818a50e8d736e715d)) +- Adds accessibility actions to Button ([44717152ca](https://github.com/facebook/react-native/commit/44717152cadb18c7aff74e9465fdb70efdb1bf81) by [@dennisurtubia](https://github.com/dennisurtubia)) +- Add accessibilityState prop to Slider component ([35dd86180b](https://github.com/facebook/react-native/commit/35dd86180ba730425b97592ef6e5c4d449caee06) by [@sladyn98](https://github.com/sladyn98)) +- Add support for "togglebutton" `accessibilityRole` ([da899c0cc4](https://github.com/facebook/react-native/commit/da899c0cc4372830e5ca053a096b74fff2a19cb8) by [@kacieb](https://github.com/kacieb)) + +#### Android specific + +- Add INFO, and MENU key event support ([bb33c1050b](https://github.com/facebook/react-native/commit/bb33c1050ba6098a68d70055e33186d9438c4374) by [@havlasme](https://github.com/havlasme)) +- Added all autofill types to TextEdit ([d9e0ea77f0](https://github.com/facebook/react-native/commit/d9e0ea77f0111fd8400c65d68e45d54e2f84287b) by [@safaiyeh](https://github.com/safaiyeh)) +- Add support to URI keyboard type in Android ([1465c8f387](https://github.com/facebook/react-native/commit/1465c8f3874cdee8c325ab4a4916fda0b3e43bdb)) +- Add `MEDIA_STOP`, `MEDIA_NEXT`, and `MEDIA_PREVIOUS` event support to Android TV ([3e2bb331fc](https://github.com/facebook/react-native/commit/3e2bb331fc0974bc870b2e7bd3171e585183ed1b) by [@havlasme](https://github.com/havlasme)) +- Allow configuring ndk build architectures ([d6ed1ff58b](https://github.com/facebook/react-native/commit/d6ed1ff58b2ca4d1c8b45416e56fa1da75633c07) by [@janicduplessis](https://github.com/janicduplessis)) +- Added support for accessibility role of "list" for flatlist and sectioned list ([25a16123a6](https://github.com/facebook/react-native/commit/25a16123a610ae377ced23ef81ed4c03ad7d06d9) by [@anaskhraza](https://github.com/anaskhraza)) +- Support for foreground ripple in Pressable ([0823f299e5](https://github.com/facebook/react-native/commit/0823f299e560efda5c0f344fcec86cf68801f4ab) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway)) +- Support for ScrollAway native nav bars added to `ReactScrollView` ([0ef5beee85](https://github.com/facebook/react-native/commit/0ef5beee855afa592cc647383ba6a3ceae9cc40a) by [@JoshuaGross](https://github.com/JoshuaGross)) + +#### iOS specific + +- Added new prop "selection" to `TextInputProps` ([8434177722](https://github.com/facebook/react-native/commit/8434177722f70a9325f9a6adf46b5315b1f4ffa4)) +- Support for onRequestClose for iOS Modal component. ([c29ec46b0e](https://github.com/facebook/react-native/commit/c29ec46b0eee99670ce7762898fe3a4810db968b) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway)) +- Allow `PlatformColor` to return user-defined named asset color ([36c0a7dec1](https://github.com/facebook/react-native/commit/36c0a7dec121bd3a4b92d02c03a24771d3c4cf84) by [@oblador](https://github.com/oblador)) +- Add support for the `UIAccessibilityTraitsTabBar` ([11f8d9c7cd](https://github.com/facebook/react-native/commit/11f8d9c7cd4bae0b1a5e880ea9b2da7447ad76c2) by [@jimmy623](https://github.com/jimmy623)) +- Added "altitudeAngle" property to touch events from Apple Pencil/Stylus devices. ([f1b1ba8963](https://github.com/facebook/react-native/commit/f1b1ba8963ff152d995c3cd132bc0755413bc44f) by [@swittk](https://github.com/swittk)) +- Introduce `RCTInitializing` to allow NativeModules to initialize themselves ([9b45df1fce](https://github.com/facebook/react-native/commit/9b45df1fced066f40034b0a58be6f4caafd5f785) by [@RSNara](https://github.com/RSNara)) +- Introduce `RCTCallableJSModules` API for NativeModules ([ece373d244](https://github.com/facebook/react-native/commit/ece373d24421d96e62dafa9a064b38acd6b71e46) by [@RSNara](https://github.com/RSNara)) +- Attach `RCTBundleManager` to NativeModules ([329f58ee46](https://github.com/facebook/react-native/commit/329f58ee461e7afade36d8c249d3f4930c485312) by [@RSNara](https://github.com/RSNara)) +- Introduce RCTBundleManager for bundleURL access ([4a1bafe591](https://github.com/facebook/react-native/commit/4a1bafe591917482d78be998d45552e2568e3e23) by [@RSNara](https://github.com/RSNara)) + +### Changed + +- Initialized LogBox earlier and centralized access in LogBox module ([8abe737068](https://github.com/facebook/react-native/commit/8abe737068a54a874571c8b5560b2118b1df31ad) by [@rubennorte](https://github.com/rubennorte)) +- ExceptionsManager will no longer report exceptions with `type === 'warn'`. ([883e0d5752](https://github.com/facebook/react-native/commit/883e0d5752b952c829c8d45504d3532f52bb272f) by [@yungsters](https://github.com/yungsters)) +- Disable TouchableOpacity when `accessibilityState.disabled` is set ([ea609defe8](https://github.com/facebook/react-native/commit/ea609defe8462a6beeac4da3aa7a43397ee9a77f) by [@chakrihacker](https://github.com/chakrihacker)) +- Upgrade Babel from 7.12.3 to 7.14.1 ([58a0f9b4e2](https://github.com/facebook/react-native/commit/58a0f9b4e202a921ab0820c79d6a3dd54204da46) by [@MichaReiser](https://github.com/MichaReiser)) +- Upgrade `react-devtools-core` from ~4.6.0 to ^4.13.0 ([9e020ef476](https://github.com/facebook/react-native/commit/9e020ef476e24bb5703fc421225f1a94ae14512b) by [@bvaughn](https://github.com/bvaughn)) +- Update Flipper to 0.99.0 ([41f45a77ad](https://github.com/facebook/react-native/commit/41f45a77ad09b46de328fb2a72775a052dac1e93) by [@swrobel](https://github.com/swrobel)) +- Bump CLI to ^6.0.0 ([c677e196a9](https://github.com/facebook/react-native/commit/c677e196a9c4d6cfdf84d97e4746922bb4ed4823) by [@thymikee](https://github.com/thymikee)) +- Upgrade ESLint TS parser and plugin ([3b751d396b](https://github.com/facebook/react-native/commit/3b751d396ba0acaa1b4c8e1115c79eb45dab403d) by [@wcandillon](https://github.com/wcandillon)) +- Upgrade folly to 2021.06.28.00 and boost to 1.76.0 ([b77948e33b](https://github.com/facebook/react-native/commit/b77948e33bc5e0df422fffca3b4c9253f611d298) by [@Kudo](https://github.com/Kudo)) + +#### Android specific + +- Add BLUETOOTH_ADVERTISE to `PermissionsAndroid` ([2bcc6fac38](https://github.com/facebook/react-native/commit/2bcc6fac3844f0752bc7067517c92a643679575e) by [@iBotPeaches](https://github.com/iBotPeaches)) +- Native ScrollView listeners list maintains weak references to listeners to avoid memory leaks ([b673e352fb](https://github.com/facebook/react-native/commit/b673e352fb0ea44b545edf5a7e8c1b422180838a) by [@dalves](https://github.com/dalves)) +- Rename the "Toggle Inspector" DevMenu item to "Hide/Show Element Inspector" ([e91fb05db7](https://github.com/facebook/react-native/commit/e91fb05db7f576e07114755b9db1eee91c672f25) by [@RSNara](https://github.com/RSNara)) +- Localize "search", "button", and "togglebutton" accessibility roles by using the platform roles ([399285f91c](https://github.com/facebook/react-native/commit/399285f91c2f675dea16fe61a86049ef7fecf35b) by [@kacieb](https://github.com/kacieb)) +- Refactor `AndroidTextInput.AndroidTextInput.color` prop to use SharedColor instead of int ([bc57056cc3](https://github.com/facebook/react-native/commit/bc57056cc3263431d54982426d890ba60b4cadb7) by [@mdvacca](https://github.com/mdvacca)) +- Upgraded `infer-annotation` to 0.18.0. ([b5c94e316c](https://github.com/facebook/react-native/commit/b5c94e316cc9b4ff090d8daa8970bf1becf77959) by [@yungsters](https://github.com/yungsters)) +- Bumped AGP to 4.2.2 ([ae494e7ce1](https://github.com/facebook/react-native/commit/ae494e7ce199cc5d524f791d45ddce51535cdadb) by [@cortinico](https://github.com/cortinico)) +- Upgrade folly to 2021.06.28.00 ([ebe939b18a](https://github.com/facebook/react-native/commit/ebe939b18aa859eb0f7f265222874c292ed771a4) by [@Kudo](https://github.com/Kudo)) +- Bump NDK to 21.4.7075529 ([aa43aab77c](https://github.com/facebook/react-native/commit/aa43aab77c8571632a2b0913c80fbf822dac01bc) by [@dulmandakh](https://github.com/dulmandakh)) + +#### iOS specific + +- ScrollView scrollIndicatorInsets to not automatically add safe area on iOS13+ ([bc1e602e0c](https://github.com/facebook/react-native/commit/bc1e602e0c7922da6bf238675b7bf8b4c3faa493) by [@justinwh](https://github.com/justinwh)) + +### Removed + +- `StyleSheet.create` will no longer do DEV-time validation. ([2e8c0bd7ea](https://github.com/facebook/react-native/commit/2e8c0bd7ea7db1aac183eb7f656772d3cffcb132) by [@yungsters](https://github.com/yungsters)) + +### Fixed + +- Fix `window` not existing in jest setup ([bc1c533833](https://github.com/facebook/react-native/commit/bc1c533833bfe25a22f1abd105b8bcb1babce3b5) by [@timomeh](https://github.com/timomeh)) +- Clamp negative values for `numberOfLines` in component ([3bc883c6c6](https://github.com/facebook/react-native/commit/3bc883c6c60632f6a41df3867368f16f684b3865) by [@ShikaSD](https://github.com/ShikaSD)) +- Add missing `jest/create-cache-key-function` dep root package.json ([9a43eac7a3](https://github.com/facebook/react-native/commit/9a43eac7a32a6ba3164a048960101022a92fcd5a) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix Switch ref forwarding ([1538fa4455](https://github.com/facebook/react-native/commit/1538fa4455fa7095879aceba7f74a519c1337a8b) by [@janicduplessis](https://github.com/janicduplessis)) +- Report fatal errors even if its `type` is "warn". ([e4a4c4d6d7](https://github.com/facebook/react-native/commit/e4a4c4d6d71ab1a747d768e4b518e64e100ddfde) by [@yungsters](https://github.com/yungsters)) +- Parse `accessibilityAction` props into object instead of string ([faaeb778df](https://github.com/facebook/react-native/commit/faaeb778dfe25df67fc00b599d023819c10406e8) by [@ShikaSD](https://github.com/ShikaSD)) +- Avoid downgrading `console.error` when passed warning-like objects. ([0dba0aff18](https://github.com/facebook/react-native/commit/0dba0aff185f4fd46e1146362235e68e52c59556) by [@yungsters](https://github.com/yungsters)) +- Fix natively driven animations not getting reset properly ([129180c77b](https://github.com/facebook/react-native/commit/129180c77b0b99a3acedbeb04ce6ec4667f74cac) by [@tienphaw](https://github.com/tienphaw)) +- Fix compilation errors on Windows. ([6d04a46f74](https://github.com/facebook/react-native/commit/6d04a46f7427b9e107608f8f620fe2a1a84ff42d)) +- Fixed bug parsing hermes call stacks when the file name is empty ([e539e7d0be](https://github.com/facebook/react-native/commit/e539e7d0bed4fef42f458f28d06100ae23f52cb7) by [@MartinSherburn](https://github.com/MartinSherburn)) +- Upgrade dependencies / version of eslint package ([463ec22bb9](https://github.com/facebook/react-native/commit/463ec22bb9f2938164fef6133dfd94d2e428e5b0) by [@mikehardy](https://github.com/mikehardy)) + +#### Android specific + +- Allow taps on views outside the bounds of a parent with `overflow: visible` ([e35a963bfb](https://github.com/facebook/react-native/commit/e35a963bfb93bbbdd92f4dd74d14e2ad6df5e14a) by [@hsource](https://github.com/hsource)) +- Fixed to use correct Android theme color for dark theme ([b3a715f6ea](https://github.com/facebook/react-native/commit/b3a715f6ea3d0faaf6d09e2a49267f2a5fb3fad2) by [@sidverma32](https://github.com/sidverma32)) +- Fixed dynamic behavior of `` on Android ([59021521e7](https://github.com/facebook/react-native/commit/59021521e7aba0f70b91b5c7778ccdd1b30eaae4)) +- Fix Dimensions not updating ([c18a492858](https://github.com/facebook/react-native/commit/c18a492858e94b31e632560ad17499012e688158) by [@jonnyandrew](https://github.com/jonnyandrew)) +- Fix dashed/dotted border-drawing when `borderRadius` is 0 ([3e5998e651](https://github.com/facebook/react-native/commit/3e5998e651eba840603dcb1a9c0be564fc3f868d) by [@IjzerenHein](https://github.com/IjzerenHein)) +- Fix selectionColor doesn't style Android TextInput selection handles ([5819538a08](https://github.com/facebook/react-native/commit/5819538a087f1f48d564e7b4e273fe43dfb026cc) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fix Modal being dismissed incorrectly when pressing escape on a hardware keyboard ([f51773ecde](https://github.com/facebook/react-native/commit/f51773ecdedbac19d25eb20894e532edef2cb304) by [@levibuzolic](https://github.com/levibuzolic)) +- Avoid calling setHint with a null parameter causing cursor to jump to the right ([3560753559](https://github.com/facebook/react-native/commit/356075355908f4901b87ad6ce33c157f01c8e748) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Create slider accessibility delegate in createViewInstance ([91cac20289](https://github.com/facebook/react-native/commit/91cac2028900cd18d17e70f9050cc125ed1eb12e) by [@janicduplessis](https://github.com/janicduplessis)) +- Quickfix individual border style dotted or dashed rendering as solid ([cb0e1d603a](https://github.com/facebook/react-native/commit/cb0e1d603aa4439a4d4804ad2987e4cb1f9bbf90) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Make `mHybridData` thread safe ([7929551623](https://github.com/facebook/react-native/commit/7929551623d4e3fbd849500d795755d0c41fdbbd)) +- Exit early from layout in textview if text layout is null ([8dfc3bcda1](https://github.com/facebook/react-native/commit/8dfc3bcda1e77fc982bc98da20dc129c23d8cc77) by [@ShikaSD](https://github.com/ShikaSD)) +- Fix `NullPointerException` caused by race condition in `ReactInstanceManager.getViewManagerNames` method ([fb386fccdd](https://github.com/facebook/react-native/commit/fb386fccddfe381fd6af5656c13fac802bffd316) by [@mdvacca](https://github.com/mdvacca)) +- Pressable ripple subsequent press coordinates. ([961b00d8c0](https://github.com/facebook/react-native/commit/961b00d8c0117750ce147c0b27c59af93f64b65c) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway)) +- TouchableNativeFeedback ripple starts on previous touch location. ([d85d72d0d9](https://github.com/facebook/react-native/commit/d85d72d0d9143693f73cef24c8e5bbb4d539a620) by [@intergalacticspacehighway](https://github.com/intergalacticspacehighway)) +- Fix Crash in `ViewProps.isLayoutOnly` ([e6b9508f12](https://github.com/facebook/react-native/commit/e6b9508f12ffd732d773ddcf9c2f633b0eca4232) by [@javache](https://github.com/javache)) +- Fixed a crash when updating `snapToOffsets` to a null value ([ba387b91d3](https://github.com/facebook/react-native/commit/ba387b91d3c7c9c1acd4b08f07fcd45629f3edfb) by [@maxoumime](https://github.com/maxoumime)) +- Adding `setAccessible` to `ReactImageManager` to allow screenreader announce Image accessibilityState of "disabled" ([333b46c4b0](https://github.com/facebook/react-native/commit/333b46c4b0ddee286e6d1d4b971fe8554a5c14cb) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fixed Android library builds with react.gradle file ([88f0676ae4](https://github.com/facebook/react-native/commit/88f0676ae49fd629331495101248c8e13423aed2) by [@Legion2](https://github.com/Legion2)) + +#### iOS specific + +- Fix deadlock on `RCTi18nUtil` ([fcead14b0e](https://github.com/facebook/react-native/commit/fcead14b0effe2176a5d08ad50ee71e48528ddbd) by [@Saadnajmi](https://github.com/Saadnajmi)) +- Avoid re-encoding images when uploading local files ([f78526ce3d](https://github.com/facebook/react-native/commit/f78526ce3d4004eb4bf8ca5178ca7e2c1c9abc1a) by [@arthuralee](https://github.com/arthuralee)) +- content is reset when emoji is entered at the max length ([f3b8d4976f](https://github.com/facebook/react-native/commit/f3b8d4976f8608c2cda1f071923f14b6d4538967)) +- Use `actionName` in accessibility event callback ([fed6ad5bad](https://github.com/facebook/react-native/commit/fed6ad5badb4196a1895370fc81c522572cb34b4) by [@ShikaSD](https://github.com/ShikaSD)) + +## v0.65.2 + +### Fixed + +- For Android, general fixes to Appearance API and also fixes AppCompatDelegate.setDefaultNightMode(). For iOS, now works correctly when setting window.overrideUserInterfaceStyle ([25a2c608f7](https://github.com/facebook/react-native/commit/25a2c608f790f42cbc4bb0a90fc06cc7bbbc9b95) by [@mrbrentkelly](https://github.com/mrbrentkelly)) + +## v0.65.1 + +### Changed + +- Set `react-test-renderer` to `17.0.2` in the template ([d272880](https://github.com/facebook/react-native/commit/d27288044e94a248982f596e9885d55d066bc72e) by [@@rickhanlonii](https://github.com/@rickhanlonii)) + +### Fixed + +- Resolve `NODE_BINARY` after finding the right path to node ([d75683](https://github.com/facebook/react-native/commit/d75683ac943205d64dd4142cca713ab2356094b8) by [@santiagofm](https://github.com/santiagofm)) + +#### Android specific + +- `ColorProps` with value null should be defaultColor instead of transparent ([842bcb902e](https://github.com/facebook/react-native/commit/842bcb902ed27928255b60cb20524e9318d9bf70) by [@hank121314](https://github.com/hank121314)) +- Android Gradle Plugin 7 compatibility ([06e31c748f](https://github.com/facebook/react-native/commit/06e31c748fe87a866dbaf4d0c2019e76ec00e309) by [@dulmandakh](https://github.com/dulmandakh)) + +## v0.65.0 + +### Highlights + +- Hermes 0.8.1. Please see the highlighted changes from its [0.8.0](https://github.com/facebook/hermes/releases/tag/v0.8.0) and [0.8.1](https://github.com/facebook/hermes/releases/tag/v0.8.1) release notes. +- `react-native-codegen` version `0.0.7` is now needed as a `devDependency` in the `package.json`. + +### Breaking Changes + +#### iOS specific + +- Replace `flipper_post_install` with `react_native_post_install` hook. Will automatically detect if Flipper is enabled. ([42dde12aac](https://github.com/facebook/react-native/commit/42dde12aac81208c4e69da991f4e08b9e62d18f6) by [@grabbou](https://github.com/grabbou)) + +### Added + +- Add `onPressIn` & `onPressOut` props to Text ([1d924549ca](https://github.com/facebook/react-native/commit/1d924549cad75912191005c8f68dd73e15b07183) by [@adrienharnay](https://github.com/adrienharnay)) +- Stabilize `RootTagContext`. And temporarily export both `unstable_RootTagContext` and `RootTagContext` ([9d489354ae](https://github.com/facebook/react-native/commit/9d489354ae373614b20cd91f588eb25743686ee0) by [@nadiia](https://github.com/nadiia)) +- Implement `sendAccessibilityEvent` in the React(Fabric/non-Fabric) renderer ([99b7052248](https://github.com/facebook/react-native/commit/99b7052248202cee172e0b80e7ee3dfb41316746) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Re-added `localeIdentifier` to `I18nManager` constants ([6b91ae73cd](https://github.com/facebook/react-native/commit/6b91ae73cdf096e15a3235ae76276f9d7fb12f7b) by [@acoates-ms](https://github.com/acoates-ms)) +- Add PressabilityPerformanceEventEmitter ([c4c0065b00](https://github.com/facebook/react-native/commit/c4c0065b0009ced0049c5abc4dddd327ac638928) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Added `displayName` to some RN contexts to make them more easy to differentiate when debugging. ([68a476103a](https://github.com/facebook/react-native/commit/68a476103a95be77f4fc7c582e52cc94946de1b4) by [@bvaughn](https://github.com/bvaughn)) +- Add `displayName` to `TouchableHighlight` and `TouchableOpacity` ([c4e40b81c0](https://github.com/facebook/react-native/commit/c4e40b81c01d061c189a7d28a4f56a588c3d1aea) by [@brunohkbx](https://github.com/brunohkbx)) +- Added context to URL's error messages when the feature is not implemented ([452240bafa](https://github.com/facebook/react-native/commit/452240bafa970578144aedaea0223e17863d2d26) by [@Crash--](https://github.com/Crash--)) +- Add a `stickyHeaderHiddenOnScroll` option to keep the sticky header hidden during scrolling down, and only slide in when scrolling up ([ffba25c648](https://github.com/facebook/react-native/commit/ffba25c648152021dd3fb9e79afd8cade7008d05)) +- Added `debugName` parameter to `renderApplication` to use as the display name for the React root tree ([eeb36f4709](https://github.com/facebook/react-native/commit/eeb36f470929c2fdd8e1ed69898a5ba9144b8715) by [@rubennorte](https://github.com/rubennorte)) +- Adding support for `cancelOnBackground` for UserFlow ([0d4985900b](https://github.com/facebook/react-native/commit/0d4985900b52d5def22fce4371c2259ee65368ee) by [@dmitry-voronkevich](https://github.com/dmitry-voronkevich)) +- Introducing RuntimeScheduler module ([eb13baf2a6](https://github.com/facebook/react-native/commit/eb13baf2a687b53dde04b9a336f18629d94f4b79) by [@sammy-SC](https://github.com/sammy-SC)) +- Roll out TurboModule Promise Async Dispatch ([5c4f145e33](https://github.com/facebook/react-native/commit/5c4f145e33d92969f8a86284360a5a2f09308500) by [@RSNara](https://github.com/RSNara)) + +#### Android specific + +- Add `getRecommendedTimeoutMillis` to AccessibilityInfo ([d29a7e7a89](https://github.com/facebook/react-native/commit/d29a7e7a89f4e5e3489e9723979426bb1b6f0674) by [@grgr-dkrk](https://github.com/grgr-dkrk)) +- TalkBack now announces "unselected" when changing `accessibilityState.selected` to false. ([73bc96ecf9](https://github.com/facebook/react-native/commit/73bc96ecf9a16d420533c12e9e1812ffe21c10a2) by [@yungsters](https://github.com/yungsters)) +- Fbjni version bump to 0.0.3 ([24f9f75bf6](https://github.com/facebook/react-native/commit/24f9f75bf66b8f32a117ba9f9dea3c65b35b1e00) by [@IvanKobzarev](https://github.com/IvanKobzarev)) +- Add `onFocus` and `onBlur` for Pressable on Android. ([cab4da7288](https://github.com/facebook/react-native/commit/cab4da728814bf9d3c0cc7c9921e982bfc090730)) +- Introduce API to allow applications to register `TurboModuleManagerDelegates` with `ReactInstanceManager` ([eb7e89e286](https://github.com/facebook/react-native/commit/eb7e89e2864e941b4a21d55a7403a6028e9a26a2) by [@RSNara](https://github.com/RSNara)) +- Added convenience methods to simplify native Event classes and ease migrations ([72d0ddc16f](https://github.com/facebook/react-native/commit/72d0ddc16f2f631003c3486e0a59e50c145ec613) by [@JoshuaGross](https://github.com/JoshuaGross)) + +#### iOS specific + +- High contrast dynamic color options for dark and light mode. ([4b9d9dda27](https://github.com/facebook/react-native/commit/4b9d9dda270acd4e0314f40490c699ffd0f6e30e) by [@birkir](https://github.com/birkir)) +- Adds an ability to retrieve the notifications authorization status from JavaScript side. ([b86e52a9ec](https://github.com/facebook/react-native/commit/b86e52a9ec9ec828388eb4a717a3782a54c7b3d9)) +- Added reset method to `RCTFabricSurface` to help with reloads ([53858ceaa3](https://github.com/facebook/react-native/commit/53858ceaa3beab02726b1bd6e125e506477d445e) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Allow `RCTRootView` to be initialized with a frame ([00bc09c8f7](https://github.com/facebook/react-native/commit/00bc09c8f76879eb1f9a92a6a643191da9355de8) by [@appden](https://github.com/appden)) +- Allow for configuring the `NSURLSessionConfiguration` ([58444c74f5](https://github.com/facebook/react-native/commit/58444c74f5c18b74e88a6c1cd0f059fe434c1a21) by [@hakonk](https://github.com/hakonk)) +- Use react-native-codegen in iOS app template ([e99b8bbb40](https://github.com/facebook/react-native/commit/e99b8bbb404f8cd1f11b6c7998083be530d7b8a4) by [@hramos](https://github.com/hramos)) + +### Changed + +- Bump Flipper + Bump hermes (#31872 by [@Titozzz](https://github.com/Titozzz)) +- Show warning when native module without `addListener` or `removeListeners` is passed to `NativeEventEmitter` ([114be1d217](https://github.com/facebook/react-native/commit/114be1d2170bae2d29da749c07b45acf931e51e2) by [@rubennorte](https://github.com/rubennorte)) +- Disable `accessibilityState` when the `TouchableWithoutFeedback` is `disabled`. ([697164077c](https://github.com/facebook/react-native/commit/697164077c362cfa9a384b0f4e246d6bd9c470ba) by [@carloscuesta](https://github.com/carloscuesta)) +- Upgraded `react-devtools-core dependency` to 4.12.0 ([5a2693d78f](https://github.com/facebook/react-native/commit/5a2693d78f1a886f0aa5b7f86830d3ddb54a57e9) by [@bvaughn](https://github.com/bvaughn)) +- Set disabled `accessibilityState` when `TouchableHighlight` is disabled ([f69e096bb4](https://github.com/facebook/react-native/commit/f69e096bb4df67474351786f674b1bb1e42d3363) by [@Naturalclar](https://github.com/Naturalclar)) +- Add checks and logs to for better error handling ([ea1f9531f0](https://github.com/facebook/react-native/commit/ea1f9531f00b5cd834e03f58cdfa117a93634624)) +- CreateAnimatedComponent: removed deprecated lifecycles usage ([ba61267015](https://github.com/facebook/react-native/commit/ba61267015567bf180dd3272a295dc262b3e2c97) by [@nadiia](https://github.com/nadiia)) +- Hide caret in the `TextInput` during test runs. ([397bfa6ad7](https://github.com/facebook/react-native/commit/397bfa6ad7dff71f4b6d27ac17acc76fe8a6bbb5) by [@nadiia](https://github.com/nadiia)) +- Use `usePressability` hook in TextInput ([c4aa411ee3](https://github.com/facebook/react-native/commit/c4aa411ee374f2320343b900f1f8b24a47b633c9) by [@nadiia](https://github.com/nadiia)) +- `Keyboard` no longer inherits from `NativeEventEmitter`, so it no longer implements `removeAllListeners`, and `removeSubscription`. ([1049835b50](https://github.com/facebook/react-native/commit/1049835b504cece42ee43ac5b554687891da1349) by [@yungsters](https://github.com/yungsters)) +- `AppState` no longer inherits from `NativeEventEmitter`, so it no longer implements `addListener`, `removeAllListeners`, and `removeSubscription`. ([6f22989e92](https://github.com/facebook/react-native/commit/6f22989e920246a2cd611b93e170024d89903027) by [@yungsters](https://github.com/yungsters)) +- `DevSettings` no longer inherits from `NativeEventEmitter` ([70cd569e7e](https://github.com/facebook/react-native/commit/70cd569e7e4cceac81023eae4ea5089cff2f9b59) by [@yungsters](https://github.com/yungsters)) +- LogBox will not initially collapse stack frames if every frame would be collapsed. ([88a41f180c](https://github.com/facebook/react-native/commit/88a41f180c315bc55e05d77ddc3fc671ad8630e6) by [@yungsters](https://github.com/yungsters)) +- Update package name warning of deprecated modules ([34e1b0ef98](https://github.com/facebook/react-native/commit/34e1b0ef981559adc09cd9f994bef9584f1c82b7) by [@Naturalclar](https://github.com/Naturalclar)) +- Update react-native-codegen to 0.0.7 ([cd6c9f3273](https://github.com/facebook/react-native/commit/cd6c9f3273fbe41052c4ec8512d3b1129daf149b) by [@Naturalclar](https://github.com/Naturalclar)) +- Update template devDependencies ([652e3953f4](https://github.com/facebook/react-native/commit/652e3953f48938580e1bf8ea1ba70105997e59d2) by [@Bardiamist](https://github.com/Bardiamist)) +- Don't minify JS bundle by default when using hermes ([1a67dda668](https://github.com/facebook/react-native/commit/1a67dda668c71d961a4bb3b0cdf6aa22c0e5c138) by [@janicduplessis](https://github.com/janicduplessis)) +- Migrate warnings in index.js to point to new lean core repos ([4421a64ac1](https://github.com/facebook/react-native/commit/4421a64ac1ea9df3827fb99194c8576a0750beab) by [@Naturalclar](https://github.com/Naturalclar)) +- Update Flipper to 0.93.0 ([06c33e9abe](https://github.com/facebook/react-native/commit/06c33e9abe6ed51b1c8bba03982ebce2b6da3860) by [@mweststrate](https://github.com/mweststrate)) +- Update Flipper to 0.91.1, fixed iOS build support for i386, `use_flipper!()` will no longer need custom overrides to build with XCode 12.5 ([4246c75d0d](https://github.com/facebook/react-native/commit/4246c75d0d5b9dccbe0fd5ecec66b4cc0331f815) by [@mweststrate](https://github.com/mweststrate)) +- Find node on m1 via homebrew node managers ([4d40b53c12](https://github.com/facebook/react-native/commit/4d40b53c12c8ad52760c63cacde417ee876bdfb1) by [@danilobuerger](https://github.com/danilobuerger)) +- Clean up EventObjectPropertyType ([0e46080847](https://github.com/facebook/react-native/commit/0e46080847595fb7577b18042c932db958bc0959) by [@RSNara](https://github.com/RSNara)) +- `Appearance.addChangeListener` now returns an `EventSubscription`. ([305b4253c2](https://github.com/facebook/react-native/commit/305b4253c2a9ed4d71be33e02cb12b6d570e2fb1) by [@yungsters](https://github.com/yungsters)) +- `Dimensions.addEventListener` now returns an `EventSubscription`. ([c47a03563d](https://github.com/facebook/react-native/commit/c47a03563db72d1580bf87b7729bd22ce6ca63dd) by [@yungsters](https://github.com/yungsters)) +- Updated react-native-community/cli to v6 (hence updating metro to 0.66) ([0d32aef3aa](https://github.com/facebook/react-native/commit/0d32aef3aa9a75b00d99503b8e4f502c52380dea) by [@Titozzz](https://github.com/Titozzz)) +- Reflect Hermes release version from HermesBadge ([c54aeccf1a](https://github.com/facebook/react-native/commit/c54aeccf1a8e16240e400d783dda5ec07fcf3808) by [@Huxpro](https://github.com/Huxpro)) + +#### Android specific + +- Modified `NativeEventEmitter` to also use the passed native module to report subscriptions on Android ([f5502fbda9](https://github.com/facebook/react-native/commit/f5502fbda9fe271ff6e1d0da773a3a8ee206a453) by [@rubennorte](https://github.com/rubennorte)) +- RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large' ([dd60414578](https://github.com/facebook/react-native/commit/dd604145781ac07c8db8d9100043bd76f6d6e913), [65975dd28d](https://github.com/facebook/react-native/commit/65975dd28de0a7b8b8c4eef6479bf7eee5fcfb93) by [@mdvacca](https://github.com/mdvacca)) +- TouchableNativeFeedback: sync disabled prop with accessibilityState ([88f2356eed](https://github.com/facebook/react-native/commit/88f2356eedf71183d02cde0826c8a0c6910f83dd) by [@kyamashiro](https://github.com/kyamashiro)) +- Rename `hasActiveCatalystInstance` to `hasActiveReactInstance` ([dfa8eb0558](https://github.com/facebook/react-native/commit/dfa8eb0558338f18ea01f294a64d355f6deeff06)) +- Record latest error type in dev support ([423453e105](https://github.com/facebook/react-native/commit/423453e1050c9aedda2df050a5ee6d40e7c82031)) +- Passing accessibility state in button so it can announce disabled in talkback ([5889cbebe3](https://github.com/facebook/react-native/commit/5889cbebe392dd19c6ce0cfd5fa1f725ece1060a) by [@huzaifaaak](https://github.com/huzaifaaak)) +- Fixed issue that causes HorizontalScrollView to shift to the right when a TextInput is selected and keyboard pops up ([b9b23e1ab1](https://github.com/facebook/react-native/commit/b9b23e1ab138189d2a4c22b13ba6ad8f8957579e) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Fixed jumpy RTL horizontal ScrollViews. If you have Android-specific JS hacks for handling RTL in ScrollViews, you probably can/probably want to remove them, because they should be reliable now and require fewer hacks. ([fc032cd8d8](https://github.com/facebook/react-native/commit/fc032cd8d889d828edad3ea4b735205092cf0d40) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Add a new check to avoid calling this method ([2b708560fc](https://github.com/facebook/react-native/commit/2b708560fc002c26f0b09f09cfa451827a3425ac)) +- Clipping subviews has been temporarily disabled in HorizontalScrollView in RTL mode. Minor/negligible perf impact. ([da8ed6b625](https://github.com/facebook/react-native/commit/da8ed6b6252fd53a83f14ab6da7e9b467f12ffe1) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Change StatusBar style handling strategy ([7324b92dc4](https://github.com/facebook/react-native/commit/7324b92dc45679d3b38526378b7d3e78ad082641)) +- Clean listeners during destroy of `ReactContext` ([d79212120b](https://github.com/facebook/react-native/commit/d79212120b7168015d3d0225ef372ed851a230fa) by [@mdvacca](https://github.com/mdvacca)) +- Bump buildToolsVersion to 30.0.2, ([5d01110b53](https://github.com/facebook/react-native/commit/5d01110b5370f884907b6dbdc56773f03518a54d) by [@dulmandakh](https://github.com/dulmandakh)) +- Initial replacement of jcenter with mavenCentral. ([704dd2812f](https://github.com/facebook/react-native/commit/704dd2812f7b8c79971274cc9e4c717e56847ac0) by [@ShikaSD](https://github.com/ShikaSD)) +- Remove developer tool guard for android ([c7d28bca30](https://github.com/facebook/react-native/commit/c7d28bca308c1654c576df9a0328a3116ed65d54)) +- Bump Android compileSdkVersion and targetSdkVersion from 29 to 30 ([55c8833817](https://github.com/facebook/react-native/commit/55c8833817c3e9cf9882a712c8b9946a262df231), [c7efd5b369](https://github.com/facebook/react-native/commit/c7efd5b369aa7605a1017791440735ab72bc9fa8) by [@mdvacca](https://github.com/mdvacca)) +- Upgrade jsc-android to 250230.2.1 ([341f061ce3](https://github.com/facebook/react-native/commit/341f061ce3ae057f3a958654e0ec3a9c4c8211ad) by [@Kudo](https://github.com/Kudo)) +- Bump Gradle to 6.9, Android Gradle Plugin to 4.2.1 ([547b4c92e4](https://github.com/facebook/react-native/commit/547b4c92e4743f5b5816297f48a608ace9de6bb5) by [@dulmandakh](https://github.com/dulmandakh)) +- Bump gradle wrapper to 6.8.3 ([7258afeea3](https://github.com/facebook/react-native/commit/7258afeea38949dc408c0af79924f6f36f7ade84) by [@dulmandakh](https://github.com/dulmandakh)) +- Bumping OkHttp from 4.9.0 to 4.9.1. ([6caec9d91f](https://github.com/facebook/react-native/commit/6caec9d91fe71bcd80d670218d752c4f251bde81) by [@gedeagas](https://github.com/gedeagas)) +- Bumping OkHttp from v3 to v4. ([8207e97f91](https://github.com/facebook/react-native/commit/8207e97f9174a04e319431193c0f63d47a093c44) by [@arazabishov](https://github.com/arazabishov)) +- Update Okhttp to version 3.14.19 ([6bfd89d277](https://github.com/facebook/react-native/commit/6bfd89d27724f2aac602fa2acbf4753950f4152e) by [@LukasFPV](https://github.com/LukasFPV)) +- Bump Fresco to 2.5.0 ([8fa8934011](https://github.com/facebook/react-native/commit/8fa8934011e4d9f1f7a49c8519fcc97f30a5c74b) by [@dulmandakh](https://github.com/dulmandakh)) +- Bump Fresco to 2.3.0 ([280f524b49](https://github.com/facebook/react-native/commit/280f524b491e7a36bb9f9a26e354bb8e125375ed) by [@dulmandakh](https://github.com/dulmandakh)) + +#### iOS specific + +- Give RCTNetworking handler provider block RCTModuleRegistry ([4c5182c1cc](https://github.com/facebook/react-native/commit/4c5182c1cc8bafb15490adf602c87cb5bf289ffd) by [@RSNara](https://github.com/RSNara)) +- Give RCTImageURLLoader's loader/decoder provider blocks RCTModuleRegistry ([af6bcfa3ab](https://github.com/facebook/react-native/commit/af6bcfa3ab0ef6e1b0f669dda6cd7d6a5e8975ba) by [@RSNara](https://github.com/RSNara)) +- Make RCTTurboModule `getTurboModule`: required ([e0b8f5080f](https://github.com/facebook/react-native/commit/e0b8f5080f814ba2a75807ed6d7f2944aab98d7e) by [@RSNara](https://github.com/RSNara)) +- Update React.podspec to require cocoapods >= 1.10.1 ([b50b7e3a19](https://github.com/facebook/react-native/commit/b50b7e3a191dfa95aa122c259e0df8699cbaccae) by [@sunnylqm](https://github.com/sunnylqm)) +- Fix glog pod install with Xcode 12 ([8a5fd8ea95](https://github.com/facebook/react-native/commit/8a5fd8ea95678a0b4423db2cbcbefc1a33595813) by [@dulmandakh](https://github.com/dulmandakh)) +- Only show Dev Menu on shake if RN view is visible ([7186c4de4f](https://github.com/facebook/react-native/commit/7186c4de4fc76e87fa1386f2839f178dd220a02b) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- `progressViewOffset` prop of `RefreshControl` and `VirtualizedList` now works on iOS ([310a6bcf4b](https://github.com/facebook/react-native/commit/310a6bcf4ba7ca162d3ba1c03e0ab07ff41f9ead) by [@davidbiedenbach](https://github.com/davidbiedenbach)) +- Roll out TurboModule block copy ([5275895af5](https://github.com/facebook/react-native/commit/5275895af5136bc278c0c5eb07ae93e395c5b29b) by [@RSNara](https://github.com/RSNara)) +- Add instructions to template/ios/Podfile for enabling hermes ([a326a30e32](https://github.com/facebook/react-native/commit/a326a30e322f6cdff880734aafe965b299febb8d) by [@SConaway](https://github.com/SConaway)) + +### Deprecated + +- `EventEmitter#removeSubscription` is now deprecated. ([cb6cbd12f8](https://github.com/facebook/react-native/commit/cb6cbd12f80152b4ce742f37e2e6eefadf89d927) by [@yungsters](https://github.com/yungsters)) +- It is now deprecated to pass a constructor argument to `EventEmitter(...)`. ([14f7a2b707](https://github.com/facebook/react-native/commit/14f7a2b70754c92804d746959d1ff091bf49af69) by [@yungsters](https://github.com/yungsters)) +- Deprecate `AccessibilityInfo.removeEventListener`. ([003d63d6e5](https://github.com/facebook/react-native/commit/003d63d6e501411f870ff5dbef819ad2aca20974) by [@yungsters](https://github.com/yungsters)) +- Deprecate `Linking.removeEventListener`. Instead, call `remove()` on the subscription returned by `Linking.addEventListener`. ([6d1aca806c](https://github.com/facebook/react-native/commit/6d1aca806cee86ad76de771ed3a1cc62982ebcd7), [035718ba97](https://github.com/facebook/react-native/commit/035718ba97bb44c68f2a4ccdd95e537e3d28690c) by [@yungsters](https://github.com/yungsters)) +- Old Native method to create ScrollEvent has been deprecated and will be removed at some point in the (distant) future ([62f0dee235](https://github.com/facebook/react-native/commit/62f0dee2353b14ce1524dc62de5e1d2f1883a089) by [@JoshuaGross](https://github.com/JoshuaGross)) + +#### Android specific + +- Deprecate `NativeModule.onCatalystInstanceDestroy()` for `NativeModule.invalidate()` ([18c8417290](https://github.com/facebook/react-native/commit/18c8417290823e67e211bde241ae9dde27b72f17) by [@RSNara](https://github.com/RSNara)) +- Mark `hasActiveCatalystInstance()` as Deprecated ([1b50722a7e](https://github.com/facebook/react-native/commit/1b50722a7e84cd8acffd3f0f84d77057e1e0d955)) + +### Removed + +- Stabilize `RootTagContext` ([9b98edcd01](https://github.com/facebook/react-native/commit/9b98edcd0155a4a8a1f71d19e565c485910a6137) by [@nadiia](https://github.com/nadiia)) +- Removed `getNode()` from animated component refs. ([b914153286](https://github.com/facebook/react-native/commit/b914153286ea537d4a57ff934e63e07172c576a0) by [@yungsters](https://github.com/yungsters)) +- Remove legacy context API usage in AppContainer ([17be3a0032](https://github.com/facebook/react-native/commit/17be3a0032c181a100efc7af17b7366a3d636c52) by [@nadiia](https://github.com/nadiia)) +- Removed `AccessibilityInfo.fetch`, use `isScreenReaderEnabled` instead. ([d831134d51](https://github.com/facebook/react-native/commit/d831134d514c5db6be1ee35cc7e9994b777179c1) by [@yungsters](https://github.com/yungsters)) +- Remove unused VR-only props ([95f7c791c5](https://github.com/facebook/react-native/commit/95f7c791c56b527dadbe0b4ec7a1be5af12d7afe) by [@Simek](https://github.com/Simek)) +- Removed `RCTDeviceEventEmitter.sharedSubscribers`. ([3af0c84aa5](https://github.com/facebook/react-native/commit/3af0c84aa5d1633f058ea3e7aef0d125fe33e01d) by [@yungsters](https://github.com/yungsters)) +- Moved `ScrollResponder.Mixin` methods into ScrollView to Remove ScrollResponder.js ([099f67cf8a](https://github.com/facebook/react-native/commit/099f67cf8aa290592092cfa0cb4e938d0543b696) by [@kacieb](https://github.com/kacieb)) +- `NativeEventEmitter` no longer inherits from `EventEmitter`, so it no longer implements `removeListener` and `removeSubscription`. Instead, use the `remove()` method on the subscription object returned by `addListener`. ([d39643b9de](https://github.com/facebook/react-native/commit/d39643b9de11c6b44984166ede34a7f44de76fe5) by [@yungsters](https://github.com/yungsters)) +- `RCTDeviceEventEmitter` no longer throws for `StatusBar`, `Keyboard`, and `AppState` events. However, you are still recommended to use the more appropriate modules for listening to these events. ([c8c975f0d7](https://github.com/facebook/react-native/commit/c8c975f0d7b8a57e9e90373a2be4d630ed9dd65e) by [@yungsters](https://github.com/yungsters)) +- Removed second optional argument of `NativeEventEmitter` constructor ([f5f47879b8](https://github.com/facebook/react-native/commit/f5f47879b8320a9934914cb8ce7a72269840a83a) by [@yungsters](https://github.com/yungsters)) +- Removed warning on Android for `setTimeout` with delays greater than 1 minute. ([480dabd665](https://github.com/facebook/react-native/commit/480dabd66547a60522249eda203a3eb1934b02e5) by [@yungsters](https://github.com/yungsters)) +- Removed `Touchable.TOUCH_TARGET_DEBUG` property. ([ef765d423c](https://github.com/facebook/react-native/commit/ef765d423cb188957a9fb2fd92c62b0efe8a36a6) by [@yungsters](https://github.com/yungsters)) + +#### Android specific + +- Remove okhttp3 proguard rules ([b4c9f13fe7](https://github.com/facebook/react-native/commit/b4c9f13fe794283d76766c1baef87888d174cb1c) by [@doniwinata0309](https://github.com/doniwinata0309)) +- Remove filter pills ([5cf4ab8dd2](https://github.com/facebook/react-native/commit/5cf4ab8dd28b5a336d7af29d295ede51f0d19587) by [@suminkimm](https://github.com/suminkimm)) +- Remove `ReactFragmentActivity` class. ([2798e7172b](https://github.com/facebook/react-native/commit/2798e7172b01b9e2dbe2937d0163f98ab29230cf) by [@dulmandakh](https://github.com/dulmandakh)) +- Remove jcenter ([70da640946](https://github.com/facebook/react-native/commit/70da64094608f5f2e3c554ed719e9aad624e3459) by [@dulmandakh](https://github.com/dulmandakh)) + +#### iOS specific + +- Removed event methods except `addListener` from `Networking` ([a81b7d18fa](https://github.com/facebook/react-native/commit/a81b7d18fa65a727539c6c7ea17f787673d3c889) by [@yungsters](https://github.com/yungsters)) +- Delete deprecated "live reloading" setting ([b512beb0c4](https://github.com/facebook/react-native/commit/b512beb0c497158f9c861fcc16af960655b1feb5) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Remove iOS10/tvOS10 support ([f2c6279ca4](https://github.com/facebook/react-native/commit/f2c6279ca497b34d5a2bfbb6f2d33dc7a7bea02a), [a1d626739d](https://github.com/facebook/react-native/commit/a1d626739d95d6cbbb1be169b93952cdd1465486) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Remove iOS10/tvOS10 support from remaining podfiles ([f0faa7843c](https://github.com/facebook/react-native/commit/f0faa7843c5a0e9041edb6e77fd6631335ab2b12) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Delete RCTTurboModuleManagerDelegate `getTurboModule:initParams` ([c4c34a1237](https://github.com/facebook/react-native/commit/c4c34a1237ec584c667c62358dc577174bf11033) by [@RSNara](https://github.com/RSNara)) + +### Fixed + +- Don't disconnect DevTools WebSocket connection on Cmd+D ([60a18c138c](https://github.com/facebook/react-native/commit/60a18c138c51d3adcfeba7785315fc222cdfeb35) by [@bvaughn](https://github.com/bvaughn)) +- For native components that accept color arrays, invalid elements will now fallback to transparent with a console error. ([bb6cd56fae](https://github.com/facebook/react-native/commit/bb6cd56fae4118f44ae47fd6978710a22f9e1510) by [@yungsters](https://github.com/yungsters)) +- Fixes usage of std::thread in runtime executor ([75d9ba733f](https://github.com/facebook/react-native/commit/75d9ba733f4a041e4320098b52903f69747df02b) by [@asklar](https://github.com/asklar)) +- Fix sticky header not sticking on first render in ScrollView ([921c9ff165](https://github.com/facebook/react-native/commit/921c9ff165d47a73e9978df918b1761b95f9979d) by [@kacieb](https://github.com/kacieb)) +- Fix ScrollView `getInnerViewNode` and `getInnerViewRef` ref methods ([6e36d046a3](https://github.com/facebook/react-native/commit/6e36d046a313c7961cc2f91e0422f4bf29005eb6) by [@vshab](https://github.com/vshab)) +- Fix stalling UI due to a bug in KeyboardAvoidingView ([67309277fe](https://github.com/facebook/react-native/commit/67309277fe588c4dd64fe0c680d1d00d2f3fb2b6) by [@sammy-SC](https://github.com/sammy-SC)) +- Avoid eating clicks/taps into ScrollView when using physical keyboard ([6d2a527984](https://github.com/facebook/react-native/commit/6d2a5279841886a9a14f82057202bf8950c3f917) by [@NickGerleman](https://github.com/NickGerleman)) +- Fix nested FlatList not firing `onScrollDragEnd` and `onMomentum` methods ([46be292f67](https://github.com/facebook/react-native/commit/46be292f671c70aac4ecc178c96e3a2a6a3d16da) by [@kacieb](https://github.com/kacieb)) +- Fix race condition in Debug Inspector shutdown ([d021000b9e](https://github.com/facebook/react-native/commit/d021000b9e358a9379ca5d6208f24757c0c8ce97) by [@MartinSherburn](https://github.com/MartinSherburn)) +- Fixes layout of nodes with `YGDisplayNone` and `YGPositionTypeAbsolute` ([b15f8a30e7](https://github.com/facebook/react-native/commit/b15f8a30e75b54a8de5cc9456aaa07ebe8d8a176) by [@rozele](https://github.com/rozele)) +- Fix changes of View visibilities ([4076293aa1](https://github.com/facebook/react-native/commit/4076293aa1059005704576530d8fe948b85e6a6d) by [@mdvacca](https://github.com/mdvacca)) +- Fix: save connection url as class variable ([8facc865ab](https://github.com/facebook/react-native/commit/8facc865ab2ec032da34f6f755ee8870ee4741aa) by [@sirpy](https://github.com/sirpy)) +- Fix Hermes build on folly version 2021.04.26.00 ([8eceee744e](https://github.com/facebook/react-native/commit/8eceee744ed9fee1eb2402f6b13bb606f6046f62) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix disabled handling for Text ([33ff4445dc](https://github.com/facebook/react-native/commit/33ff4445dcf858cd5e6ba899163fd2a76774b641) by [@lunaleaps](https://github.com/lunaleaps)) +- Fix disabled prop not disabling onPress for voice assistant ([1c7d9c8046](https://github.com/facebook/react-native/commit/1c7d9c8046099eab8db4a460bedc0b2c07ed06df) by [@kacieb](https://github.com/kacieb)) +- Fix unsafe cast and detect overflow in MapBuffer. ([e69f1c9f50](https://github.com/facebook/react-native/commit/e69f1c9f50c64bfcaeb684d763f02b9ccadec960)) +- Fix(deps): bump metro to 0.66.2 + dedup ([e40f58272d](https://github.com/facebook/react-native/commit/e40f58272d51a40e7b5fa77c14767ddaf9ecc006) by [@Titozzz](https://github.com/Titozzz)) + +#### Android specific + +- Fixed crash when using style `borderRadius: any` with `backgroundColor: null` ([42b6e6682c](https://github.com/facebook/react-native/commit/42b6e6682ce0fa9ac6eb5c1bf8ef0c224d2d80c0)) +- Fix font weight numeric values ([3827ca6171](https://github.com/facebook/react-native/commit/3827ca61714b699c866e17d58b4697dde86e3d00) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fix wrong ripple color on Switch component ([1b0683533a](https://github.com/facebook/react-native/commit/1b0683533a07aa8875b4d494d8c2a3d18ef69438) by [@rnike](https://github.com/rnike)) +- Fix Selected State does not announce when TextInput Component selected on Android ([7ee2acc6c8](https://github.com/facebook/react-native/commit/7ee2acc6c84c9ea6a51908495a6f14a26f346b29) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fix layout bug in ReactTextView. ([dec1b6ba15](https://github.com/facebook/react-native/commit/dec1b6ba15df8f255d30b696a7c08ef543d1d19c)) +- Fix source build on Windows machines vol. 2 ([c37d49492b](https://github.com/facebook/react-native/commit/c37d49492b20c3815ca10133f971755f659b1b6a)) +- Make NativeModules immediately initializable ([2bf866e401](https://github.com/facebook/react-native/commit/2bf866e4018ea72c1f1c92c806db85378c801fb7) by [@RSNara](https://github.com/RSNara)) +- Restore `android_hyphenationFrequency` on `Text`. ([1433ed6333](https://github.com/facebook/react-native/commit/1433ed6333162189730d6f92cf80f3077ac69120) by [@yungsters](https://github.com/yungsters)) +- Display the `testID` as the `resource-id` for black-box testing frameworks ([381fb395ad](https://github.com/facebook/react-native/commit/381fb395ad9d2d48717a5d082aaedbecdd804554) by [@jdeff](https://github.com/jdeff)) +- Fix support for blobs larger than 64 KB ([f00e348ca7](https://github.com/facebook/react-native/commit/f00e348ca7f031c3577b1335a3163bc3e4eb4b41) by [@tomekzaw](https://github.com/tomekzaw)) +- Fix building React Android on Windows. ([5dc15222b2](https://github.com/facebook/react-native/commit/5dc15222b256e32517df553c5fe7f6f5b7d0d31f)) +- Fix race-condition on the initialization of ReactRootViews ([74a756846f](https://github.com/facebook/react-native/commit/74a756846fdab1ef7d183c4df3069a23fcd0d49e) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific + +- Animated images without loop no longer animate twice ([17aa1e320e](https://github.com/facebook/react-native/commit/17aa1e320e75393d46a54ec0fee8b068eeef142f) by [@comvenger-brandon](https://github.com/comvenger-brandon)) +- Allow PlatformColor to work with border colors ([c974cbff04](https://github.com/facebook/react-native/commit/c974cbff04a8d90ac0f856dbada3fc5a75c75b49) by [@danilobuerger](https://github.com/danilobuerger)) +- RCTSurfaceHostingView default background color is now consistent with RCTRootView ([f31497354b](https://github.com/facebook/react-native/commit/f31497354b72ad51b452a4b8bd3b70de16830025) by [@fkgozali](https://github.com/fkgozali)) +- Invalidate TurboModules with infra-generated method queues on their method queues ([497eb578ab](https://github.com/facebook/react-native/commit/497eb578ab32614744a4ef61d7a6bca0d4251885) by [@RSNara](https://github.com/RSNara)) +- Fix RefreshControl layout when removed from window ([e67811e7a6](https://github.com/facebook/react-native/commit/e67811e7a6df0937ed61d3367ab10fab95b31bfa) by [@janicduplessis](https://github.com/janicduplessis)) +- Tab Accessibility Role had incorrect localization string ([80a10953f9](https://github.com/facebook/react-native/commit/80a10953f9de8cc251e9b8c1e59a173af87febb9) by [@adkenyon](https://github.com/adkenyon)) +- Incorrect ScrollView offset on update ([a4526bcc3f](https://github.com/facebook/react-native/commit/a4526bcc3f89f5b9d3f86c814ade8f55c86e819e) by [@rnike](https://github.com/rnike)) +- Modal's `onDismiss` prop will now be called successfully. ([d85d5d2e19](https://github.com/facebook/react-native/commit/d85d5d2e1974b463318e4c86da29a5ccdd60a977) by [@kkoudev](https://github.com/kkoudev)) +- Fix DatePicker sizing issue ([84d55868e8](https://github.com/facebook/react-native/commit/84d55868e8b4e5a555d324c6162b8e38571524d8) by [@sammy-SC](https://github.com/sammy-SC)) +- First press not working after pull to refresh ([c4950610e4](https://github.com/facebook/react-native/commit/c4950610e40f2019c828bc99e29769cd4089c217) by [@rnike](https://github.com/rnike)) +- Fix Codegen silently failing when Yarn is not installed, or when Yarn v2 is active. ([07e4953514](https://github.com/facebook/react-native/commit/07e4953514636aaadc5915944cc64c12028516f2) by [@ivanmoskalev](https://github.com/ivanmoskalev)) +- Make codegen more reliable on iOS ([12fccdeea3](https://github.com/facebook/react-native/commit/12fccdeea33324b8ddaa3ac0e2dbf81a44ca1eb2) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix crash in RCTCoreModulesClassProvider during quit ([2f62c2892d](https://github.com/facebook/react-native/commit/2f62c2892d9979f80752350d1b949f2770511956) by [@appden](https://github.com/appden)) +- Fix an issue calling stopSurface in bridgeless mode before surface is started ([81096901a8](https://github.com/facebook/react-native/commit/81096901a8a6da75744cef7b663ccea2ff9c4c09)) +- Move hermes to a separate podspec ([0959ff36d1](https://github.com/facebook/react-native/commit/0959ff36d1f3264e117021eb1999d0bdb71377c3) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix cli bundle platform for Mac Catalyst in `react-native-xcode.sh` ([b496a531e0](https://github.com/facebook/react-native/commit/b496a531e0b4b5d828077b0e7dff43dd28fed5eb) by [@robertying](https://github.com/robertying)) +- Fix `prefetchImageWithMetadata` redbox([f27e305056](https://github.com/facebook/react-native/commit/f27e305056152ff9ad7aeb9018bf289d51719eb9) by [@p-sun](https://github.com/p-sun)) +- Roll out RCTNetworking extraneous NativeModule call removal ([0e0d2e84f5](https://github.com/facebook/react-native/commit/0e0d2e84f56ea233e72d980ff6bd9797df250553) by [@RSNara](https://github.com/RSNara)) +- Fix Hermes + no Flipper build on Xcode 12.5 ([b9243e00e3](https://github.com/facebook/react-native/commit/b9243e00e30be057a45af6ed1916af4328c458e4) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix(hermes): fixed hermes build on iOS ([59abb5f378](https://github.com/facebook/react-native/commit/59abb5f378e116288cdea2f619de0c128bb0b0eb) by [@Titozzz](https://github.com/Titozzz)) +- Fix builds on Xcode 12.5 ([36b58a824e](https://github.com/facebook/react-native/commit/36b58a824ea20daa22fe7c528a3bf0ff4e6a4cb5) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix running React Native project with Xcode 12 in Release on iPhone Simulator ([fdcacd7f76](https://github.com/facebook/react-native/commit/fdcacd7f76ea8ca6dafda32ac431c8adc7bdad00) by [@grabbou](https://github.com/grabbou)) + +## v0.64.3 + +### Fixed + +- For Android, general fixes to Appearance API and also fixes AppCompatDelegate.setDefaultNightMode(). For iOS, now works correctly when setting window.overrideUserInterfaceStyle ([25a2c608f7](https://github.com/facebook/react-native/commit/25a2c608f790f42cbc4bb0a90fc06cc7bbbc9b95) by [@mrbrentkelly](https://github.com/mrbrentkelly)) + +## v0.64.2 + +### Changed + +- Find-node.sh supports Homebrew on M1 ([502b819049](https://github.com/facebook/react-native/commit/502b81904998b800f2d960bb4a8e244988c72958) by [@dulmandakh](https://github.com/dulmandakh)) +- Refactor UIManagerHelper.getUIManager to return null when there's no UIManager registered ([b0e8c1eac0](https://github.com/facebook/react-native/commit/b0e8c1eac0a9edda12ecfa264209a8b3222afe27) by [@mdvacca](https://github.com/mdvacca)) + +### Fixed + +- Fix ScrollViewStickyHeader to push up header above it ([d754bdefc6](https://github.com/facebook/react-native/commit/d754bdefc68ff757ac2b5a2ffa38d5aad234d484) by [@kacieb](https://github.com/kacieb)) + +#### Android specific + +- Font family is not apply when secureTextEntry is true ([cda77c77dd83cba07e6c2e56e938c3e4f7faf8fc](https://github.com/facebook/react-native/commit/cda77c77dd83cba07e6c2e56e938c3e4f7faf8fc) by [@hank121314](https://github.com/hank121314)) +- Dimension update events are now properly sent following orientation change ([a6a4d3365f17332e367c34357a07a73f97d6ec83](https://github.com/facebook/react-native/commit/a6a4d3365f17332e367c34357a07a73f97d6ec83) by [@ajpaulingalls](https://github.com/ajpaulingalls)) + +## v0.64.1 + +### Fixed + +#### iOS specific + +- Fixes to ensure Xcode 12.5 builds ([cf8a364767](https://github.com/facebook/react-native/commit/cf8a364767df830d7255339741350bb53ab1a68a), [1c4ac48a55](https://github.com/facebook/react-native/commit/1c4ac48a55cf0703f0c8a32cbb07474a2d126f3e) and [76f45d35e7](https://github.com/facebook/react-native/commit/76f45d35e710f84a1cc44c90bc128494bc4280ce) by [@kelset](https://github.com/kelset)) + +### Security + +- Update validateBaseUrl to use latest regex ([33ef82ce6d](https://github.com/facebook/react-native/commit/33ef82ce6dfd31e1f990d438c925a0e52723e16b) by [@FBNeal](https://github.com/FBNeal)) + +## v0.64.0 + +### Breaking + +- Enable `inlineRequires` by default in new projects' `metro.config.js`. Gives a performance benefit but slightly different JS execution order ([959365a902](https://github.com/facebook/react-native/commit/959365a90216ee14d0f8b5d2f4653a1ab4c10d7e) by [@GantMan](https://github.com/GantMan)) +- Minimum supported Node version changed to 12 ([4b92e2e53d](https://github.com/facebook/react-native/commit/4b92e2e53d9c79f5b5858b3eb0d1654da79a4a68) by [@safaiyeh](https://github.com/safaiyeh)) +- Remove deprecated `CameraRoll` API (deprecated in 0.61) ([824d3a9770](https://github.com/facebook/react-native/commit/824d3a977057b336d81237ec3cec3a49a9d5e34d) by [@seanyusa](https://github.com/seanyusa)) +- Remove deprecated `CheckBox` component (deprecated in 0.60) ([dff17effe5](https://github.com/facebook/react-native/commit/dff17effe54dc58dda19fcc81ebacbd8f46e9005) by [@poteto](https://github.com/poteto)) +- Removed `DEPRECATED_sendUpdatedChildFrames` prop from `ScrollView` component (deprecated in 0.47) ([345d0c1abb](https://github.com/facebook/react-native/commit/345d0c1abb1afe937a06982c4328caee57820832) by [@ZHUANGPP](https://github.com/ZHUANGPP)) +- On `Image`, `onLoad` event objects' `source.url` is now renamed to `source.uri`. ([74ab8f6e5a](https://github.com/facebook/react-native/commit/74ab8f6e5a61999f1132351ff52df43c91360a09) by [@yungsters](https://github.com/yungsters)) + +#### Android specific + +- Remove support of Android API levels 16 through 20. The new minSDK version will be 21+ moving forward. ([973198667d](https://github.com/facebook/react-native/commit/973198667d7bbbf3b5d8890fc0a53dc99d0bce18), [25a40cbc61](https://github.com/facebook/react-native/commit/25a40cbc61e6c718d8cdea6d67fd82c6309963b1), [f829722b54](https://github.com/facebook/react-native/commit/f829722b54b34f145c41a95edfa5b522c837f9fc), [b133427778](https://github.com/facebook/react-native/commit/b13342777856bc4024d8489de790e7f90cd6b33b), [9b34aa261c](https://github.com/facebook/react-native/commit/9b34aa261c272d96829c9a7d5b166594b3162f9d), and [79d0a7d711](https://github.com/facebook/react-native/commit/79d0a7d71119122d2a2b9954e6038bbee119b8fa) by [@mdvacca](https://github.com/mdvacca); [49f10fd2e5](https://github.com/facebook/react-native/commit/49f10fd2e526b64294777357ab2fef8880739f26) and [a17ff44adc](https://github.com/facebook/react-native/commit/a17ff44adcf003dd4e4ef2301e1f80b77913f712) by [@JoshuaGross](https://github.com/JoshuaGross); [dd4298a377](https://github.com/facebook/react-native/commit/dd4298a3770eee7f66846ef0cc4c41a628b7bf01) by [@safaiyeh](https://github.com/safaiyeh)) +- Fix ReadableArray null annotations. Possibly breaking change for Kotlin apps. ([d76556543f](https://github.com/facebook/react-native/commit/d76556543f96f4d739be3a708b8f6314bb32cc87) by [@dulmandakh](https://github.com/dulmandakh)) +- On `Image`, `onLoad` and `onError` event objects will no longer have an extra `uri` property. ([74ab8f6e5a](https://github.com/facebook/react-native/commit/74ab8f6e5a61999f1132351ff52df43c91360a09) by [@yungsters](https://github.com/yungsters)) +- Deletes the method PlayTouchSound method from UIManagerModule, this method was moved to the SoundManagerModule class. ([d0c4c5eaf9](https://github.com/facebook/react-native/commit/d0c4c5eaf90430c7004621d1596c5f2a55ad03e0) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific + +- Remove `calculateChildFrames` from `RCTScrollView` ([62aa84a325](https://github.com/facebook/react-native/commit/62aa84a3257bd3c513df3fcb4b4eaa350ecf77bb) by [@PeteTheHeat](https://github.com/PeteTheHeat)) + +### Deprecated + +#### Android specific + +- Deprecated method `UIManagerModule.getUIImplementation`. This method will not be part of the new architecture of React Native. ([fe79abb32c](https://github.com/facebook/react-native/commit/fe79abb32ca3425ff689b7641d9200461ea8166d) by [@mdvacca](https://github.com/mdvacca)) + +### Added + +- Adds the Hermes runtime bytecode version number to the JS bundle requestURL. This allows Metro with Bytecode to work with prebuilt binaries. ([34c405462f](https://github.com/facebook/react-native/commit/34c405462f890afbccdfeaa7804791f7e9bcaa83)) +- TextInput now supports `onPressIn` and `onPressOut`. ([b7b0e23202](https://github.com/facebook/react-native/commit/b7b0e232028723794af4c79fc6366c483ae2350b) by [@yungsters](https://github.com/yungsters)) +- Allow setting a custom performance logger in XMLHttpRequest ([57b10f759e](https://github.com/facebook/react-native/commit/57b10f759efed786b46cfe082367f929aa2925d3) by [@rubennorte](https://github.com/rubennorte)) +- Add mock for `DevSettings` to jest preset ([a50f736bb6](https://github.com/facebook/react-native/commit/a50f736bb6ade9ea9caae45e41ca4b92f6707b17) by [@MarcoScabbiolo](https://github.com/MarcoScabbiolo)) +- Added Inspector overlay support for Pressable ([8ac467c51b](https://github.com/facebook/react-native/commit/8ac467c51b94c82d81930b4802b2978c85539925) by [@yungsters](https://github.com/yungsters)) +- Introduce NativeModulePerfLogger ([0486640571](https://github.com/facebook/react-native/commit/0486640571c89a0ce067c0437655a6b375308bcd) by [@RSNara](https://github.com/RSNara)) +- Add default `titlePlaceholder` in template configuration. ([8ffa180d80](https://github.com/facebook/react-native/commit/8ffa180d80b9c9acb76a0631b5a709d2c0adcd86) by [@Esemesek](https://github.com/Esemesek)) +- Modified `renderApplication` to forward `initialProps` to `WrapperComponent` ([4f5a092bf6](https://github.com/facebook/react-native/commit/4f5a092bf68a0cd825328ce4a1e6bb41a8fad2e3) by [@rubennorte](https://github.com/rubennorte)) +- Add warning to `VirtualizedList` when incorrectly using nested Lists or custom scroll components ([7f2515ece8](https://github.com/facebook/react-native/commit/7f2515ece8833f7a8adba025ef544013f89ae26f) by [@kacieb](https://github.com/kacieb)) +- Add native module for loading split JS bundles in development ([fca3a39da5](https://github.com/facebook/react-native/commit/fca3a39da5f1c31514e8969738e7b2c2d22bc230) by [@makovkastar](https://github.com/makovkastar)) +- Added `listenerCount()` to `DeviceEventEmitter` and `NativeEventEmitter`. ([b11d6ecbb8](https://github.com/facebook/react-native/commit/b11d6ecbb8bb2f0d6f423be6775e587f4e9b1c4d) by [@yungsters](https://github.com/yungsters)) + +#### Android specific + +- Upgrade Hermes to version 0.7 and turn on ES6 Proxy support ([776a415d98](https://github.com/facebook/react-native/commit/776a415d98dffd04b11200812a32204aa1c5e157) and [bb003816a3](https://github.com/facebook/react-native/commit/bb003816a389b8655c53fa34444417c14516459c) by [@Huxpro](https://github.com/Huxpro), [a28dd38909](https://github.com/facebook/react-native/commit/a28dd3890974d699070f08ab43781324411e6f5c) by [@janicduplessis](https://github.com/janicduplessis)) +- Add support for `shadowColor` on API level >= 28 ([cfa4260598](https://github.com/facebook/react-native/commit/cfa42605989eee5a9de42bdb1259fb7f4d9451fb) by [@IjzerenHein](https://github.com/IjzerenHein)) +- Add `android_hyphenationFrequency` prop to Text component ([0fda91ffff](https://github.com/facebook/react-native/commit/0fda91ffffa4972ebe58e3d0b610692a1286eaa1) and [7d8aeb4955](https://github.com/facebook/react-native/commit/7d8aeb4955a4101ca7e8e486f935309c21ab76ff) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Add `accessibilityHint` to TouchableNativeFeedback ([72285d808d](https://github.com/facebook/react-native/commit/72285d808dfce748287a19e2620d58517a5f76e7) by [@CMDadabo](https://github.com/CMDadabo)) +- Adds support for the `onProgress` event on `Image` ([fa0e6f8051](https://github.com/facebook/react-native/commit/fa0e6f8051d2208af467b789a2a9306ec7ddad76) by [@yungsters](https://github.com/yungsters)) +- ScrollView now supports `contentOffset` ([ed29ba13f9](https://github.com/facebook/react-native/commit/ed29ba13f97f240c91fdf6c0ef3fb601046697b9) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Add an explicit NDK version to Android template ([18ffe12203](https://github.com/facebook/react-native/commit/18ffe12203d03b4e960d61d7bb50cd02bba94663) by [@safaiyeh](https://github.com/safaiyeh)) +- Exposed `getFlex` method as part of ReactShadowNode API ([6570f7887b](https://github.com/facebook/react-native/commit/6570f7887b8824705ae09b5653d631428e17bc5f) by [@mdvacca](https://github.com/mdvacca)) +- Add `\*.hprof` files to gitignore ([69ce9c21d4](https://github.com/facebook/react-native/commit/69ce9c21d433a23ffb9934062b46fa64277ee255) by [@enesozturk](https://github.com/enesozturk)) +- Move `DevSettingsActivity` from main to debug ([d8e6c45782](https://github.com/facebook/react-native/commit/d8e6c45782a5c9132bb7ec315fe0b9ba3999e830) by [@invalid-email-address](https://github.com/invalid-email-address)) + +#### iOS specific + +- `PlatformColor`: add missing `clearColor` ([b7167c23fc](https://github.com/facebook/react-native/commit/b7167c23fc052f8d9f8c27a7f4ad9c5cdf51281e) by [@Simek](https://github.com/Simek)) +- Update template to Xcode 12 ([6685aba462](https://github.com/facebook/react-native/commit/6685aba462699c696cb6ac95626b9592deb292fc) by [@janicduplessis](https://github.com/janicduplessis)) +- Add `importantForAccessibility` to `AccessibilityProps` ([fd660fd0c5](https://github.com/facebook/react-native/commit/fd660fd0c50a0acca730bd1ecd427e574bbe81c7) by [@ZHUANGPP](https://github.com/ZHUANGPP)) +- Allow hotkeys to be used without command key ([f2b9ec7981](https://github.com/facebook/react-native/commit/f2b9ec798172db76dfb55f390e1fcea90dd341da) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Add `disableButtonsIndices` option to `ActionSheetIOS` component ([a7c1c5aff2](https://github.com/facebook/react-native/commit/a7c1c5aff24671bba609caeb82092a8de3d3b232) by [@lukewalczak](https://github.com/lukewalczak)) +- Add `showSoftInputOnFocus` to `TextInput` ([d54113d8c4](https://github.com/facebook/react-native/commit/d54113d8c4bcd0e0c7a09acca60819724eb69926) by [@gurs1kh](https://github.com/gurs1kh)) +- Added hostname to loading banner. ([96999339b6](https://github.com/facebook/react-native/commit/96999339b6a7aeabd0cd706ef7736fd91d9ecf80) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Allow iOS `PlatformColor` strings to be ObjC or Swift UIColor selectors ([25793eab56](https://github.com/facebook/react-native/commit/25793eab56217a9961620761ea65ec2fcb97dcb0) by [@tom-un](https://github.com/tom-un)) +- Add Dark Mode support to loading banner ([94c45af136](https://github.com/facebook/react-native/commit/94c45af136f44245b5f2e56bded60c8ebd9b1235) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Allow image loaders to enable/disable image telemetry ([e37708dfb6](https://github.com/facebook/react-native/commit/e37708dfb605dd9ee9f4b2dac5d841d98b7d376c) by [@p-sun](https://github.com/p-sun)) +- Add `RCTDevSplitBundleLoader` native module ([ad879e50bc](https://github.com/facebook/react-native/commit/ad879e50bcd51caca76b1073720f2b63df485ff1) by [@cpojer](https://github.com/cpojer)) + +### Changed + +- Update flipper to 0.75.1 ([3399896ae7](https://github.com/facebook/react-native/commit/3399896ae756719b238e837001077a46508849be) by [@janicduplessis](https://github.com/janicduplessis)) +- Refined Flow type for `Text` component. ([a911efaecd](https://github.com/facebook/react-native/commit/a911efaecd005237816ddb480218eb5388460d16) by [@yungsters](https://github.com/yungsters)) +- Changed type definition of IPerformanceLogger from object to interface ([b90f4d978f](https://github.com/facebook/react-native/commit/b90f4d978fa27e37926d9f4a1d13c9168243798c) by [@rubennorte](https://github.com/rubennorte)) +- Removed `fbjs` dependency from `react-native`. ([54e19a6b7f](https://github.com/facebook/react-native/commit/54e19a6b7f217ffc0611e660f2a6b1a8ad14775b) by [@yungsters](https://github.com/yungsters)) +- Refined `ImageSource` Flow type for array-variant and headers. ([a0dc252dc8](https://github.com/facebook/react-native/commit/a0dc252dc89699f7bd0d733642b98762d0db423a) by [@yungsters](https://github.com/yungsters)) +- Some warnings changed to use `console.warn` without the "Warning:" prefix. ([982272932c](https://github.com/facebook/react-native/commit/982272932cee3be599076bd18b290bc812285533) by [@yungsters](https://github.com/yungsters)) +- Core/Differ: detect and optimize reparenting ([1e4d8d902d](https://github.com/facebook/react-native/commit/1e4d8d902daca8e524ba67fc3c1f4b77698c4d08) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Improve "not a registered callable module" error message ([e27d656ef3](https://github.com/facebook/react-native/commit/e27d656ef370958c864b052123ec05579ac9fc01) by [@vonovak](https://github.com/vonovak)) +- Use `VirtualizedList`'s `onEndReachedThreshold` default value when null is provided ([10b4b9505a](https://github.com/facebook/react-native/commit/10b4b9505a51f8bf3fbc12d296a087b784a9201a) by [@fatalsun](https://github.com/fatalsun)) +- Migrate large amount of modules to flow strict and strict-local ([4409642811](https://github.com/facebook/react-native/commit/4409642811c787052e0baeb92e2679a96002c1e3) by [@rubennorte](https://github.com/rubennorte)) +- Enable exact objects by default in the project template Flow config ([050a7dd019](https://github.com/facebook/react-native/commit/050a7dd019be435b848de0a86030599d83f8791d) by [@rubennorte](https://github.com/rubennorte)) +- Minor fix in Hermes Inspector cli tool help message ([6ffb983f83](https://github.com/facebook/react-native/commit/6ffb983f83afdee5d9290c683c5060d2a959818d)) +- Updated the React Hooks ESLint Plugin in the community ESLint config ([ac87e90fa5](https://github.com/facebook/react-native/commit/ac87e90fa517676440c1adf9575cb48f90de8069) by [@gaearon](https://github.com/gaearon)) +- Don't scroll to `initialScrollIndex` if `contentOffset` is provided to the same `VirtualizedList` ([3346ac7f96](https://github.com/facebook/react-native/commit/3346ac7f96d2fd3f77dca5acb283b28e02ad21fa) by [@markv](https://github.com/markv)) +- Migrated `VirtualizedList` legacy context implementation to `React.Context`. ([7bd694fc6f](https://github.com/facebook/react-native/commit/7bd694fc6f4bb027b6d7ee04034cad41a43e5695) by [@yungsters](https://github.com/yungsters)) +- Changed Flow type of `BackHandler` to be more specific. ([a903d1b86a](https://github.com/facebook/react-native/commit/a903d1b86ab56163abcdcb584f335949ba0c85fc) by [@Naturalclar](https://github.com/Naturalclar)) +- Updated transitive dependency `kind-of` to 6.0.3 to resolve vulnerability ([abde0154ba](https://github.com/facebook/react-native/commit/abde0154ba4247d2c9f1451b5de8b3cba1abd316) by [@TheSavior](https://github.com/TheSavior)) +- Upgrade eslint-config dependencies. ([93019dc190](https://github.com/facebook/react-native/commit/93019dc19072776053a88f9ab595e435b83fead0) by [@wcandillon](https://github.com/wcandillon)) +- Upgrade to Jest 25 ([f248ba1c8b](https://github.com/facebook/react-native/commit/f248ba1c8b15a12a0c590ce8211855cde31defe8) by [@cpojer](https://github.com/cpojer)) +- Use `React.Children.count` for counting children of `TextInput` ([92160f3144](https://github.com/facebook/react-native/commit/92160f3144dcfa510ff14b5f2eb231643f107af9) by [@vonovak](https://github.com/vonovak)) +- Annotate components in QPL logging using ImageAnalyticsTagContext ([60b7a3085c](https://github.com/facebook/react-native/commit/60b7a3085c0d83c126023b98e666ecda6f769454) by [@p-sun](https://github.com/p-sun)) +- Upgrade to React 17 ([24bca492c3](https://github.com/facebook/react-native/commit/24bca492c349ab90d40f9444df0f477145a4c311) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Made promise polyfill conditionalized on Hermes ([0a28b34dac](https://github.com/facebook/react-native/commit/0a28b34dacb91a7e74cd5feec59cf8f8fb0487c9) by [@Huxpro](https://github.com/Huxpro)) +- Flow: Remove type union in PickeriOS/PickerNativeComponent ([3113e47b9b](https://github.com/facebook/react-native/commit/3113e47b9bc92e3b0efb96db776f650848093dfc) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Flow: export ColorValue from StyleSheet instead of StyleSheetTypes ([0a67133124](https://github.com/facebook/react-native/commit/0a6713312467d3f5b5dc993e91db9e7b1aa4fc8c)) +- Forward URL parameters from main bundle to hot reloaded bundles ([b4785e5144](https://github.com/facebook/react-native/commit/b4785e514430dc3ba45ed6d136ec63574be88e26) by [@motiz88](https://github.com/motiz88)) +- Add package name / bundle ID to bundle URL in development ([9b5359133b](https://github.com/facebook/react-native/commit/9b5359133b46b16be200e37dba0b03d82b73b4a0) by [@motiz88](https://github.com/motiz88)) + +#### Android specific + +- Bump Gradle Wrapper to 6.7 ([8988a073b4](https://github.com/facebook/react-native/commit/8988a073b48df0f0cd4a7126edf1a421f4537d58), [5bc67b658e](https://github.com/facebook/react-native/commit/5bc67b658e581e0176deb7ed95b51a5c1cbe65c2), and [3a8559b86c](https://github.com/facebook/react-native/commit/3a8559b86c3c0b0ab6d6c6904c6efd97ab2c7b38) by [@friederbluemle](https://github.com/friederbluemle); [e559aee642](https://github.com/facebook/react-native/commit/e559aee64275126eaa135486e6bf09138be70f4d) and [e9fd93f53f](https://github.com/facebook/react-native/commit/e9fd93f53f8b14f921578cd401b3a6529e4e0c9f) by [@dulmandakh](https://github.com/dulmandakh)) +- Bump Android Gradle Plugin to 4.1.0 ([cf8368f204](https://github.com/facebook/react-native/commit/cf8368f2046ae1ff0f6b02bb6857eeeff8f57d7d) and [553fb8b28d](https://github.com/facebook/react-native/commit/553fb8b28d0ad332d75a944d244832be3390b6ba) by [@friederbluemle](https://github.com/friederbluemle), [dfa9db49e3](https://github.com/facebook/react-native/commit/dfa9db49e34c6f54c04148b877de938bf103a059) by [@dulmandakh](https://github.com/dulmandakh)) +- Bump Okio to 1.17.5 ([1e78e0655d](https://github.com/facebook/react-native/commit/1e78e0655d53ac947f523bcadf9c5339ab07bbb8) by [@dulmandakh](https://github.com/dulmandakh)) +- Make Android versionCodeOverride for new apps using the template human-readable ([e1bf515ae8](https://github.com/facebook/react-native/commit/e1bf515ae8e77fb24f76037d9f22e903799fb637) by [@gedeagas](https://github.com/gedeagas)) +- Bump SoLoader to 0.9.0 ([7465239230](https://github.com/facebook/react-native/commit/7465239230881f453d64364d51272f28614c8653) by [@dulmandakh](https://github.com/dulmandakh)) +- Update Okhttp to version 3.12.12 ([0f6fcb2c27](https://github.com/facebook/react-native/commit/0f6fcb2c2788dc7150f6c3673a8f4f9d8f929441) by [@halaei](https://github.com/halaei)) +- Update Android build tools to 29.0.3 ([e629e94b46](https://github.com/facebook/react-native/commit/e629e94b466ebbd5924b1d4493c026004dad707d) by [@friederbluemle](https://github.com/friederbluemle)) +- ViewCommands on Android now execute earlier, as a perf optimization. ([c6b9cc36da](https://github.com/facebook/react-native/commit/c6b9cc36da4f7d190d05122048aa4ada9c152b73) by [@JoshuaGross](https://github.com/JoshuaGross)) +- Effect of `blurRadius` now more closely matches other platforms. ([64860972be](https://github.com/facebook/react-native/commit/64860972be828fb601acbef11b4c2dbc672dee8a) by [@yungsters](https://github.com/yungsters)) +- Migrate Android tests to Robolectric v4 ([6a78b32878](https://github.com/facebook/react-native/commit/6a78b32878aea1b0dac98ff36378fb9392d4aeb1) by [@jselbo](https://github.com/jselbo), [d373a8d88c](https://github.com/facebook/react-native/commit/d373a8d88c30af910133d97ae973d256c4479929) and [18f7abae07](https://github.com/facebook/react-native/commit/18f7abae07b8ea60c7530a5d9f34541c50f5edd9) by [@fkgozali](https://github.com/fkgozali)) +- Get ripple drawables by id instead of by name ([c8ed2dbbb2](https://github.com/facebook/react-native/commit/c8ed2dbbb287deed05a8782fb8665c1edf45bbac) by [@vonovak](https://github.com/vonovak)) +- `TextInput`: Set `caretHidden` default value to `true` on Xiaomi devices to fix the crash ([b5b4a70410](https://github.com/facebook/react-native/commit/b5b4a7041027fd767850a564b5d80fa4a98ba2a2)) +- Update loading banner text and colors ([6afc984e81](https://github.com/facebook/react-native/commit/6afc984e8187ac91f780f125dad4421576131c83) by [@makovkastar](https://github.com/makovkastar)) +- Declare all attrs used in res targets ([05abbd245c](https://github.com/facebook/react-native/commit/05abbd245c2326b12d24698bb13007a7ce11e586) by [@IanChilds](https://github.com/IanChilds)) + +#### iOS specific + +- Upgraded JSI with a new HERMES_ENABLE_BITCODE flag ([311d4e9ef0](https://github.com/facebook/react-native/commit/311d4e9ef080aa429f840236cc23c013c0ae644c) by [@grabbou](https://github.com/grabbou)) +- Remove main queue execution of constantsToExport in NativeModules ([d7ac21cec5](https://github.com/facebook/react-native/commit/d7ac21cec5492e180fbf3817af7be64ab121cb75) by [@RSNara](https://github.com/RSNara)) +- Updated loading banner messages and color ([3729fe8de0](https://github.com/facebook/react-native/commit/3729fe8de0109c80014f6c20fae8b949b3628de2) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Speed up loading banner animations ([3fb37b4326](https://github.com/facebook/react-native/commit/3fb37b4326090def3aea43bd8189a0df648ccb34) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Shrink loading bar down to not cover safe area. ([f0dfd35108](https://github.com/facebook/react-native/commit/f0dfd35108dd3f092d46b65e77560c35477bf6ba) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Build macOS framework and add CocoaPods podspec ([ffa3d7f638](https://github.com/facebook/react-native/commit/ffa3d7f638c820dc208320193e6ba65667d751eb) by [@alloy](https://github.com/alloy)) +- Set `NSAllowsArbitraryLoads` to `false` by default in template ([7b61a968fd](https://github.com/facebook/react-native/commit/7b61a968fd774a6ca2196a731b6cec4282ab25cc) by [@wddwycc](https://github.com/wddwycc)) + +### Removed + +- `Text.viewConfig` is no longer exported. ([06ce643565](https://github.com/facebook/react-native/commit/06ce64356594a921cd9ae4f71c15dd56dd0e53a3) by [@yungsters](https://github.com/yungsters)) +- Removed `once()` and `removeCurrentListener()` from `DeviceEventEmitter` and `NativeEventEmitter`. ([87a2e29f59](https://github.com/facebook/react-native/commit/87a2e29f5928c2e09ac9a98c54732d5f697d8e61) by [@yungsters](https://github.com/yungsters)) +- Removed tvOS related files from the template ([df03228a61](https://github.com/facebook/react-native/commit/df03228a61881cdfa520fa6d8a9d9cfb6e77fdde) by [@Naturalclar](https://github.com/Naturalclar)) + +#### Android specific + +- Remove undocumented ColorAndroid function ([411c344794](https://github.com/facebook/react-native/commit/411c3447946c18743476e7d613358233464d6f58) by [@tom-un](https://github.com/tom-un)) + +### Fixed + +- Fix handling of very deeply nested data across the bridge ([a8c90e6af4](https://github.com/facebook/react-native/commit/a8c90e6af4a4e5ac115016a3e8977ecff90e99a0) by [@mhorowitz](https://github.com/mhorowitz)) +- Prevent TypeError in TaskQueue when cancelling a started but not resolved promise. ([14042fb76f](https://github.com/facebook/react-native/commit/14042fb76fee3573529d590ec6f8ad216aa0b820) by [@robwalkerco](https://github.com/robwalkerco)) +- Fix typo in `ActionSheetManager` invariant message ([9c353b5ab0](https://github.com/facebook/react-native/commit/9c353b5ab060be9392a7aaf437bba4ffc56d78ca) by [@sweatherall](https://github.com/sweatherall)) +- `TouchableHighlight` now correctly fires `onPress` when pressed for >500ms, when `onLongPress` is not supplied. ([bdf3c79110](https://github.com/facebook/react-native/commit/bdf3c7911007f547101d753903da11ea4ee095f9) by [@yungsters](https://github.com/yungsters)) +- `Pressability` now consistently fires `onPressIn` and `onPressOut`, even without an `onPress`. ([0c392bc405](https://github.com/facebook/react-native/commit/0c392bc4052784de7497bf7b5eaf207b02409877) by [@yungsters](https://github.com/yungsters)) +- Remove extraneous argument for `onResponderGrant` Flow type on `Text`. ([49015b0f5b](https://github.com/facebook/react-native/commit/49015b0f5bda83794b88b17dd3cbd834fa235b72) by [@yungsters](https://github.com/yungsters)) +- Prevent `ScrollView` From Stealing Responder Capture When Using Physical Keyboard ([93e7a7a70d](https://github.com/facebook/react-native/commit/93e7a7a70dc2f41fccd3c1e4cce80d92913c4243) by [@NickGerleman](https://github.com/NickGerleman)) +- Fix failure when debugging code in a browser; was caused by `performanceNow()` function. ([db474a47b7](https://github.com/facebook/react-native/commit/db474a47b70e4fa50f594f4dea8a2f531ca9fc07) by [@zerkella](https://github.com/zerkella)) +- Fix test renderer mocks to use the `displayName` more often. ([4b935ae95f](https://github.com/facebook/react-native/commit/4b935ae95f09e4a1eb1e5ac8089eb258222a0f8b) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Make sure `LogBox` is not included in production bundles ([d3b937f990](https://github.com/facebook/react-native/commit/d3b937f990012a31b8d917e220f4ed2f0a4fd2d3) by [@janicduplessis](https://github.com/janicduplessis)) +- Mark `force` as an optional property of the PressEvent object ([ad2f98df8f](https://github.com/facebook/react-native/commit/ad2f98df8f2ad8aff1dcdc11b187f35b372e3f0e) by [@Simek](https://github.com/Simek)) +- Fix invalid `event` objects from `onPressOut` in certain cases ([2c600b7c5a](https://github.com/facebook/react-native/commit/2c600b7c5a0e79bfc632b39b471e6ba774d7b0b3) by [@yungsters](https://github.com/yungsters)) +- When Hermes debugger is enabled continue to send log messages to the console ([77ef8f881f](https://github.com/facebook/react-native/commit/77ef8f881f2e4067894b412f308e2a80042c946f) by [@MartinSherburn](https://github.com/MartinSherburn)) +- Handle nullish `initialProps` correctly in `renderApplication` ([26c120c632](https://github.com/facebook/react-native/commit/26c120c6329d45e27318d82aaf5a50338bd6fa7d) by [@rubennorte](https://github.com/rubennorte)) +- Fix Flow type of Touchable{Opacity,Bounce,Highlight} being exported as `any` ([de7f69a58e](https://github.com/facebook/react-native/commit/de7f69a58ed4e18887f4b9d4d853293fb136afb7) by [@draperunner](https://github.com/draperunner)) +- Clarified the boundaries in error message of `scrollToIndex` ([78d2b3c813](https://github.com/facebook/react-native/commit/78d2b3c8138f54c2433958b0ad6b9f52ca59115a) by [@sasurau4](https://github.com/sasurau4)) +- Fix jsi cmake include dirs ([f5d00e5a29](https://github.com/facebook/react-native/commit/f5d00e5a2922d35a0b44935592da5700518c422b) by [@ryantrem](https://github.com/ryantrem)) +- Fix race condition in `KeyboardAvoidingView` ([b08fff6f86](https://github.com/facebook/react-native/commit/b08fff6f869e00c20c0dcdf7aca71284c2f276f0) by [@sammy-SC](https://github.com/sammy-SC)) +- Fix clone issue in YogaNodeJNIBase ([2707c17b07](https://github.com/facebook/react-native/commit/2707c17b0727f241d404f4a21090021c27c66f2c) by [@pasqualeanatriello](https://github.com/pasqualeanatriello)) +- Fix "Cannot read property 'getNativeScrollRef' of undefined" in createAnimatedComponent ([629e10e91b](https://github.com/facebook/react-native/commit/629e10e91b728c4251f1ed78a50df62820ce0dc4) by [@sammy-SC](https://github.com/sammy-SC)) + +#### Android specific + +- Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0/gradle 6.5 ([53f55001af](https://github.com/facebook/react-native/commit/53f55001afbf07494de0df064a92dfdd42f37c98) by [@tomoima525](https://github.com/tomoima525)) +- Do not crash when `ScrollView` `snapToOffsets` array is empty ([d238da71aa](https://github.com/facebook/react-native/commit/d238da71aa8cdd7ce519de617a9a200406da794c) by [@makovkastar](https://github.com/makovkastar)) +- Fixed `TextInput` not being selectable in `removeClippedSubviews` FlatLists ([12a50c0a44](https://github.com/facebook/react-native/commit/12a50c0a442b78d9095398d955bec307cfcb0f69) by [@hsource](https://github.com/hsource)) +- Make nested `Text` components accessible as links ([b352e2da81](https://github.com/facebook/react-native/commit/b352e2da8137452f66717cf1cecb2e72abd727d7) by [@ejanzer](https://github.com/ejanzer)) +- Move selection to the end of the text input on accessibility click ([f0e80ae229](https://github.com/facebook/react-native/commit/f0e80ae2292ebf7ce32666900007845724844fb5) by [@ejanzer](https://github.com/ejanzer)) +- Fix secure text entry setting to always hide text ([f19372361f](https://github.com/facebook/react-native/commit/f19372361f22201a453ff38eb69c5fa052b57474) by [@smeenai](https://github.com/smeenai)) +- Make promise NativeModule methods dispatch to NativeModules thread ([9c35b5b8c4](https://github.com/facebook/react-native/commit/9c35b5b8c4710dfe6a4b689a5565aa78ae5b37d3) by [@RSNara](https://github.com/RSNara)) +- Fix `NoSuchMethodException` when calling `DisplayMetricsHolder.initDisplayMetrics` in Android API level <= 16 (though those Android versions are no longer supported) ([35128f45d1](https://github.com/facebook/react-native/commit/35128f45d1ba97010e437423d14fa5ea0faf5fa3) by [@mdvacca](https://github.com/mdvacca)) +- Fixed error message in `DebugCorePackage.getModule` ([a71f37b951](https://github.com/facebook/react-native/commit/a71f37b951ca49c180b037ea8955851654b09afa) by [@TheWirv](https://github.com/TheWirv)) +- ScrollView, HorizontalScrollView: do not ignore `null` `contentOffset` prop ([9e85b7ad88](https://github.com/facebook/react-native/commit/9e85b7ad889900cd57cd2f82286aa8e034b0a32b) by [@vonovak](https://github.com/vonovak)) +- Picker - fix usage of setNativeSelectedPosition in onSelect ([078e386024](https://github.com/facebook/react-native/commit/078e386024474edc9b464f6c0fd8a1429e922289)) +- Fix intermittent crash of ReactSlider on Android ([32888a8b4a](https://github.com/facebook/react-native/commit/32888a8b4a9d75b9d3f6cc4578ce6a6ccd932407) by [@mdvacca](https://github.com/mdvacca)) +- Use actual constructor when throwing GradleScriptException ([8ef0f1d90b](https://github.com/facebook/react-native/commit/8ef0f1d90bbb2fa98e48ce89281718e5ac79365a)) +- Fix `skewX` transform decomposition ([797367c089](https://github.com/facebook/react-native/commit/797367c0890a38ec51cfaf7bd90b9cc7db0e97c7) by [@wcandillon](https://github.com/wcandillon)) +- Allow passing partial contentOffset to ScrollView on Android ([0348953914](https://github.com/facebook/react-native/commit/03489539146556ec5ba6ba07ac338ce200f5b0f4) by [@janicduplessis](https://github.com/janicduplessis)) +- Check if NativeModules returned from CatalystInstanceImpl.getNativeModule are null before using them. ([9263eb5d38](https://github.com/facebook/react-native/commit/9263eb5d3864a42925b699343db2c09cc8934ed0) by [@RSNara](https://github.com/RSNara)) +- Fix calculating view position within the window in split-screen mode ([b020e7c440](https://github.com/facebook/react-native/commit/b020e7c440f58dabd4cc64b72869f3ae9680ef30) by [@jakubkinst](https://github.com/jakubkinst)) +- Text layout no longer ignores parent bounds ([025be8148a](https://github.com/facebook/react-native/commit/025be8148a9abc533a8ae108e49cfd3f4512c581) by [@yungsters](https://github.com/yungsters)) +- Fixed excessive space in Text view with word-wrapping ([dda7f82261](https://github.com/facebook/react-native/commit/dda7f82261cc5684564e2c67071c13e379985308) by [@yungsters](https://github.com/yungsters)) +- `Pressable`: ripple should be applied even when borderless == false ([44ec762e41](https://github.com/facebook/react-native/commit/44ec762e41029bf43530b1ff9b36ca3512c526e2) by [@vonovak](https://github.com/vonovak)) +- Fix `ReadableNativeMap.getNullableValue` to match signature and return null instead of throwing ([1015194ba1](https://github.com/facebook/react-native/commit/1015194ba1a81eab99000d589914100e4b9ea037) by [@dulmandakh](https://github.com/dulmandakh)) +- `Picker`: set color filter so that the arrow matches the text color ([bb8d0f5732](https://github.com/facebook/react-native/commit/bb8d0f57328a20c942991f2d19d86639a7791924) by [@ejanzer](https://github.com/ejanzer)) +- `Modal`: fix crash when updating props after the activity disappeared ([7abcaafd66](https://github.com/facebook/react-native/commit/7abcaafd6600535825aa8330af7290ba8acea245) by [@mdvacca](https://github.com/mdvacca)) +- Fix crash while measuring ReactSlider in Android API < 21 ([75e6f7961f](https://github.com/facebook/react-native/commit/75e6f7961fb3f6de6afbe79d49c42ad55fba1673) by [@mdvacca](https://github.com/mdvacca)) +- Fix measureLayout function for VirtualTexts ([5c48c94f8c](https://github.com/facebook/react-native/commit/5c48c94f8c0441bc78a007f0ea0c5b2763ff6875) by [@mdvacca](https://github.com/mdvacca)) +- Smoother scrolling in ScrollView, HorizontalScrollView ([10314fe621](https://github.com/facebook/react-native/commit/10314fe621e1649654e83df197adf657e0ca8363) by [@JoshuaGross](https://github.com/JoshuaGross)) + +#### iOS specific + +- Synchronize RCTImageLoader loaders initialization ([edb6fa7979](https://github.com/facebook/react-native/commit/edb6fa79791beb804e450ca4a562a248abf730e5) by [@p-sun](https://github.com/p-sun)) +- Make sure js bundle still exists at bundle-output path ([3a41f69f9c](https://github.com/facebook/react-native/commit/3a41f69f9ce1ab778112c0727a69a753fe36c77a) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix crash in WebSocket module ([748aa13747](https://github.com/facebook/react-native/commit/748aa137472d6080427f74bb686c795b925c7d43) by [@marksinkovics](https://github.com/marksinkovics)) +- Align multi-line `TextInput` `onSubmitEditing` behavior: don't call onSubmitEditing when blurOnSubmit=false ([521b16730d](https://github.com/facebook/react-native/commit/521b16730dd07d80261086c2f33eed2a766d404e) by [@tido64](https://github.com/tido64)) +- Fix passing react native path in Podfile template ([e599d6c5d3](https://github.com/facebook/react-native/commit/e599d6c5d338c1b4d1a0d988e0d9ff83c179fb54) by [@janicduplessis](https://github.com/janicduplessis)) +- Call [RCTEventEmitter stopObserving] on correct method queue ([23717e48af](https://github.com/facebook/react-native/commit/23717e48aff3d7fdaea30c9b8dcdd6cfbb7802d5) by [@appden](https://github.com/appden)) +- Persist Enable Fast Refresh across app launches ([845e9eaafb](https://github.com/facebook/react-native/commit/845e9eaafb08b4ca87a9987e840798e0ba011676) by [@stigi](https://github.com/stigi)) +- Fix xcodebuild warnings in React-Core ([cb719a16cc](https://github.com/facebook/react-native/commit/cb719a16cc496b0cdb09d8d971b5e95cc8863b77)) +- Fix that RCTModalHostView can't be dismissed while being presented ([8933724d7d](https://github.com/facebook/react-native/commit/8933724d7d0f9ec012b2708d8e737f02f03e4a6f) by [@Mi-ZAZ](https://github.com/Mi-ZAZ)) +- Fix "'RCTBlobPlugins.h' file not found" when building iOS ([aaeffdb49a](https://github.com/facebook/react-native/commit/aaeffdb49a8412a98bb52477933fd208d1dcc096) by [@tido64](https://github.com/tido64)) +- Improved text rendering on macOS Catalyst ([694e22de84](https://github.com/facebook/react-native/commit/694e22de847e5f789b7d5ffe472b63aabbd7a5b0) by [@andymatuschak](https://github.com/andymatuschak)) +- Fixed showing Alert while closing a Modal ([f319ff321c](https://github.com/facebook/react-native/commit/f319ff321c4b7c0929b99e3ebe7e1ce1fa50b34c) by [@devon94](https://github.com/devon94)) +- Fix `refreshControl` messes up navigationBar largeTitles ([1b0fb9bead](https://github.com/facebook/react-native/commit/1b0fb9bead4d158d14df5a994423d06716b5e377) by [@yogevbd](https://github.com/yogevbd)) +- When Sec-WebSocket-Protocol header is empty vaulue, IIS server will return error 502. ([fd85b84a86](https://github.com/facebook/react-native/commit/fd85b84a863cea9f33e5b39230b27af53c1307e7) by [@bill2004158](https://github.com/bill2004158)) +- Fix multiline `TextInput` crash when inserting/removing lots of text ([15dda0ab5a](https://github.com/facebook/react-native/commit/15dda0ab5a491dcc83539f9ef32c9896be41074a) by [@tido64](https://github.com/tido64)) +- Group accessible views using the view hierarchy ([e2fd9d4f22](https://github.com/facebook/react-native/commit/e2fd9d4f22cda85c995c38875fc3a2a20a198c4a) by [@p-sun](https://github.com/p-sun)) +- Fix Flow types for StatusBar showHideTransition ([e5a8f4270e](https://github.com/facebook/react-native/commit/e5a8f4270ea71749a5ce6bd7ae198f695edb4307) by [@Simek](https://github.com/Simek)) +- Better error message when missing entry file ([e73208e2ca](https://github.com/facebook/react-native/commit/e73208e2ca59a2cf6a8a9c5e4e5b33afb5131f09) by [@petrbela](https://github.com/petrbela)) +- Fix imports in `RCTUtilsUIOverride.h` ([b7e8f66795](https://github.com/facebook/react-native/commit/b7e8f667953c2bc65c25b00968051c063a684d01) by [@Fanghao](https://github.com/Fanghao)) +- Fix skewX/skewY/perspective/matrix transforms. ([4b956fe5a6](https://github.com/facebook/react-native/commit/4b956fe5a6b3a05b1c2883efc82a95c2524aeb56) by [@wcandillon](https://github.com/wcandillon)) +- Fix module lookup race condition on bridge invalidation. ([8ad810717e](https://github.com/facebook/react-native/commit/8ad810717ee1769aa5ff6c73e0c9bfa8c43a3bac) by [@fkgozali](https://github.com/fkgozali)) +- Fix duration calculation for `RCTUIImageViewAnimated` ([12f8b2598f](https://github.com/facebook/react-native/commit/12f8b2598fa46533ea59834a0225cc9e36b20111)) +- Cap loading banner percentage at 100% ([e27542bb13](https://github.com/facebook/react-native/commit/e27542bb13d1f8f422cd307c4d43148c8bd82bc0) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Delay loading banner message to prevent flashing messages ([2b771b0129](https://github.com/facebook/react-native/commit/2b771b0129f2ef921c7cdb9c952e004f931927c3) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Do not update loading banner message while hiding the banner ([131c497aa2](https://github.com/facebook/react-native/commit/131c497aa2c081f9dfd03e45b25fb7ae388b98bd) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Search en0 through en8 for the Metro Bundler's IP address when generating iOS debug builds ([b2b23a2017](https://github.com/facebook/react-native/commit/b2b23a20170d12f6d8bf2733b93d7f9ab9c6cb15)) +- Migrate `frameInterval` to `preferredFramesPerSecond`, fixing Xcode warnings ([335f3aabe2](https://github.com/facebook/react-native/commit/335f3aabe28ec8f9b96fd695edabf0d5ab0b402a) by [@safaiyeh](https://github.com/safaiyeh)) +- Animated image should animate at the same speed regardless of framerate ([b0d0e51a77](https://github.com/facebook/react-native/commit/b0d0e51a7724dcefe3ce1c2dfb334a731b2a385c) by [@p-sun](https://github.com/p-sun)) +- Fix logging lifecycle when image is scrolled out and immediately back in ([1f95c9b62e](https://github.com/facebook/react-native/commit/1f95c9b62e306fdaf0ef351b02fb79713941259c) by [@p-sun](https://github.com/p-sun)) +- Fix image instrumentation lifecycle on image cancel ([6cba4d2006](https://github.com/facebook/react-native/commit/6cba4d20068ef4ca9b9832e4c5cf71a7e361ddbe) by [@p-sun](https://github.com/p-sun)) +- Break retain cycle in RCTLegacyViewManagerInteropCoordinator ([8f90ce26a5](https://github.com/facebook/react-native/commit/8f90ce26a55f2b1aab42d7c44b0d527321fa8c21) by [@sammy-SC](https://github.com/sammy-SC)) +- Respect port information if available from RCTBundleURLProvider ([7d44959940](https://github.com/facebook/react-native/commit/7d44959940b7f7b03feefde0e9a15382f04dad6d) by [@jimmy623](https://github.com/jimmy623)) +- Remove port from JSLocation when returning packager host ([12543d557f](https://github.com/facebook/react-native/commit/12543d557f00545a719b4dfd76cc0d0adfa37a01) by [@jimmy623](https://github.com/jimmy623)) +- Remove requestToken being nil check from [RCTNetworkTask validateRequestToken] ([ffc90c7f92](https://github.com/facebook/react-native/commit/ffc90c7f92e63e1a53ed107833e3deed492ab435) by [@sammy-SC](https://github.com/sammy-SC)) +- Remove unnecessary packager running check when saved JSLocation is empty ([bbb7bef539](https://github.com/facebook/react-native/commit/bbb7bef539f418bdb452e40987d399c9369df5a2) by [@jimmy623](https://github.com/jimmy623)) +- Check whether packager is running in RCTBundleURLProvider for saved JSLocation ([3d882495d5](https://github.com/facebook/react-native/commit/3d882495d5e4415c2ebb8f4280e18e16025e0736) by [@jimmy623](https://github.com/jimmy623)) +- Fix crash inside RCTRedBox when trying to present same UIViewController twice ([46c77dc296](https://github.com/facebook/react-native/commit/46c77dc296dfab754356cd9346a01dae8d4869f4) by [@sammy-SC](https://github.com/sammy-SC)) +- Fix outdated CocoaPods version requirement in a React.podspec ([8a6ac1fef3](https://github.com/facebook/react-native/commit/8a6ac1fef369071405a3bf14a89924c66f28d192) by [@sunnylqm](https://github.com/sunnylqm)) + +## v0.63.4 + +### Changed + +- [Maintenance] Bump detox to xcode 12 compatible version ([ccd4efac90](https://github.com/facebook/react-native/commit/ccd4efac90191e57b1dd6e7fff0da13e5764bcc4) by [@kelset](https://github.com/kelset)) + +#### Android specific + +- Bump SoLoader to 0.9.0 ([7465239230](https://github.com/facebook/react-native/commit/7465239230881f453d64364d51272f28614c8653) by [@dulmandakh](https://github.com/dulmandakh)) +- Update Okhttp to version 3.12.12 ([0f6fcb2c27](https://github.com/facebook/react-native/commit/0f6fcb2c2788dc7150f6c3673a8f4f9d8f929441) by [@halaei](https://github.com/halaei)) +- ScrollView now supports `contentOffset` ([ed29ba13f9](https://github.com/facebook/react-native/commit/ed29ba13f97f240c91fdf6c0ef3fb601046697b9) by [@JoshuaGross](https://github.com/JoshuaGross)) + +### Fixed + +#### Android specific + +- Fix ReadableNativeMap.getNullableValue to match signature ([1015194ba1](https://github.com/facebook/react-native/commit/1015194ba1a81eab99000d589914100e4b9ea037) by [@dulmandakh](https://github.com/dulmandakh)) +- Dimension update events are now properly sent following orientation change ([0e9296b95d](https://github.com/facebook/react-native/commit/0e9296b95da06789121f052e6cd6d7cac808464c) by [@ajpaulingalls](https://github.com/ajpaulingalls)) +- Font family is not apply when secureTextEntry is true. ([00d9deaf6b](https://github.com/facebook/react-native/commit/00d9deaf6ba26c605694d303bb0cb072fceae5a1) by [@hank121314](https://github.com/hank121314)) +- Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0/gradle 6.5 ([53f55001af](https://github.com/facebook/react-native/commit/53f55001afbf07494de0df064a92dfdd42f37c98) by [@tomoima525](https://github.com/tomoima525)) +- ScrollView, HorizontalScrollView: do not ignore `null` `contentOffset` prop ([9e85b7ad88](https://github.com/facebook/react-native/commit/9e85b7ad889900cd57cd2f82286aa8e034b0a32b) by [@vonovak](https://github.com/vonovak)) +- SkewX transforms ([797367c089](https://github.com/facebook/react-native/commit/797367c0890a38ec51cfaf7bd90b9cc7db0e97c7) by [@wcandillon](https://github.com/wcandillon)) +- Allow passing partial contentOffset to ScrollView on Android ([0348953914](https://github.com/facebook/react-native/commit/03489539146556ec5ba6ba07ac338ce200f5b0f4) by [@janicduplessis](https://github.com/janicduplessis)) +- Set color filter so that the arrow matches the text color ([bb8d0f5732](https://github.com/facebook/react-native/commit/bb8d0f57328a20c942991f2d19d86639a7791924) by [@ejanzer](https://github.com/ejanzer)) + +#### iOS specific + +- A crash in WebSocket module ([748aa13747](https://github.com/facebook/react-native/commit/748aa137472d6080427f74bb686c795b925c7d43) by [@marksinkovics](https://github.com/marksinkovics)) +- Fixed showing Alert while closing a Modal ([f319ff321c](https://github.com/facebook/react-native/commit/f319ff321c4b7c0929b99e3ebe7e1ce1fa50b34c) by [@devon94](https://github.com/devon94)) +- Bug with skewX/skewY/perspective/matrix transforms. ([4b956fe5a6](https://github.com/facebook/react-native/commit/4b956fe5a6b3a05b1c2883efc82a95c2524aeb56) by [@wcandillon](https://github.com/wcandillon)) + +## v0.63.3 + +### Added + +#### iOS specific + +- Ability to set which configuration to enable flipper for when using use_flipper! ([dc2df75426](https://github.com/facebook/react-native/commit/dc2df754267df3909631d81c22b9fcab58dfa241) by [@nicoburns](https://github.com/nicoburns)) + +### Changed + +- Update Flipper to 0.54 ([d8b70b19b3](https://github.com/facebook/react-native/commit/d8b70b19b39ead4dd41895d666d116a43c56474e) by [@mweststrate](https://github.com/mweststrate)) +- Removed default 130ms delay from Pressability and Pressable. ([86ffb9c41e](https://github.com/facebook/react-native/commit/86ffb9c41e033f59599e01b7ad016706b5f62fc8) by [@yungsters](https://github.com/yungsters)) + +### Fixed + +#### Android specific + +- `KeyboardDidHide` wrong `screenY` coordinates with `windowTranslucentStatus=true` ([45954ac5dc](https://github.com/facebook/react-native/commit/45954ac5dccdfe05de7553a0f08c4f0e66e3d62e) by [@fabriziobertoglio1987](https://github.com/fabriziobertoglio1987)) +- Fix Xiaomi TextInput crash in native ([07a597ad18](https://github.com/facebook/react-native/commit/07a597ad185c8c31ac38bdd4d022b0b880d02859)) + +#### iOS specific + +- Prefetch images using a lower download priority ([058eeb43b4](https://github.com/facebook/react-native/commit/058eeb43b489f52183f081fb7232be683002a242) by [@p-sun](https://github.com/p-sun)) +- Fix `RCTImageLoader` not using decoders provided. ([663b5a878b](https://github.com/facebook/react-native/commit/663b5a878be9faafd13b41c222a1bc2ac7bb3a65) by [@sjchmiela](https://github.com/sjchmiela)) +- Support Swift based libraries using Xcode 12’s build system. ([6e08f84719](https://github.com/facebook/react-native/commit/6e08f84719c47985e80123c72686d7a1c89b72ed) by [@alloy](https://github.com/alloy)) +- Fix "main.jsbundle does not exist" issue ([83777cb4fb](https://github.com/facebook/react-native/commit/83777cb4fb5dda89c430b7eff9cd1f28d2577831)) +- Fixed headers in `Image.getSizeWithHeaders`. ([0bcc686c1c](https://github.com/facebook/react-native/commit/0bcc686c1cc90fd44de7a28e2f56ea20fe2f5123) by [@PaitoAnderson](https://github.com/PaitoAnderson)) + +### Security + +- Fix security issues with `@react-native-community/cli` by bumping version ([001eb7cbd6](https://github.com/facebook/react-native/commit/001eb7cbd66c7dc1a302ee2a638c1cfc164538f4) by [@alexbrazier](https://github.com/alexbrazier)) + +## v0.63.2 + +### Fixed + +- Restore Previous Behavior for StyleSheet Validation of Null/Undefined Styles ([e75557b48f](https://github.com/facebook/react-native/commit/e75557b48fbee1d136b8b7d1a78ea8f9b9467479) by [@NickGerleman](https://github.com/NickGerleman)) + +#### Android specific + +- Set LogBox windowTranslucentNavigation to false ([23036b38bc](https://github.com/facebook/react-native/commit/23036b38bc4443c8db4865e5c2b21aca7ab4f92f) by [@Ashoat](https://github.com/Ashoat)) +- Fix unable to run in debug mode on Android API < 21 ([7694b32a88](https://github.com/facebook/react-native/commit/7694b32a88078278457dd8721eb61da9c4ac0f5a) by [@Shywim](https://github.com/Shywim)) + +#### iOS specific + +- Fix image cannot show in iOS 14 ([123423c2a9](https://github.com/facebook/react-native/commit/123423c2a9258c9af25ca9bffe1f10c42a176bf3)) + +## v0.63.1 + +### Added + +- Added `minPressDuration` to `Pressable`. ([4aaf629982](https://github.com/facebook/react-native/commit/4aaf62998247bcfd8ebf369d73290096fde08012) by [@yungsters](https://github.com/yungsters)) +- Support for array buffers in the JavaScriptCore implementation of JSI ([9c32140068](https://github.com/facebook/react-native/commit/9c32140068463739b91874689f741ea9630d8c3b) by [@ryantrem](https://github.com/ryantrem)) + +#### Android specific + +- ProGuard rule for hermes ([449dc37720](https://github.com/facebook/react-native/commit/449dc37720b24d9d88661314424c9f982e70ec3a) by [@radko93](https://github.com/radko93)) + +### Fixed + +- LogBox.ignoreAllLogs() should ignore logs ([f28c7505fa](https://github.com/facebook/react-native/commit/f28c7505fa5b4a7ddf1e9311d38dfcd15e8953a2) by [@rickhanlonii](https://github.com/rickhanlonii)) + +#### Android specific + +- Fix font variant crash on Android < 4.4 ([f23feced42](https://github.com/facebook/react-native/commit/f23feced42abd1d18a12e413bf79a51bead61379) by [@Almouro](https://github.com/Almouro)) +- Fix border-drawing when changing border-radius back to 0` ([7757ad0576](https://github.com/facebook/react-native/commit/7757ad05762284c059807d7d75fd03559e86f2b2) by [@IjzerenHein](https://github.com/IjzerenHein)) +- Fix rounded border-drawing when border-radius is smaller than border-width` ([28dce3665d](https://github.com/facebook/react-native/commit/28dce3665d8a63e902c165c060400486fe6234f4) by [@IjzerenHein](https://github.com/IjzerenHein)) + +#### iOS specific + +- TextInput color has the same default (#000) on iOS whether in light or dark mode ([a2f8b9c36e](https://github.com/facebook/react-native/commit/a2f8b9c36e5eba6bc354a2f53bf8d3ca11297d00) by [@JonnyBurger](https://github.com/JonnyBurger)) +- Fixes TextInput shaking when typing Chinese ([9cdc19a936](https://github.com/facebook/react-native/commit/9cdc19a93669b37c0518bd32263e156ffc9193c7) by [@zhongwuzw](https://github.com/zhongwuzw)) + +## v0.63.0 + +### Breaking + +- The `target` field of events is now a native component, not a react tag ([3b813cade1](https://github.com/facebook/react-native/commit/3b813cade1f5d6f248a39f6bbd983f68c5794fe6) by [@TheSavior](https://github.com/TheSavior)) +- Modal: Remove support for `animated` prop (deprecated in 0.26) ([1e9db7bd6d](https://github.com/facebook/react-native/commit/1e9db7bd6df3055b9b81d23f15a54bb250621a41) by [@TheSavior](https://github.com/TheSavior)) +- Alert: Remove deprecated support for passing callback as fourth argument to `Alert.prompt` (deprecated in 0.59) ([a26d622d04](https://github.com/facebook/react-native/commit/a26d622d04451d6872eed2491e5d3f7d4689824d) by [@TheSavior](https://github.com/TheSavior)) +- Switch: Remove support for `thumbTintColor`, `tintColor`, `onTintColor` props (deprecated in 0.57) ([26912bd979](https://github.com/facebook/react-native/commit/26912bd9798aeb38931466b8ddcd3a48973b0528) by [@TheSavior](https://github.com/TheSavior)) +- Multiple deprecations and breaking changes to `TextInputState`. Use native component refs instead of react tags ([6286270e4c](https://github.com/facebook/react-native/commit/6286270e4cb10b40cfd7c8193e31d965f6815150) by [@TheSavior](https://github.com/TheSavior)) +- Bump supported Node engines to >= 10 ([f0c7178a3a](https://github.com/facebook/react-native/commit/f0c7178a3a24e7694b765946f0d884104c8cfa4c) by [@safaiyeh](https://github.com/safaiyeh)) + +### Deprecated + +- Add deprecation warnings for `Clipboard`, `SegmentedControlIOS`, `ProgressViewIOS`, `ProgressBarAndroid`. These modules have been moved to [react-native-community](https://github.com/react-native-community) libraries. ([f295d7f608](https://github.com/facebook/react-native/commit/f295d7f60843a45bb09fc366e497f512c2bc0046) by [@Naturalclar](https://github.com/Naturalclar)) +- Deprecated `console.disableYellowBox` in favor of `LogBox.ignoreAllLogs`. ([87f1e22434](https://github.com/facebook/react-native/commit/87f1e22434210ad22f526422bbda0413f59786ce) by [@rickhanlonii](https://github.com/rickhanlonii)) + +#### Android specific + +- We are deprecating the method `UIManagerModule.resolveRootTagFromReactTag`, this will not be supported in the next version of RN ([acbf9e18ea](https://github.com/facebook/react-native/commit/acbf9e18ea666b07c1224a324602a41d0a66985e) by [@mdvacca](https://github.com/mdvacca)) +- Add warning message for trying to use `ToolbarAndroid` which has been removed from the core since 0.61. ([6249d14a61](https://github.com/facebook/react-native/commit/6249d14a61723b22deb1336457b4295978471885) by [@Naturalclar](https://github.com/Naturalclar)) + +#### iOS specific + +- Deprecate iOS 9.x support ([58a6a40eac](https://github.com/facebook/react-native/commit/58a6a40eac9afb5c4de78a63418cc48ea97da1a4), [829a2237d2](https://github.com/facebook/react-native/commit/829a2237d270c03c80467eb6c2b5b18c87135a45), [674b591809](https://github.com/facebook/react-native/commit/674b591809cd1275b5f1c4d203c2f0ec52303396) by [@fkgozali](https://github.com/fkgozali), [d1265077d6](https://github.com/facebook/react-native/commit/d1265077d6638bb9219180628caf6ff83f8d6019) by [@sunnylqm](https://github.com/sunnylqm)) + +### Added + +- Implement `nativePerformanceNow` and `performance.now()` ([232517a574](https://github.com/facebook/react-native/commit/232517a5740f5b82cfe8779b3832e9a7a47a8d3d) by [@emilisb](https://github.com/emilisb)) +- Support `PerformanceLogger` stopTimespan updates ([08c338eebf](https://github.com/facebook/react-native/commit/08c338eebf67ef6c8c8fb7e3a91bbf89bbc2bb4c) by [@sahrens](https://github.com/sahrens)) +- Added `PlatformColor` implementations for iOS and Android ([f4de45800f](https://github.com/facebook/react-native/commit/f4de45800f25930a1c70f757d12269d859066d3d) by [@tom-un](https://github.com/tom-un)) +- Stamp React Native Version Into C++ Code ([427ba359e0](https://github.com/facebook/react-native/commit/427ba359e0c9411438286dd137bbca67f9829fde) by [@NickGerleman](https://github.com/NickGerleman)) +- New `` Component to make it easier to create touchable elements ([3212f7dfe8](https://github.com/facebook/react-native/commit/3212f7dfe82d187e27f1410c8c3cb1d9fb9f5094) by [@TheSavior](https://github.com/TheSavior), [bd3868643d](https://github.com/facebook/react-native/commit/bd3868643d29e93610e19312571a9736df2cbdf8) by [@vonovak](https://github.com/vonovak)) +- Export `LogBox` module ([799bf56f6f](https://github.com/facebook/react-native/commit/799bf56f6f6a46b6bd42ac5a824f44bd1412f3b6) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Export `LayoutAnimationConfig` flow type ([f0dafd34fe](https://github.com/facebook/react-native/commit/f0dafd34fedb0d63eb2499b978a52da9e6b71ea1) by [@sahrens](https://github.com/sahrens)) +- Added `react-native-community/eslint-plugin` as a dependency for `react-native-community/eslint-config` ([2c2e35c634](https://github.com/facebook/react-native/commit/2c2e35c634cd936bd7ea7a7fe444058268308224) by [@Naturalclar](https://github.com/Naturalclar)) +- `DEBUG_NETWORK_SEND_DELAY` can be used to simulate slow network. ([4aac019176](https://github.com/facebook/react-native/commit/4aac019176e3359068ac671ed4157a6e3ada481f) by [@sahrens](https://github.com/sahrens)) +- Support for `accessibilityLabel` prop to the `Picker` component ([0a525b6d9d](https://github.com/facebook/react-native/commit/0a525b6d9d2a88dddf24b85a2485b928fca23b16) by [@KevinGVargas](https://github.com/KevinGVargas)) +- Allow `zIndex` to `useNativeDriver` ([6a4e06faa8](https://github.com/facebook/react-native/commit/6a4e06faa8afbcb607fc2696c45c4f3257b6665d) by [@mackenziemance](https://github.com/mackenziemance)) + +#### Android specific + +- Support item background color in Dialog `Picker` ([22eb711c84](https://github.com/facebook/react-native/commit/22eb711c84587ac92da97e486fecaa79424fa925)) +- Add OverrideColorScheme interface and setOverrideColorScheme method to AppearanceModule([45d7df6cf7](https://github.com/facebook/react-native/commit/45d7df6cf7482b9790c97db613055ff5d3e59a87)) +- Allow setting custom ripple radius on `TouchableNativeFeedback` ([7f2a79f40b](https://github.com/facebook/react-native/commit/7f2a79f40b4a4c41344ca90cefe318af607675e0) by [@vonovak](https://github.com/vonovak)) +- Add `resizeMode` prop support on `TextInlineView` ([6871416328](https://github.com/facebook/react-native/commit/68714163280695c3148544b95b05a2c1464dbbba) by [@mdvacca](https://github.com/mdvacca)) +- Added an API for checking if there are busy timers to `TimingModule` ([22764e6cdc](https://github.com/facebook/react-native/commit/22764e6cdcf45ca5930676f6e95f9ab2f82bc78d) by [@ejanzer](https://github.com/ejanzer)) +- Make packager location customizable in dev mode ([3714f3648a](https://github.com/facebook/react-native/commit/3714f3648a8ac51f2bb7f2791e2381551d0209b4)) + +#### iOS specific + +- `UIScene` support for `RCTImageView` ([f332fac163](https://github.com/facebook/react-native/commit/f332fac16346d2f03d056575cc988a0b2bbb48c6) by [@tido64](https://github.com/tido64)) +- Status bar style is now correctly changed in multi-window iPadOS 13 apps if you use `RCTRootViewController` and set `UIViewControllerBasedStatusBarAppearance=YES` ([80e6d672f3](https://github.com/facebook/react-native/commit/80e6d672f32fdc860c73eabcc63763dcab3c6269) by [@radex](https://github.com/radex)) +- Added `userInterfaceStyle` for `ActionSheetIOS` and `Share` to override user interface style on IOS 13 ([0a9cc34dd8](https://github.com/facebook/react-native/commit/0a9cc34dd82a3a7dba576997ebd424b12876dbaa) by [@Arjan-Zuidema](https://github.com/Arjan-Zuidema)) +- Add localized accessibility strings to `ReactCore` pod ([aebf54aee4](https://github.com/facebook/react-native/commit/aebf54aee41cc892198b055a7a546743297412bd) by [@xuelgong](https://github.com/xuelgong)) +- Resolve and reject promise for `PushNotificationIOS.requestPermissions` ([edfdafc7a1](https://github.com/facebook/react-native/commit/edfdafc7a14e88a2660b95cb220c62f29b1b28c0) by [@p-sun](https://github.com/p-sun)) +- Use autolink script in template on iOS ([a35efb9400](https://github.com/facebook/react-native/commit/a35efb94006bfa3f541bf3fc3ab5262740f00525) by [@janicduplessis](https://github.com/janicduplessis)) +- Added `Flipper` to template app ([52cd9cd6fe](https://github.com/facebook/react-native/commit/52cd9cd6fec0866177aa02f7129a8b3d8b2bdbea) by [@safaiyeh](https://github.com/safaiyeh)) +- Add `textColor` and `backgroundColor` props to `SegmentedControl` for iOS >=13 ([e8f577e541](https://github.com/facebook/react-native/commit/e8f577e541815bfd8adebdf14f70c9e4205f8e4e) by [@Naturalclar](https://github.com/Naturalclar)) +- Adds `RCTOverrideAppearancePreference` to the iOS `Appearance` module ([fa65b156d4](https://github.com/facebook/react-native/commit/fa65b156d4109e6a3121484b601358b11cf0d541)) +- Changed iOS LaunchScreen from `xib` to `storyboard` ([33b3a1a145](https://github.com/facebook/react-native/commit/33b3a1a1453ca51690e59b758eeb61a4fa8f35bc) by [@jeswinsimon](https://github.com/jeswinsimon)) + +### Changed + +- Update `react-native-community/eslint-config` to 1.1.0, adding the new color rule ([780f06cd47](https://github.com/facebook/react-native/commit/780f06cd477f34da48646a949bd25dd3f883a9a2) by [@TheSavior](https://github.com/TheSavior)) +- Update community eslint plugin in the eslint config ([b2d10bc602](https://github.com/facebook/react-native/commit/b2d10bc60272fc2318835ff38655a9eb4a2bbed0) by [@Naturalclar](https://github.com/Naturalclar)) +- Upgrade `eslint-config` and `metro-preset` in project template ([ad86a18305](https://github.com/facebook/react-native/commit/ad86a183052e8b25d599eb395aef55412c02ff7b) by [@Naturalclar](https://github.com/Naturalclar)) +- Add ES Lint rules for `DynamicColorIOS()`and `ColorAndroid()` ([602070f44b](https://github.com/facebook/react-native/commit/602070f44b02220aeb036a7b3c26dad5c611b636) by [@tom-un](https://github.com/tom-un)) +- Make `ScrollView` use `forwardRef` ([d2f314af75](https://github.com/facebook/react-native/commit/d2f314af75b63443db23e131aaf93c2d064e4f44) by [@kacieb](https://github.com/kacieb)) +- Upgrade embedded React DevTools backend from v4.0.6 to v4.6.0 ([93ee5b2cc8](https://github.com/facebook/react-native/commit/93ee5b2cc8391bc5cb12ca7cf08ed0e44c74d29a) by [@bvaughn](https://github.com/bvaughn)) +- Updated the React Hooks ESLint Plugin ([6ce3f0a4f7](https://github.com/facebook/react-native/commit/6ce3f0a4f7495adb82e655d037dc4e5af462f955) by [@gaearon](https://github.com/gaearon)) +- Update to React 16.13.1 ([9637d6214a](https://github.com/facebook/react-native/commit/9637d6214a47e58d7fa8252a3de8c057e5cfb101) by [@gaearon](https://github.com/gaearon)) +- Relax `RefreshControl`'s `onRefresh` flow typing ([884c86ae02](https://github.com/facebook/react-native/commit/884c86ae02b0be7ea1e4b258dab39f4c5aee0b9d) by [@vonovak](https://github.com/vonovak)) +- Improved flowtype support for `Animated` ([bdafc55f50](https://github.com/facebook/react-native/commit/bdafc55f50c7d580ee2e643a02cb95d0196f721c) by [@javache](https://github.com/javache)) +- Upgrade `eslint-plugin-relay` to 1.6.0 ([0483404d82](https://github.com/facebook/react-native/commit/0483404d827416b7270e8a42b84e424035127892) by [@kassens](https://github.com/kassens)) +- Upgrade to latest dependencies in package.json template ([82e8239337](https://github.com/facebook/react-native/commit/82e82393377ddcedba01c401a5d79d5bbcdc4dc9) by [@codler](https://github.com/codler)) +- Make JSStringToSTLString 23x faster ([733532e5e9](https://github.com/facebook/react-native/commit/733532e5e95c85b8295b6c66009ca9efd2a77622) by [@radex](https://github.com/radex)) +- Changed property `disableIntervalMomentum` to work with both horizontal and vertical ScrollViews ([6237cfb325](https://github.com/facebook/react-native/commit/6237cfb325e39571ede0054a67d60f2c978d6d58) by [@Shaninnik](https://github.com/Shaninnik)) +- Upgraded to Flow v0.114.0 ([aa78457343](https://github.com/facebook/react-native/commit/aa7845734352eab2bd32f7d6e683d6674fd6680d) by [@mroch](https://github.com/mroch)) +- Updated CLI to the latest version ([ddc33007ad](https://github.com/facebook/react-native/commit/ddc33007ad0b4a0a24966b833e797227b9c56cca) by [@grabbou](https://github.com/grabbou)) +- Upgrade Prettier from 1.17 to 2.0.2. ([cf44650b3f](https://github.com/facebook/react-native/commit/cf44650b3f4f13df8208ceded60ec5c48bd6baf3) by [@bolinfest](https://github.com/bolinfest)) +- Only set dimensions if the window attributes change ([35c6bb9ac0](https://github.com/facebook/react-native/commit/35c6bb9ac0fc452428e85fee72affb4fc29f500c) by [@cpojer](https://github.com/cpojer)) +- Upgrade internal packages to support ESLint >= 6 ([89d04b5e4a](https://github.com/facebook/react-native/commit/89d04b5e4a3fd0b0f77b5a390c0aa62a3804e2bc) by [@Barbiero](https://github.com/Barbiero)) +- Make `JSCRuntime::createValue` faster ([24e0bad8be](https://github.com/facebook/react-native/commit/24e0bad8bea95ef7ddf72e2f00a93ffd47872d5b) by [@radex](https://github.com/radex)) +- Add perf markers in `XMLHttpRequest` ([71b8ececf9](https://github.com/facebook/react-native/commit/71b8ececf9b298fbf99aa27d0e363b533411e93d) by [@sahrens](https://github.com/sahrens)) +- Update SoLoader to 0.8.2 ([0a6f058b6b](https://github.com/facebook/react-native/commit/0a6f058b6bd0493f7eece972b1f73be3606ca8d5) by [@passy](https://github.com/passy)) +- `console.error` calls, and uncaught exceptions are now displayed in the Metro logs as well ([ffb82cb2f0](https://github.com/facebook/react-native/commit/ffb82cb2f052f276a94a004d5acea0ab44f8098c) by [@mweststrate](https://github.com/mweststrate)) +- Upgrade Flipper to 0.37.0 ([17f025bc26](https://github.com/facebook/react-native/commit/17f025bc26da13da795845a3f7daee65563420c0) by [@sunnylqm](https://github.com/sunnylqm)) + +#### Android specific + +- Upgraded to Hermes 0.5.0 ([4305a291a9](https://github.com/facebook/react-native/commit/4305a291a9408ca65847994bbec42f1fbc97071d) by [@willholen](https://github.com/willholen)) +- Internal storage now will be preferred for caching images from `ImageEditor`. ([79efa43428](https://github.com/facebook/react-native/commit/79efa4342852a3e9271a56e3a0fb7c15be664e9a) by [@kitttn](https://github.com/kitttn)) +- Update Gradle Wrapper to 6.2 ([d4d8887b50](https://github.com/facebook/react-native/commit/d4d8887b5018782eeb3f26efa85125e6bbff73e4) by [@friederbluemle](https://github.com/friederbluemle)) +- Upgrade Folly to v2020.01.13.00 ([6e2131b8fa](https://github.com/facebook/react-native/commit/6e2131b8fa85da8b3fb0391803e7fbecba890ffb) by [@Kudo](https://github.com/Kudo)) +- Only update dimensions in `ReactRootView` if they've changed ([cc3e27d484](https://github.com/facebook/react-native/commit/cc3e27d484d3a412f632454b7f1c637b2c271af2) by [@ejanzer](https://github.com/ejanzer)) +- `ReactEditText` extends `AppCompatEditText` ([aaa2765a92](https://github.com/facebook/react-native/commit/aaa2765a920de8234f0def4cae05ca5d6c8c8ac8) by [@dulmandakh](https://github.com/dulmandakh)) +- Make `ReactApplicationContext` nullable as the constructor argument of `ReactContextBaseJavaModule` ([f8d5c5bfd7](https://github.com/facebook/react-native/commit/f8d5c5bfd79be0e20a205a1856bd9946143eeacf) by [@RSNara](https://github.com/RSNara)) +- Update Android Gradle plugin to 3.5.3 ([e1e081b00e](https://github.com/facebook/react-native/commit/e1e081b00e5efb32bce74211c850212eca8a9412) by [@SaeedZhiany](https://github.com/SaeedZhiany)) +- Don't emit dimensions update event on initial load ([383934a06e](https://github.com/facebook/react-native/commit/383934a06e22e8e1a5ee50d121722240259f95d0) by [@ejanzer](https://github.com/ejanzer)) +- Bump Android build-tools to 29.0.2, compileSdk to 29 ([edcbfb9821](https://github.com/facebook/react-native/commit/edcbfb98210d9aaa6bb1d7c64281ae9cfb41cac2) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific + +- Disambiguate autolinking-ios.rb script from CLI’s “autolinking” feature and bring RNTester & template in line. ([4118d79826](https://github.com/facebook/react-native/commit/4118d798265341061105f3a53550db83c66a71cb) by [@alloy](https://github.com/alloy)) +- Updated Flipper iOS integration to be included by default in the `Debug` configuration ([619d5d60df](https://github.com/facebook/react-native/commit/619d5d60dfa94966e7104febec08166c1b5eca49) by [@alloy](https://github.com/alloy)) +- Use Apple unified logging API (os_log) ([f501ed682a](https://github.com/facebook/react-native/commit/f501ed682ae68136d966aee2b0d3cc0f1e8b90cd) by [@LeoNatan](https://github.com/LeoNatan)) +- Upgrade Folly to v2020.01.13.00 ([a27e31c059](https://github.com/facebook/react-native/commit/a27e31c059971b1d554ad6c7c81706f08eafac87) by [@Kudo](https://github.com/Kudo)) +- Remove the `xcshareddata` from .gitignore ([7980615d37](https://github.com/facebook/react-native/commit/7980615d371a7bf607a3787bca91cfde229c41dc) by [@pvinis](https://github.com/pvinis)) +- Add `complete_nullability = True` to compatible libraries ([796a4ea7e3](https://github.com/facebook/react-native/commit/796a4ea7e31ae05b76e59e02ab05f9c955f7c149)) +- Remove the Flipper pod post install step ([44beb2a685](https://github.com/facebook/react-native/commit/44beb2a685b7ceb0311bde7d0d33cb70bb891d30) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- Enable Flipper with CocoaPods `:configuration` ([7bb1c4e1b8](https://github.com/facebook/react-native/commit/7bb1c4e1b8715a5c9cb6f9e4e77a6df783481d3d) by [@alloy](https://github.com/alloy)) + +### Removed + +- Remove unused`ImageProp` ([fbd09b1797](https://github.com/facebook/react-native/commit/fbd09b179759cd90f2be5c24caa11bdb483ad8cd) by [@Naturalclar](https://github.com/Naturalclar)) +- Remove leftover `Incremental` component ([e99800267b](https://github.com/facebook/react-native/commit/e99800267b78aa581aff956d47b8be91858628b9) by [@venits](https://github.com/venits)) +- Remove "Debug with Nuclide" option ([011eb4cea5](https://github.com/facebook/react-native/commit/011eb4cea5d482cef54d7659e7436a04e539ff19) by [@rickhanlonii](https://github.com/rickhanlonii)) + +#### Android specific + +- Remove unused Feature Flag: `lazilyLoadViewManagers` ([3963f34980](https://github.com/facebook/react-native/commit/3963f34980f501ef89a945a1d0e76716af84527d) by [@JoshuaGross](https://github.com/JoshuaGross)) +- `PickFirst` options for RNTester and template ([4bb0b4f205](https://github.com/facebook/react-native/commit/4bb0b4f205b1bc9a91150fe1f609f7d7313eb806) by [@passy](https://github.com/passy)) +- Remove Kotlin version from the default template ([ced959bb3d](https://github.com/facebook/react-native/commit/ced959bb3d6abdab30c5e64af9bff6059b111cdd) by [@grabbou](https://github.com/grabbou)) + +#### iOS specific + +- Remove core `RCTConvert` CoreLocation Libraries ([bcf2a716fb](https://github.com/facebook/react-native/commit/bcf2a716fb8b8954d6f7b801a1699eeea9418e73) by [@maschad](https://github.com/maschad)) +- Remove copyright notices from iOS application template ([9c3fa57337](https://github.com/facebook/react-native/commit/9c3fa573379bb4824bbe02b5b5aa1ae3502772d8) by [@alloy](https://github.com/alloy)) +- Remove three properties: `textColor`, `font` and `textAlignment` from `RCTBackedTextInputViewProtocol`, unifying the usage into `defaultTextAttributes`. ([aff6bad27c](https://github.com/facebook/react-native/commit/aff6bad27c6c2232ba8bde17823d0a0db4ac589b) by [@jimmy623](https://github.com/jimmy623)) + +### Fixed + +- Add support to render `` with no fixed size nested within a `` ([dbb7eacb42](https://github.com/facebook/react-native/commit/dbb7eacb429adb4160e740017c212bfd6df0f03a) by [@mdvacca](https://github.com/mdvacca)) +- Fixes bug where `` would crash. ([66601e755f](https://github.com/facebook/react-native/commit/66601e755fcad10698e61d20878d52194ad0e90c) by [@TheSavior](https://github.com/TheSavior)) +- Use new `setTextCursorDrawable` API for Android 10 ([e7a14b803f](https://github.com/facebook/react-native/commit/e7a14b803fdc8840bbcde51d4bfa9cf9a85a8472) by [@sturmen](https://github.com/sturmen)) +- Fix `Animated.Value` initialized with undefined in `ScrollView` ([cf02bd9b76](https://github.com/facebook/react-native/commit/cf02bd9b765e29ed8aa2bbf62661e89c84bb80e5) by [@janicduplessis](https://github.com/janicduplessis)) +- Do not explicitly include `.js` in Library imports ([161b910494](https://github.com/facebook/react-native/commit/161b9104941663dcc0b08a73789c0ff3410fc661) by [@NickGerleman](https://github.com/NickGerleman)) +- Fixed `Pressability` to properly fire `onLongPress`. ([5ca1d8f260](https://github.com/facebook/react-native/commit/5ca1d8f260bfb64111a6ba39f76a0a935829c0f2) by [@yungsters](https://github.com/yungsters)) +- Fixed typo from `inly` to `only` inside `Modal.js` library code. ([686d8a57f8](https://github.com/facebook/react-native/commit/686d8a57f889fe74dc1c66566c80f0ed6d677729) by [@Darking360](https://github.com/Darking360)) +- Fix viewability calculations for nested `VirtualizedLists` inside of a parent list's `FooterComponent` ([074a2fab74](https://github.com/facebook/react-native/commit/074a2fab74754c28cba0ccc51552a246a3046501) by [@logandaniels](https://github.com/logandaniels)) +- Fix android `TextInput` transitions ([0a17a4fe56](https://github.com/facebook/react-native/commit/0a17a4fe56ff2cabc3c7d1cc5b34bd3fdd032e59)) +- Remove JS autoFocus implementation ([0569d4c431](https://github.com/facebook/react-native/commit/0569d4c4315d61d2d8f4ab628a54eb1e1db45dc2) by [@janicduplessis](https://github.com/janicduplessis)) +- Check null values in `shouldAnimate` ([3498b3b96b](https://github.com/facebook/react-native/commit/3498b3b96b2e27c7c7f6407b3673b44540871a31) by [@axe-fb](https://github.com/axe-fb)) +- Fix `AccessibilityInfo.isScreenReaderEnabled` mock in Jest setup ([ec3327b61a](https://github.com/facebook/react-native/commit/ec3327b61ab1be3fd1565c8a35fe56747bd9069f) by [@rubennorte](https://github.com/rubennorte)) +- Fix crash when passing invalid UTF-16 data from JSC into native code ([011cf3f884](https://github.com/facebook/react-native/commit/011cf3f88428ca83552d0b51c7c3a0c47b9728e5) by [@motiz88](https://github.com/motiz88)) +- Make `YGValue.h` compile with Clang on Windows ([014bc95135](https://github.com/facebook/react-native/commit/014bc95135a38d65b991509492c0979cfd153e71) by [@christophpurrer](https://github.com/christophpurrer)) +- Fix documentation comments for HermesJS's `Function::callWithThis` method to accurately reflect how `this` is handled. ([399bda5284](https://github.com/facebook/react-native/commit/399bda52840161bf7d30c09eca061b4378b8f6e4) by [@Kronopath](https://github.com/Kronopath)) +- Fix resolving assets outside of the project root ([7deeec7396](https://github.com/facebook/react-native/commit/7deeec73966d84140492c2a767819977318c4d2d) by [@janicduplessis](https://github.com/janicduplessis)) +- Transform empty responses into empty `Blob`s ([9a8c06b502](https://github.com/facebook/react-native/commit/9a8c06b502c774f7a0bff1bdc064fbfe16ca75be) by [@RSNara](https://github.com/RSNara)) +- Fix validation of event mappings for `AnimatedEvent` ([19362f6116](https://github.com/facebook/react-native/commit/19362f6116bad441c5e23f2bab420af78664b3d3) by [@javache](https://github.com/javache)) +- Fix `NativeJSCHeapCapture` ([7e3a43c23d](https://github.com/facebook/react-native/commit/7e3a43c23d028a4481bc455dd28c391a81ff1a94) by [@RSNara](https://github.com/RSNara)) +- Add `AnimationInterpolation` as possible type for toValue ([26e8870fbf](https://github.com/facebook/react-native/commit/26e8870fbf310f0fb438a86cb2fe260f0bc419b9) by [@nabati](https://github.com/nabati)) +- Fix return type of `StyleSheet.create` ([4e71a30969](https://github.com/facebook/react-native/commit/4e71a30969d74073309d0350be55cadb84ae43ff) by [@jbrown215](https://github.com/jbrown215)) +- Adjust HelloWorld-tvOSTests/Info.plist `CFBundleIdentifier` to use `PRODUCT_BUNDLE_IDENTIFIER` ([98ebc1ea25](https://github.com/facebook/react-native/commit/98ebc1ea25102049ec53288a458ff16ed5b4ada0) by [@MoOx](https://github.com/MoOx)) +- Fix bug where if `Error` global is not callable when building an error, jsi will throw a JS exception back to JS code. #158 ([a195447539](https://github.com/facebook/react-native/commit/a1954475394dc03704a2e093e6fc4b48188640fa) by [@mhorowitz](https://github.com/mhorowitz)) +- Fix stylesheet validation for functions with custom prototype methods. ([f464dad5d4](https://github.com/facebook/react-native/commit/f464dad5d4f0fbf1cb23e21d22907ffddeaf97e4)) +- Fix sporadic issue with `onEndReached` called on load when not needed ([8ddf231306](https://github.com/facebook/react-native/commit/8ddf231306e3bd85be718940d04f11d23b570a62) by [@sahrens](https://github.com/sahrens)) +- Correct argument types of `NativeJSDevSupport.onSuccess` ([b42371da5a](https://github.com/facebook/react-native/commit/b42371da5a41916522b569a66c0a126333cf9cac) by [@RSNara](https://github.com/RSNara)) +- Add `URLSearchParams` and `Headers` to eslint globals ([7a13a1a88f](https://github.com/facebook/react-native/commit/7a13a1a88fdf26dca817b76399f1c86a8a05eccb) by [@sonnyp](https://github.com/sonnyp)) +- Export exception classes with default visibility ([84adc85523](https://github.com/facebook/react-native/commit/84adc85523770ebfee749a020920e0b216cf69f8) by [@appden](https://github.com/appden)) +- Add `URL` to eslint globals. ([ff9def41ff](https://github.com/facebook/react-native/commit/ff9def41ff3e7760d076bf1b899583d4b36cba0d) by [@sonnyp](https://github.com/sonnyp)) +- Plumb through memory allocation profiler feature to Chrome Inspector ([ed3054927c](https://github.com/facebook/react-native/commit/ed3054927c30c8823f78026b9c4cb42fbe4f8b00) by [@jbower-fb](https://github.com/jbower-fb)) +- Better monorepo support when building release apk ([a8e85026cf](https://github.com/facebook/react-native/commit/a8e85026cfa60056b1bcbcd39cde789e4d65f9cb) by [@grabbou](https://github.com/grabbou)) +- `LogBox` - Fix dependency cycle ([6ba2aeefa8](https://github.com/facebook/react-native/commit/6ba2aeefa8dfe031bf1dc46dbea29235aec31d61) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Always update background color and bar style on Android status bar ([9457efa84c](https://github.com/facebook/react-native/commit/9457efa84c872f029027cdcfc3bae4f403715e48)) +- Disable accessibility state changes of the focused view for Android API < 21 ([f2d58483c2](https://github.com/facebook/react-native/commit/f2d58483c2aec689d7065eb68766a5aec7c96e97) by [@mdvacca](https://github.com/mdvacca)) + +#### Android specific + +- Gradle release config ([0d1fb458ab](https://github.com/facebook/react-native/commit/0d1fb458ab8027dcfac5f2fa11e8c16d6853c59c) by [@vdmtrv](https://github.com/vdmtrv)) +- Change how `TextInput` responds to `requestFocus` to fix a11y focus issue ([d4a498aba2](https://github.com/facebook/react-native/commit/d4a498aba2d2843e7a741a31b0c91c6a79a7386c) by [@ejanzer](https://github.com/ejanzer)) +- Fixed style in `TextInputTestCase` ([8c493804f3](https://github.com/facebook/react-native/commit/8c493804f3f7b3ae3761679a978971ab9d71baa0) by [@ejanzer](https://github.com/ejanzer)) +- Fix template instacrash from missing androidx dependency ([a1b14deb3e](https://github.com/facebook/react-native/commit/a1b14deb3e32df797aae99a75743a4d283e5337b) by [@alloy](https://github.com/alloy)) +- Implement native `TextInput` `autoFocus` on Android ([055a41b081](https://github.com/facebook/react-native/commit/055a41b081c5bc9535b071d9b4b7488b92e71803) by [@janicduplessis](https://github.com/janicduplessis)) +- Support for case insensitive `Origin` headers for `Websockets` ([aeaf286c77](https://github.com/facebook/react-native/commit/aeaf286c77b50a95c4961de0d2355caad8ffa396) by [@brunobar79](https://github.com/brunobar79)) +- RNTester Buck Build ([a3cb377645](https://github.com/facebook/react-native/commit/a3cb377645f2ccb7632ded73c230a41025d38f6f) by [@passy](https://github.com/passy)) +- Fix bug in updating dimensions in JS ([bef845ffd5](https://github.com/facebook/react-native/commit/bef845ffd521aa83d779de584ec370f9f88f27f3) by [@ejanzer](https://github.com/ejanzer)) +- Applied missing changes from bumping Gradle wrapper to 6.0.1 ([aa0ef15335](https://github.com/facebook/react-native/commit/aa0ef15335fe27c0c193e3e968789886d82e82ed) by [@SaeedZhiany](https://github.com/SaeedZhiany)) +- Unregister `JSDevSupport` from `DebugCorePackage` ([c20963e11c](https://github.com/facebook/react-native/commit/c20963e11cc1c10f20a2a0a3c209f5b403c9e899) by [@RSNara](https://github.com/RSNara)) +- Make sure `ServerHost` is optional in `NativePlatformConstants.js` ([048f88a33a](https://github.com/facebook/react-native/commit/048f88a33a53ebd4e45865b319c42291f1d6c7f2) by [@RSNara](https://github.com/RSNara)) +- Removed code that would cause accessibility header role to be spoken twice ([7428271995](https://github.com/facebook/react-native/commit/7428271995adf21b2b31b188ed83b785ce1e9189) by [@KevinGVargas](https://github.com/KevinGVargas)) +- Fail silently in `AppStateModule.sendEvent` if `CatalystInstance` is not available ([c4806fada6](https://github.com/facebook/react-native/commit/c4806fada6532894e2242cf31f7145d2992e3a2b) by [@JoshuaGross](https://github.com/JoshuaGross)) +- RN `Picker` - fix types in `AndroidDialogPickerManagerInterface` ([56b0f5cb6b](https://github.com/facebook/react-native/commit/56b0f5cb6ba48ecefc2890152ebe88e3df61a0ea)) +- Fix Hermes debugger being disabled by default ([b8621f5d30](https://github.com/facebook/react-native/commit/b8621f5d303442ab78dc5d745cfc86a941d4737c) by [@willholen](https://github.com/willholen)) + +#### iOS specific + +- Fixed connection of metro reload command to iOS device ([f9df93385e](https://github.com/facebook/react-native/commit/f9df93385eee0e1cd1144a65e05410dfb48b119c) by [@reyalpsirc](https://github.com/reyalpsirc)) +- Remove `RCTDevLoadingView` jank ([faff19a7c6](https://github.com/facebook/react-native/commit/faff19a7c651c740d8d649b86727b63b63562b20) by [@RSNara](https://github.com/RSNara)) +- Fix crash when passing null value in object parameter of bridged method ([15434c7c43](https://github.com/facebook/react-native/commit/15434c7c435928a40b9cd66fe9f5d1bcdea8d954)) +- Get ready for Clang 10 ([8721ee0a6b](https://github.com/facebook/react-native/commit/8721ee0a6b10e5bc8a5a95809aaa7b25dd5a6043) by [@maxovtsin](https://github.com/maxovtsin)) +- Fix `RCTBlobManager` cleanup crash ([91c5ff4a12](https://github.com/facebook/react-native/commit/91c5ff4a12982ccead56c9c038761e9316d01409) by [@RSNara](https://github.com/RSNara)) +- Make Lambda function called in `NativeModule` mutable ([5290047d09](https://github.com/facebook/react-native/commit/5290047d09c0a41c85a1d47a638877c226d9c191) by [@maschad](https://github.com/maschad)) +- Fix crash in `RCTCxxBridge.executeApplicationScript` ([0c2db3256f](https://github.com/facebook/react-native/commit/0c2db3256f6cbb3ec564e0f183a52a439ed33f52) by [@ahimberg](https://github.com/ahimberg)) +- Fix `RCTDevLoadingView` `RedBox` on reload ([fe5ac2c3f9](https://github.com/facebook/react-native/commit/fe5ac2c3f9e47cfb7c5820a755a5d74d47624953) by [@RSNara](https://github.com/RSNara)) +- Fix `Image` component crashing when `uri` is `null` ([06b8b15b0a](https://github.com/facebook/react-native/commit/06b8b15b0af84b6f8b44d200dc25f29eac51181c) by [@mlazari](https://github.com/mlazari)) +- Fix `RCTDevLoadingView` not showing up with `UIScene` ([74b667dbc2](https://github.com/facebook/react-native/commit/74b667dbc2a48183dec0b9c3b5401bc3f9e54e7b) by [@tido64](https://github.com/tido64)) +- Prevent interactive dismissal for non-fullscreen modals ([1e7ed81d16](https://github.com/facebook/react-native/commit/1e7ed81d16dda4188352e0ccdc0f0bd3ad4741f3)) +- Resolve localization warnings in template ([0e4bcaa296](https://github.com/facebook/react-native/commit/0e4bcaa2960a2b1aa42dbe716fc6a35652aa7207) by [@safaiyeh](https://github.com/safaiyeh)) +- Implement `requiresMainQueueSetup` in `RCTDevSettings.mm` ([adf87dd7ed](https://github.com/facebook/react-native/commit/adf87dd7eddcf65a3300e6ac9092838d9c8a3279) by [@logandaniels](https://github.com/logandaniels)) +- Resolve `React-RCTText` Xcode warning ([04fed6508b](https://github.com/facebook/react-native/commit/04fed6508b74b23c954183af3f6121fb344d2138) by [@safaiyeh](https://github.com/safaiyeh)) +- Resolve Xcode warnings from `React-cxxreact`. ([dc6c57ce0d](https://github.com/facebook/react-native/commit/dc6c57ce0d4f5424bfb047c51fee18eac381a98b) by [@safaiyeh](https://github.com/safaiyeh)) +- `RCTReconnectingWebSocket` is reconnecting infinitely when stopped before getting connected ([0d4b0e9417](https://github.com/facebook/react-native/commit/0d4b0e941725657d8e63940428888aaceff505ad)) +- Fix prop name of `passwordRules` in `TextInput` ([3f5c42f357](https://github.com/facebook/react-native/commit/3f5c42f357d58268d0a0fd1bfc639f41feab937c) by [@Naturalclar](https://github.com/Naturalclar)) +- Remove need for Swift file in the user’s project in order to use Flipper ([8f93dedc6a](https://github.com/facebook/react-native/commit/8f93dedc6a5653edd2220c65ccb4ff8736ee060c) by [@alloy](https://github.com/alloy)) +- Clear all held `jsi::Functions` when `jsi::Runtime` is deleted ([9ae95582e7](https://github.com/facebook/react-native/commit/9ae95582e792a3dca4487bdce9080c6d874c7dd7) by [@RSNara](https://github.com/RSNara)) +- Make framework builds work again by making `RCTImageLoader` C++ requirement opt-in ([25571ec452](https://github.com/facebook/react-native/commit/25571ec4522931193b41723d3f80b3bced1fca3b) by [@alloy](https://github.com/alloy)) +- Enable dev keyboard shortcuts on Mac Catalyst ([56dfc86d64](https://github.com/facebook/react-native/commit/56dfc86d64a2a1f2ad05239b6d11aacac73cbac9) by [@charpeni](https://github.com/charpeni)) +- Fix `RCTTextView` layout issue that happens on some font with `leading` attribute not equal to zero, which causes wrong base-alignment layout ([5d08aab526](https://github.com/facebook/react-native/commit/5d08aab526b2702b46ff75ea7e943a33aa6df288)) +- Fix LAN instead of Wi-Fi device bundle configuration ([d1e6f8d3c4](https://github.com/facebook/react-native/commit/d1e6f8d3c4de1fbb4bddd5205cd3b35c572b495b) by [@Oleg-E-Bakharev](https://github.com/Oleg-E-Bakharev)) +- Add autorelease pool for each run loop for JS Thread ([948cbfdacc](https://github.com/facebook/react-native/commit/948cbfdacc42f8d2640e69f61df55f6adb823fcf) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fixed bug in implementation of ``'s `selectOnFocus` prop ([e020576b34](https://github.com/facebook/react-native/commit/e020576b34fb6ca6d3f9fe38916844b78a45c0e3) by [@shergin](https://github.com/shergin)) +- `RCTRedBox` doesn't appear in apps implementing `UISceneDelegate` ([d0a32c2011](https://github.com/facebook/react-native/commit/d0a32c2011ca00991be45ac3fa320f4fc663b2e8) by [@tido64](https://github.com/tido64)) +- Fixes the `InputAccessoryView.backgroundColor` prop’s typing to use `ColorValue`. ([a43fd60e18](https://github.com/facebook/react-native/commit/a43fd60e18aff9ee6bcaf8ec576adb8678d5bcf4) by [@alloy](https://github.com/alloy)) +- Fix `Animated` image crash when `CADisplayLink` target in `RCTWeakProxy` is `nil` ([e5a6655e71](https://github.com/facebook/react-native/commit/e5a6655e71d41a58ce0e51d37aa9fb8792e37dd5) by [@p-sun](https://github.com/p-sun)) + +## v0.62.3 + +### Security + +- Update validateBaseUrl to use latest regex ([33ef82ce6d](https://github.com/facebook/react-native/commit/33ef82ce6dfd31e1f990d438c925a0e52723e16b) by [@FBNeal](https://github.com/FBNeal)) + +### Fixed + +#### iOS specific + +- Change autolink to match requirements for FlipperFolly working with Xcode 12.5 ([c6f4611dcb](https://github.com/facebook/react-native/commit/c6f4611dcbfbb64d5b54e242570e2a1acffcabef) by [@kelset](https://github.com/kelset)) +- Change podfile to rely on the autolink-ios rb file ([c4ea556d64](https://github.com/facebook/react-native/commit/c4ea556d64c7fc146d1412548788c48bbcc0f6bb) by [@kelset](https://github.com/kelset)) +- Update detox to work on Xcode 12 ([158b558e50](https://github.com/facebook/react-native/commit/158b558e500576f434dec09417bb02cc0bc53f7a) by [@kelset](https://github.com/kelset)) + +## v0.62.2 + +### Fixed + +- Fix Appearance module when using Chrome Debugger ([f7b90336be](https://github.com/facebook/react-native/commit/f7b90336be25b78935549aa140131d4d6d133f7b) by [@TheSavior](https://github.com/TheSavior)) +- Fix mock for TextInput ([5a3c6faee9](https://github.com/facebook/react-native/commit/5a3c6faee9c44a2d99b13d113c91dbf98990f8af) by [@SergioEstevao](https://github.com/SergioEstevao)) +- Flow errors from YellowBox and BubblingEventHandler ([a049130f34](https://github.com/facebook/react-native/commit/a049130f34be951c9c67d2a472c7eb7f3d08f070) by [@thymikee](https://github.com/thymikee)) + +#### iOS specific + +- Make Vibration library compatible with TurboModules. ([3904228704](https://github.com/facebook/react-native/commit/390422870466beba571dda04f669380e14055056) by [@brunobar79](https://github.com/brunobar79)) +- Exclude Flipper from iOS Release builds ([e5497ca8f6](https://github.com/facebook/react-native/commit/e5497ca8f6e3b240948fdbeef0ac2a710f25bb56) by [@javiercr](https://github.com/javiercr)) +- Fix crash when enabling Performance Monitor on iOS 13.4 ([e2c417f7cf](https://github.com/facebook/react-native/commit/e2c417f7cf5ae7efa5ea1f9644a51c4c706a983f) by [@IjzerenHein](https://github.com/IjzerenHein)) + +## v0.62.1 + +### Fixed + +- Bump CLI to 4.5.1 to improve DX ([eac56b9749](https://github.com/facebook/react-native/commit/eac56b9749ed624275d4190b5e48b775583acb3f) by [@alloy](https://github.com/alloy)) +- Fix a YellowBox regression in v0.62.0 where the Flipper network inspector causes YellowBox to crash the app due to using base64 images. ([227aa96bb2](https://github.com/facebook/react-native/commit/227aa96bb23b6ff20eebbd8a9335fd172ed6005b) by [@rickhanlonii](https://github.com/rickhanlonii)) + +#### Android specific + +- Add new DoNotStrip class to proguard config ([cfcf5eba43](https://github.com/facebook/react-native/commit/cfcf5eba4317f80ef8902463b7c0b2e1e7b534a7) by [@janicduplessis](https://github.com/janicduplessis)) + +#### iOS specific + +- Fix Performance Monitor in dark appearance ([576ddfb3a8](https://github.com/facebook/react-native/commit/576ddfb3a84a5461679959f0d3f229a000dcea8d) by [@gorhom](https://github.com/gorhom)) +- Inverted ScrollViews scroll to their bottom when the status bar is pressed ([7a4753d76a](https://github.com/facebook/react-native/commit/7a4753d76aab1c52a09f26ec6f7fd43a68da8a97) by [@emilioicai](https://github.com/emilioicai)) +- Revert [previous incomplete fix](https://github.com/facebook/react-native/commit/bd2b7d6c0366b5f19de56b71cb706a0af4b0be43) for [an issue](https://github.com/facebook/react-native/issues/26473) with `Modal`’s `onDismiss` prop. ([27a3248a3b](https://github.com/facebook/react-native/commit/27a3248a3b37410b5ee6dda421ae00fa485b525c) by [@grabbou](https://github.com/grabbou)) +- Fix double call to onEndReached in VirtualizedList ([d3658bc2b6](https://github.com/facebook/react-native/commit/d3658bc2b6437e858d3b3f5688277dedbca779b8) by [@MartinSherburn](https://github.com/MartinSherburn)) + +### Changed + +- Update warning message of deprecated imports ([405200e9a9](https://github.com/facebook/react-native/commit/405200e9a930cded47954f374f2a779ec769cd4c) by [@Naturalclar](https://github.com/Naturalclar)) + +## v0.62.0 + +This major release includes Flipper support by default, improved dark mode support, moving Apple TV to [react-native-tvos](https://github.com/react-native-community/react-native-tvos), and more. See the [blog post](https://reactnative.dev/blog/2020/03/26/version-0.62) for all of the highlights. + +This release comes in the midst of a global pandemic. We’re releasing this version today to respect the work of hundreds of contributors who made this release possible and to prevent the release from falling too far behind master. Please be mindful of the reduced capacity of contributors to help with issues and prepare to delay upgrading if necessary. + +If you're upgrading, manual intervention may be required for your app. Please see the [upgrade-helper](https://react-native-community.github.io/upgrade-helper/) for a detailed breakdown of the changes required and see [this issue](https://github.com/react-native-community/releases/issues/179) for known issues. + +One known issue with workaround is regarding Android builds and [APK size increases](https://github.com/facebook/react-native/issues/28330). + +### Breaking + +- React DevTools v4 integration ([92a3c9da0a](https://github.com/facebook/react-native/commit/92a3c9da0a38870a8bad7c91bdc3ddb494f6e5f2) by [@bvaughn](https://github.com/bvaughn)) +- Remove `TextInput`'s `onTextInput` prop ([3f7e0a2c96](https://github.com/facebook/react-native/commit/3f7e0a2c9601fc186f25bfd794cd0008ac3983ab) by [@shergin](https://github.com/shergin)) +- Remove `TextInput`'s `inputView` prop ([1804e7cbea](https://github.com/facebook/react-native/commit/1804e7cbea707a35046118090966a54031edfae8) by [@TheSavior](https://github.com/TheSavior)) +- Animated: Remove `defaultProps` Parameter ([a70987cee2](https://github.com/facebook/react-native/commit/a70987cee24bcd027b9c4a5aa85dfd6a1aab74b3) by [@yungsters](https://github.com/yungsters)) +- Remove `TextInput`'s `selectionState` prop ([2becdfd404](https://github.com/facebook/react-native/commit/2becdfd4041f7f28138ba3a61c03e17c06dc2e50) by [@yungsters](https://github.com/yungsters)) +- Remove support for `framesToPop` ([8bc02fdd52](https://github.com/facebook/react-native/commit/8bc02fdd52124d0a24d96e4a61d7688328ef1660) [cf4d45ec2b](https://github.com/facebook/react-native/commit/cf4d45ec2bcd301be7793d5840de21ec7d02275b) [a483f802fd](https://github.com/facebook/react-native/commit/a483f802fddfd927f2baa0d95e2b4094d452cddd) by [@motiz88](https://github.com/motiz88)) +- Remove `TimePickerAndroid` ([dbf070c51e](https://github.com/facebook/react-native/commit/dbf070c51ecd14127a8317faa75cb661697b5a6b) by [@cpojer](https://github.com/cpojer)) +- Remove `scrollWithoutAnimationTo` from ScrollView ([c7e89909da](https://github.com/facebook/react-native/commit/c7e89909da70ac5290f9971080eb897567db3e43) by [@TheSavior](https://github.com/TheSavior)) +- Bump CLI to ^4.2.x ([be5088401f](https://github.com/facebook/react-native/commit/be5088401fd8e19d57adda42d275cab437448064) by [@alloy](https://github.com/alloy)) - for details on what v4 of the CLI improves on (like monorepo support), please refer to the [dedicated blog post](https://callstack.com/blog/react-native-cli-3-1-0-and-4-0-0-whats-new/) and the [release notes](https://github.com/react-native-community/cli/releases) +- Remove `accessibilityStates` property ([7b35f427fd](https://github.com/facebook/react-native/commit/7b35f427fd66cb0f36921b992095fe5b3c14d8b9) by [@marcmulcahy](https://github.com/marcmulcahy)) +- Upgraded to Hermes 0.4.0. If you're using ProGuard you will need to add the following rule to `proguard-rules.pro`: `-keep class com.facebook.jni.** { *; }` ([ab3c184555](https://github.com/facebook/react-native/commit/ab3c184555e382b8693cbfcdfe01ba89583ee726) by [@willholen](https://github.com/willholen)) + +#### Android specific + +- Fix setting keyboardType from breaking autoCapitalize ([233fdfc014](https://github.com/facebook/react-native/commit/233fdfc014bb4b919c7624c90e5dac614479076f) by [@safaiyeh](https://github.com/safaiyeh)) +- Limit size of video uploaded from camera roll in android (< 100 MB) ([d21f695edf](https://github.com/facebook/react-native/commit/d21f695edf367166a03af4c6e9376cd498b38665)) +- Remove "Reload on JS change" from RN Android ([478df155e7](https://github.com/facebook/react-native/commit/478df155e70a4ce30219adcac6f0801c4e4d10ec) by [@cpojer](https://github.com/cpojer)) + +### Added + +- Add support for Flipper by default ([multiple commits](https://github.com/facebook/react-native/pulls?q=is%3Apr+Flipper+is%3Aclosed)) +- Add `getNativeScrollRef` method to FlatList component ([bde1d63c85](https://github.com/facebook/react-native/commit/bde1d63c853630609b22c87121c125775dd1f5cb) by [@kacieb](https://github.com/kacieb)) +- Add missing accessibility props on Touchables ([8c0c860e38](https://github.com/facebook/react-native/commit/8c0c860e38f57e18296f689e47dfb4a54088c260) by [@xuelgong](https://github.com/xuelgong)) +- Added missing `console` polyfills in release builds. ([b7ab922bb3](https://github.com/facebook/react-native/commit/b7ab922bb3fd4f9f103e583bed9e9295a9521578) by [@yungsters](https://github.com/yungsters)) +- Platform.select now supports native as an option. ([a6fc0898de](https://github.com/facebook/react-native/commit/a6fc0898de990959d201b9665501deda215e41a4) by [@koke](https://github.com/koke)) +- Export the DevSettings module, add `addMenuItem` method ([cc068b0551](https://github.com/facebook/react-native/commit/cc068b055185e6fb7341bf945f69a74ed3ef4814) by [@janicduplessis](https://github.com/janicduplessis)) +- Expose RCTNetworking as a public 'Networking' API ([42ee5ec934](https://github.com/facebook/react-native/commit/42ee5ec93425c95dee6125a6ff6864ec647636aa) by [@adamchel](https://github.com/adamchel)) +- Add `useColorScheme` hook ([51681e80ab](https://github.com/facebook/react-native/commit/51681e80ab0d1efdaba684b626994b694d53d2a5) by [@hramos](https://github.com/hramos)) +- Add `unstable_enableLogBox` ([dd8e5f468a](https://github.com/facebook/react-native/commit/dd8e5f468a29e299647ffbd0887f53afd24936e3) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Expose Hermes Sampling Profiler ([15ecb60d6d](https://github.com/facebook/react-native/commit/15ecb60d6deb96fcb7b0ef70faccd10594ededa3) by [@axe-fb](https://github.com/axe-fb)) +- Add `error-subclass-name` lint rule ([6611c4b8f4](https://github.com/facebook/react-native/commit/6611c4b8f42520add983cc48fe4e14f7a02cc7cf) by [@motiz88](https://github.com/motiz88)) +- Add `HostComponent` to the public API of React Native ([a446a38aaa](https://github.com/facebook/react-native/commit/a446a38aaab5bea2e279f1958cfd90090bfd7e09) by [@TheSavior](https://github.com/TheSavior)) +- Add `RCTExceptionsManager.reportException` ([9a57145f52](https://github.com/facebook/react-native/commit/9a57145f52a03678da02d5d00cbe11eed3f5a0fc) by [@motiz88](https://github.com/motiz88)) +- Add `accessibilityValue` property ([7df3eea1a7](https://github.com/facebook/react-native/commit/7df3eea1a79f12c2dfff1976d0cef605a83232ec) by [@marcmulcahy](https://github.com/marcmulcahy)) +- Add `Appearance` module to expose the user's current Night theme preference ([17862a78db](https://github.com/facebook/react-native/commit/17862a78db59d60fe316961f9111efc330ba2abd) [63fa3f21c5](https://github.com/facebook/react-native/commit/63fa3f21c5ab308def450bffb22054241a8842ef) by [@hramos](https://github.com/hramos)) +- Add `onSlidingComplete` callbacks when sliders adjusted via a11y. ([c7aa6dc827](https://github.com/facebook/react-native/commit/c7aa6dc8270c0eabc913fe6c617c8131e3f4b3c5) by [@marcmulcahy](https://github.com/marcmulcahy)) + +#### Android specific + +- Implement `adjustsFontSizeToFit` on Android ([2c1913f0b3](https://github.com/facebook/react-native/commit/2c1913f0b3d12147654501f7ee43af1d313655d8) by [@janicduplessis](https://github.com/janicduplessis)) +- Allow overriding `EditText` construction in `ReactTextInputShadowNode` ([a5b5d1a805](https://github.com/facebook/react-native/commit/a5b5d1a805a9c54d325763b432be1cf2c8811dc9) by [@mchowning](https://github.com/mchowning)) +- Add Android support for `fontVariant` prop ([c2c4b43dfe](https://github.com/facebook/react-native/commit/c2c4b43dfe098342a6958a20f6a1d841f7526e48) by [@mcuelenaere](https://github.com/mcuelenaere)) +- Custom entry file on android using `ENTRY_FILE` environment variable ([a0d8740878](https://github.com/facebook/react-native/commit/a0d87408782fcf191988612198493d9130736c72)) +- Added `statusBarTranslucent` prop to Modal component ([c35a419e5d](https://github.com/facebook/react-native/commit/c35a419e5d2eca4fe9cd0939df085088fa88423b) by [@pfulop](https://github.com/pfulop)) +- Add `fadingEdgeLength` prop to FlatList and ScrollView ([51aacd5241](https://github.com/facebook/react-native/commit/51aacd5241c4b4c0b9b1e1b8f9dabac45e5b5291)) +- Support `removeClippedSubviews` for horizontal ScrollViews ([42152a3fa3](https://github.com/facebook/react-native/commit/42152a3fa3f949f5112461753eb44a436355dfb1)) +- Introducing `ReactCallerContextFactory` interface ([9713b63d9a](https://github.com/facebook/react-native/commit/9713b63d9ac1e1ae85accd86b78b351ac6295d01) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific + +- Added web socket support for macOS ([f21fa4ecb7](https://github.com/facebook/react-native/commit/f21fa4ecb73551bdc4c3d70db9fc13e93b19b3a6) by [@andymatuschak](https://github.com/andymatuschak)) +- Added Warning message Linking API with Phones in iOS Simulator ([e1d89fbd9d](https://github.com/facebook/react-native/commit/e1d89fbd9df91679ec36e955a3d0f699c2d5e777) by [@espipj](https://github.com/espipj)) +- Added missing deps for React-CoreModules ([15b2353382](https://github.com/facebook/react-native/commit/15b2353382c46dc5f0130ff44b9deb6a2361e3e5) by [@fkgozali](https://github.com/fkgozali)) +- Expose the `isPackagerRunning` methods on RCTBundleURLProvider ([fe9cba74fa](https://github.com/facebook/react-native/commit/fe9cba74fa6241b4c38a3df9481d3634ebd51bf9) by [@afoxman](https://github.com/afoxman)) +- Add `autoFocus` to TextInput ([6adba409e6](https://github.com/facebook/react-native/commit/6adba409e6256fd2dcc27a4272edcedae89927af) by [@janicduplessis](https://github.com/janicduplessis)) + +### Changed + +- Upgrade metro version to 0.56.3 ([4b487ba500](https://github.com/facebook/react-native/commit/4b487ba50025becb6a83c805b99d45651db6b8c1) by [@EssamEmad](https://github.com/EssamEmad)) +- Upgrade `eslint-plugin-relay` to 1.3.12 ([f0bcfbe9be](https://github.com/facebook/react-native/commit/f0bcfbe9be0eb6a06d096a682717a23e43c39d52) by [@jstejada](https://github.com/jstejada)) +- Upgrade to Flow v0.108.0 ([d34bc5fa64](https://github.com/facebook/react-native/commit/d34bc5fa64a54dfc2e780461ee2997a4b17f8c65) by [@mvitousek](https://github.com/mvitousek)) +- Upgrade metro babel preset ([cef001713f](https://github.com/facebook/react-native/commit/cef001713fc6384353bbcb4d45645ceee44ed1a9) by [@alloy](https://github.com/alloy)) +- TextInput now properly sends native the end selection location on change ([dff490d140](https://github.com/facebook/react-native/commit/dff490d140010913d3209a2f3e987914b9c4eee4) by [@TheSavior](https://github.com/TheSavior)) +- TextInput now uses `forwardRef` allowing it to be used directly by new APIs requiring a host component. ([bbc5c35a61](https://github.com/facebook/react-native/commit/bbc5c35a61cd3af47ccb2dc62430e4b6a4d4e08f) by [@TheSavior](https://github.com/TheSavior)) +- TextInput no longer does an extra round trip to native on focus/blur ([e9b4928311](https://github.com/facebook/react-native/commit/e9b4928311513d3cbbd9d875827694eab6cfa932) by [@TheSavior](https://github.com/TheSavior)) +- Render collapsed JavaScript frames in RedBox ([468d1a2d2e](https://github.com/facebook/react-native/commit/468d1a2d2e6c72d7c6d435ecaad8499997584de6) by [@motiz88](https://github.com/motiz88)) +- Enable `no-useless-escape` lint rule ([90977b0e00](https://github.com/facebook/react-native/commit/90977b0e00acc6b3263502017c27094392e89478) by [@motiz88](https://github.com/motiz88)) +- Update `DevSettings.reload` to accept a reason ([549cac63cb](https://github.com/facebook/react-native/commit/549cac63cb252037f73453c5d4e7ae5f15586607) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Move `react-native-implementation.js` to `index.js` ([e54ecf907e](https://github.com/facebook/react-native/commit/e54ecf907e9f0660d05dc807ec0e67127143ebed) by [@cpojer](https://github.com/cpojer)) +- Delete Long Press Error in Touchable ([9a3d722ccb](https://github.com/facebook/react-native/commit/9a3d722ccb523f227ffd7770a809996e6cfe75d9) by [@yungsters](https://github.com/yungsters)) +- Add Intl to eslint globals. ([f6a62f9ae2](https://github.com/facebook/react-native/commit/f6a62f9ae2278c0f3a1e5c1a6ec3b7cca3421a41)) +- Add WebSocket to eslint globals ([af8ea06bb4](https://github.com/facebook/react-native/commit/af8ea06bb44e84ce51d4ca4e76f0d66bf34323bd) by [@dr2009](https://github.com/dr2009)) +- Change default `accessibilityRole` of Switch component from `button` to `switch` ([36672c3851](https://github.com/facebook/react-native/commit/36672c3851a044a1ab0edcfaa2790c02f7909695) by [@alvinmatias69](https://github.com/alvinmatias69)) + +#### Android specific + +- Bump gradle-download-task to 4.0.2 ([088be260b6](https://github.com/facebook/react-native/commit/088be260b6727ba82167fe58cb1ee4410a6920b2) by [@dulmandakh](https://github.com/dulmandakh)) +- Bump Gradle to 6.0.1 ([701e66bde4](https://github.com/facebook/react-native/commit/701e66bde4ea0e404626c7805e2bcdfa0c129c05) by [@dulmandakh](https://github.com/dulmandakh)) +- Bump Gradle wrapper 5.6.4 ([928f4434b9](https://github.com/facebook/react-native/commit/928f4434b9829c90098b1626b03938d932a9c1f6) by [@friederbluemle](https://github.com/friederbluemle)) +- Bump Soloader to 0.8.0 ([614039834b](https://github.com/facebook/react-native/commit/614039834bf255de096f8b1d168832f81b0cf3fa)) +- Update Android Gradle plugin to 3.5.2 ([b41b5ce8ae](https://github.com/facebook/react-native/commit/b41b5ce8ae2902169ae58860da2c70a9233bea53) by [@friederbluemle](https://github.com/friederbluemle)) +- Improve exception message when JSC loading fails ([65d3167a80](https://github.com/facebook/react-native/commit/65d3167a802b2ca04d4f05ff972c2d51765f1e0d) by [@mhorowitz](https://github.com/mhorowitz)) +- Expose `addCookies` method ([cc845ccfb4](https://github.com/facebook/react-native/commit/cc845ccfb4c0f841b876bca55c5f70efd72be538) by [@safaiyeh](https://github.com/safaiyeh)) +- Migrated from libfb to libfbjni for JNI calls ([9ad5e72b77](https://github.com/facebook/react-native/commit/9ad5e72b77013083f925108870ea6b17f4711a1d) by [@passy](https://github.com/passy)) +- Formatted cpp/h code with clang-format ([d5ba113bb2](https://github.com/facebook/react-native/commit/d5ba113bb2cd839ea38768785e527fbbc9636e41) by [@passy](https://github.com/passy)) +- Switch MainActivity launchMode to singleTask ([7a42596438](https://github.com/facebook/react-native/commit/7a42596438018129d52ff04899ab4ddabd27cdcb) by [@dulmandakh](https://github.com/dulmandakh)) +- Changing method signatures for ImageLoaderModule to accept double for requestId ([641e9657dd](https://github.com/facebook/react-native/commit/641e9657ddab5d1b2676e98d86fd369372281d2c) by [@ejanzer](https://github.com/ejanzer)) +- Use Node's module resolution algorithm to find JSC & Hermes ([fc25f288fe](https://github.com/facebook/react-native/commit/fc25f288fe553cb7e8f04b8ce4b56297b7fa40d5) by [@ide](https://github.com/ide)) +- Add `ACCESS_BACKGROUND_LOCATION` to PermissionsAndroid ([8c099b5f53](https://github.com/facebook/react-native/commit/8c099b5f53405fe0806113ca7ccf0bbe1af92a21) by [@dulmandakh](https://github.com/dulmandakh)) + +#### iOS specific + +- Add `xcscheme` files for iOS template back in. ([a715decd2d](https://github.com/facebook/react-native/commit/a715decd2d3bcdab9537f3246c8398ad9869e94e) by [@pvinis](https://github.com/pvinis)) + +### Deprecated + +- Add deprecation warning to `AccessibilityInfo.fetch` ([523ab83338](https://github.com/facebook/react-native/commit/523ab8333800afbfb169c6fd70ab6611fe07cc2a) by [@TheSavior](https://github.com/TheSavior)) +- Make setting `useNativeDriver` required. Add runtime warning if not specified ([5876052615](https://github.com/facebook/react-native/commit/5876052615f4858ed5fc32fa3da9b64695974238) by [@TheSavior](https://github.com/TheSavior)) +- Refs on an Animated component are now the internal component. The `getNode` call has been deprecated. ([66e72bb4e0](https://github.com/facebook/react-native/commit/66e72bb4e00aafbcb9f450ed5db261d98f99f82a) by [@yungsters](https://github.com/yungsters)) + +#### iOS specific + +- Deprecate `[bridge reload]`, prefer `RCTReloadCommand` ([ffe2306164](https://github.com/facebook/react-native/commit/ffe2306164ed7edfe5ab9d75b5122791037a852a) by [@PeteTheHeat](https://github.com/PeteTheHeat)) + +#### Android specific + +- Deprecate `CallerContext` from `ReactImageManager` ([8accd77c45](https://github.com/facebook/react-native/commit/8accd77c45a4b051bf02904c3485d6a0dcd27631) by [@mdvacca](https://github.com/mdvacca)) + +### Removed + +- Removing experimental `IncrementalPresenter` component ([0ef0d3167e](https://github.com/facebook/react-native/commit/0ef0d3167e291f31ce01ceb729df77cc679d2330) by [@TheSavior](https://github.com/TheSavior)) +- TouchableWithoutFeedback no longer exports Props. Use React.ElementConfig, instead. ([7bcae81299](https://github.com/facebook/react-native/commit/7bcae812997f669de5803cc781dcf3ea65baf0e9) by [@yungsters](https://github.com/yungsters)) +- Remove `Sample` and `CrashyCrash` Modules ([8ec7e0966c](https://github.com/facebook/react-native/commit/8ec7e0966cf83ed29a39aab47c686bc60a124983) by [@RSNara](https://github.com/RSNara)) +- Remove `propTypes` from Animated components. ([86d90c03eb](https://github.com/facebook/react-native/commit/86d90c03ebe39ebc4b2c6dcc0747b4f3a34f5f2f) by [@yungsters](https://github.com/yungsters)) +- Remove `propTypes` from TouchableHighlight. ([7c01172bef](https://github.com/facebook/react-native/commit/7c01172befd07f1d082b18993b87fc880e4b718f) by [@yungsters](https://github.com/yungsters)) +- Remove `propTypes` from TouchableNativeFeedback. ([2185dd298a](https://github.com/facebook/react-native/commit/2185dd298a788c2b713ea17878fd36e06205b4da) by [@yungsters](https://github.com/yungsters)) +- Remove `propTypes` from TouchableOpacity. ([88ae24f719](https://github.com/facebook/react-native/commit/88ae24f719d365b004696aff6461535188ca9f41) by [@yungsters](https://github.com/yungsters)) +- Remove `propTypes` from TouchableWithoutFeedback. ([ebf7d75816](https://github.com/facebook/react-native/commit/ebf7d758164873169937321a4dccc3782359a0d3) by [@yungsters](https://github.com/yungsters)) +- Remove `__skipSetNativeProps_FOR_TESTS_ONLY` from Animated components. ([dcd63078bd](https://github.com/facebook/react-native/commit/dcd63078bdab864830168005b940f638f1e08b23) by [@yungsters](https://github.com/yungsters)) +- Remove Apple TV Props ([548aad4ff1](https://github.com/facebook/react-native/commit/548aad4ff1dfef0d71bdd39aa83ad71e522a2546) by [@yungsters](https://github.com/yungsters)) + +#### Android specific + +- Remove `NativeRunnableDeprecated` ([973253af8a](https://github.com/facebook/react-native/commit/973253af8a47d9ebd137f554054e7a95f8ef2e45) by [@passy](https://github.com/passy)) +- Remove `com.facebook.react.modules.debug.NativeSourceCodeSpec` ([4d9e5f8481](https://github.com/facebook/react-native/commit/4d9e5f8481531000380cf4d3d485fcde1321a37b) by [@RSNara](https://github.com/RSNara)) + +### Fixed + +- Fix `require` cycle warning in ScrollResponder. ([674ac69cee](https://github.com/facebook/react-native/commit/674ac69cee7c1ce6096bee258880e79966322ee0) by [@Naturalclar](https://github.com/Naturalclar)) +- Restore behavior for `underlayColor={null}` in `TouchableHighlight`. ([37d8440a8e](https://github.com/facebook/react-native/commit/37d8440a8e35a53b81914e429502db527790b3cd) by [@yungsters](https://github.com/yungsters)) +- Fix stack traces showing the wrong function name in some cases ([60b4ba16c0](https://github.com/facebook/react-native/commit/60b4ba16c008c23959ebd27ea7215f83878d1343) by [@motiz88](https://github.com/motiz88)) +- Fix `requestAnimationFrame` when focusing input on mount ([5798cf2aa9](https://github.com/facebook/react-native/commit/5798cf2aa9b86bbcb40016aae14eca88fca19fde) by [@janicduplessis](https://github.com/janicduplessis)) +- Reduce overhead of setting up timers in DEV ([75a154b449](https://github.com/facebook/react-native/commit/75a154b4499e44b4ab31ccf28f9eb1dbf21578ac) by [@motiz88](https://github.com/motiz88)) +- Fixed an issue where margin and padding were resolved incorrectly. ([1d683faf1d](https://github.com/facebook/react-native/commit/1d683faf1dc89e4950e7e1f5c5a67f9a7ca1ee24) by [@SidharthGuglani](https://github.com/SidharthGuglani)) +- Fix using width for calculating margin top percent ([0599af2282](https://github.com/facebook/react-native/commit/0599af2282ffbf636604bce1cb4c049201fed393) by [@SidharthGuglani](https://github.com/SidharthGuglani)) +- Don't restore default values in NativeAnimated when components unmount ([686ab49107](https://github.com/facebook/react-native/commit/686ab49107df8ed20d4e810f1366715cd70b4a31) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix eslint-config peer dependency warnings ([1353da5a53](https://github.com/facebook/react-native/commit/1353da5a538d4a6f76fc9530711394cf981034a0) by [@friederbluemle](https://github.com/friederbluemle)) +- Remove style rules from eslint config for prettier options ([e4b62bb139](https://github.com/facebook/react-native/commit/e4b62bb139c258b65a9ebf2a8ee692ea52c3afab) by [@iRoachie](https://github.com/iRoachie)) +- Fix separators displays in wrong places with the inverted list ([dfb4f4af68](https://github.com/facebook/react-native/commit/dfb4f4af68726d2e05f63689a9c74c9bb9a0611b) by [@dy93](https://github.com/dy93)) +- Fix issue where we attempt to connect to React devtools every 2 seconds ([e7f6210d5d](https://github.com/facebook/react-native/commit/e7f6210d5d417c5b6d4ba7f5cf96b40dbf70b9cd) by [@ejanzer](https://github.com/ejanzer)) +- Fix so that early logs don't get dropped by Metro ([4ed05ca241](https://github.com/facebook/react-native/commit/4ed05ca241b791ad629fd154429a4a53c7731556) by [@gaearon](https://github.com/gaearon)) +- Fix to announce accessibility state changes happening in the background ([baa66f63d8](https://github.com/facebook/react-native/commit/baa66f63d8af2b772dea8ff8eda50eba264c3faf) by [@xuelgong](https://github.com/xuelgong)) +- Fix `JSBigString` not compiling on Windows due to Unix-specific headers ([80857f295c](https://github.com/facebook/react-native/commit/80857f295c17e5f8966b3d1c1207d3c4570a1b26) by [@empyrical](https://github.com/empyrical)) +- Fix exception in `scrollResponderScrollNativeHandleToKeyboard` when ref is null ([da8ae011bb](https://github.com/facebook/react-native/commit/da8ae011bbabc8acb7ef7f6903f68dd60aaa1f9d) by [@TheSavior](https://github.com/TheSavior)) +- Fix excessive toggles on the Switch component ([b782934f3f](https://github.com/facebook/react-native/commit/b782934f3f2a80ae7e3872cc7d7a610aa6680ec4) by [@rurikoaraki](https://github.com/rurikoaraki)) +- Fix bare hosts in `URL`. Add missing / between url ([20ab946f34](https://github.com/facebook/react-native/commit/20ab946f34b1d9727ff08c733b2006e84fd79349) by [@jeswinsimon](https://github.com/jeswinsimon)) +- Fix the non-standard usage of `ATOMIC_VAR_INIT` macro from code with systrace enabled ([75a7a52db4](https://github.com/facebook/react-native/commit/75a7a52db496bd3892a367372eea25bf50840fc3)) +- Fix `useWindowDimensions` hook firing continuously after dimensions change ([3b3c95b017](https://github.com/facebook/react-native/commit/3b3c95b0170e60983eb6e89b910d100d08eee141) by [@dulmandakh](https://github.com/dulmandakh)) +- Fix throttling in ScrollView ([4159e20146](https://github.com/facebook/react-native/commit/4159e201462c346c456de1fa869d88a9cce7b6d4) by [@sammy-SC](https://github.com/sammy-SC)) +- Fix `TimingAnimation` rounding error issue ([77b6e26538](https://github.com/facebook/react-native/commit/77b6e2653835af61b186903eae45d67f35351ade) by [@MartinSherburn](https://github.com/MartinSherburn)) +- Fix recycling of Switch ([a261e6dfb2](https://github.com/facebook/react-native/commit/a261e6dfb2680a955943db53c4b0a7bb887bfe22) by [@sammy-SC](https://github.com/sammy-SC)) + +#### Android specific + +- Fix to reset sMatrixDecompositionContext before applying transformations ([bf01dfbc97](https://github.com/facebook/react-native/commit/bf01dfbc97ea8be9d88214ab31809f2f42d6c064) by [@makovkastar](https://github.com/makovkastar)) +- Fix animations in OSS debug builds by modifying `Platform.isTesting()` behavior ([1fbc6a7c17](https://github.com/facebook/react-native/commit/1fbc6a7c178d13421b0b84d6ea01f9174105325f) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix Modal not disappearing when reloading ([5ddf00ee1a](https://github.com/facebook/react-native/commit/5ddf00ee1acbf66c7204227c398a58c13e4545cf) by [@sunnylqm](https://github.com/sunnylqm)) +- Fix to support nullable returns NativeModule methods returning Boxed Primitives ([f57b0caaa4](https://github.com/facebook/react-native/commit/f57b0caaa4452c64006c159cd28a1a562b332c21) by [@RSNara](https://github.com/RSNara)) +- Fix crash in TextInput ([6ebd3b046e](https://github.com/facebook/react-native/commit/6ebd3b046e5b71130281f1a7dbe7220eff95d74a) by [@MarcoPolo](https://github.com/MarcoPolo)) +- Fix View.getGlobalVisibleRect() to clip result rect properly when overflow is 'hidden' ([df9abf7983](https://github.com/facebook/react-native/commit/df9abf798351c43253c449fe2c83c2cca0479d80) by [@davidbiedenbach](https://github.com/davidbiedenbach)) +- Fix throwing "Unknown array type" exception ([4b9350061f](https://github.com/facebook/react-native/commit/4b9350061fa3d186fdd3a973e1b46f60a7ac03b9) by [@petterh](https://github.com/petterh)) +- Fix issue with refresh control not working properly on an inverted ScrollView ([0a282c42b4](https://github.com/facebook/react-native/commit/0a282c42b4d1c2316513cd5588a0a92b54db2991) by [@migbot](https://github.com/migbot)) +- Fix to listen to NFC actions for linking url events ([8d8c3d4e1e](https://github.com/facebook/react-native/commit/8d8c3d4e1eb88366074e87385c4d96a46dfdd544) by [@cimitan](https://github.com/cimitan)) +- Fix onPress prop for Touchable Components being called twice on AndroidTV. ([21890e964d](https://github.com/facebook/react-native/commit/21890e964df7674fcf13cefc8cb939441f6eddef) by [@dbarr33](https://github.com/dbarr33)) +- Fix `includeFontPadding` for `TextInput` placeholder ([211ea485cd](https://github.com/facebook/react-native/commit/211ea485cd993ca25d6640be41e54f327ca1629c) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix medium font weights for TextInput on Android ([8b9f790069](https://github.com/facebook/react-native/commit/8b9f7900697b2e4bb72b37ed2e6c3d113185d327) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix close button issue in KeyboardAvoidingView ([f1c6029e48](https://github.com/facebook/react-native/commit/f1c6029e4868084e5a10d81c15ee3cc5e301599a) by [@saxenanickk](https://github.com/saxenanickk)) +- Fix activity recreation on theme change ([83a16b16c9](https://github.com/facebook/react-native/commit/83a16b16c9afa0fe0328ab818470d4fce098876b) by [@Esemesek](https://github.com/Esemesek)) +- Fix ForwardingCookieHandler missing WebView exceptions. ([314eba98b2](https://github.com/facebook/react-native/commit/314eba98b2f2755cb26ed7a268d3fe83a7626efa) by [@siddhantsoni](https://github.com/siddhantsoni)) +- Fix ReactInstanceManagerBuilder.build crashing if SoLoader has not been explicitly initialized ([60e00d9d96](https://github.com/facebook/react-native/commit/60e00d9d96d7b186c1d4c1542caddc1b74eeb3da) by [@petterh](https://github.com/petterh)) +- Fix default accessibility hint not being read. ([f8dff0bcb3](https://github.com/facebook/react-native/commit/f8dff0bcb3147b7a1aa8ac7159952d848e198e29)) +- Fix JS bundle loading progress bar ([7b9d6d19e2](https://github.com/facebook/react-native/commit/7b9d6d19e2c0854aa53587ef68ce715fb7803e2a) by [@makovkastar](https://github.com/makovkastar)) +- Fix Android Q related NaN error - don't try to do math with NaN values ([db5994980d](https://github.com/facebook/react-native/commit/db5994980df136c5cce6cd90348b4bf18180562f)) +- Fix throwing exceptions when the host activity is not FragmentActivity ([7cfabf42b8](https://github.com/facebook/react-native/commit/7cfabf42b816de758d8e52896bbab0c50e3a802a) by [@mganandraj](https://github.com/mganandraj)) +- Fix crash when using `TextInput.FontVariant` prop in Android API level < 26 ([e885ddedb9](https://github.com/facebook/react-native/commit/e885ddedb9b0a025cb8031414dcc4bd22744a0eb) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific + +- Fix support for `onRequestClose` in Modal on iOS 13+ ([8e5fac89bb](https://github.com/facebook/react-native/commit/8e5fac89bbdcc3028bb5d81a358969a235abf991) by [@koke](https://github.com/koke)) +- Fix `Dimensions` module to update on initial split screen ([7a72c35a20](https://github.com/facebook/react-native/commit/7a72c35a20a18c19bf6ab883cb2c53a85bd4c5c0) by [@sahrens](https://github.com/sahrens)) +- Fix spinner visibility on `beginRefreshingProgrammatically` ([e341489521](https://github.com/facebook/react-native/commit/e341489521ad495e68e8aba01ff4dd25a5e4ff3e) by [@nnabinh](https://github.com/nnabinh)) +- Reconnect to debugger websocket after Metro is restarted. ([13992f90e4](https://github.com/facebook/react-native/commit/13992f90e48fc11e0b7217ee6d9413f97c32268a) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Fix Slider not disabling properly if the disabled prop is set. ([fa9ff07017](https://github.com/facebook/react-native/commit/fa9ff07017edbc76595fe2f2d964ee13c5f4088a)) +- Fix apps crashing on iOS 13.x when running timer in the background ([e1d03b4cc0](https://github.com/facebook/react-native/commit/e1d03b4cc00c361e10687eb4a9f902563cd1cbe1) by [@radko93](https://github.com/radko93)) +- Fix TextInput blur when tabbing in iOS simulator. ([a7437710d2](https://github.com/facebook/react-native/commit/a7437710d25adfc9150fc079e4525ed59d5404e2) by [@fat](https://github.com/fat)) +- Fix promised returned by `Share.share(content, options)` not resolving if share dialog dismissed ([7468a6c903](https://github.com/facebook/react-native/commit/7468a6c9033ffe8cc2315a3de3a759b8745fe43d) by [@v-fernandez](https://github.com/v-fernandez)) +- Fix maximum searching depth while measuring layout by removing it. ([2f8328dbb0](https://github.com/facebook/react-native/commit/2f8328dbb0d9813c904c0b888b2b7500cf4a4bce) by [@draws](https://github.com/dratwas)) +- Fix SafeAreaInsets call to not crash on older versions of iOS ([03acf57b76](https://github.com/facebook/react-native/commit/03acf57b767553acbee4ff589055fbd239ffffbb) by [@mmmulani](https://github.com/mmmulani)) +- Fix to retain `cropData` struct arg in ImageEditingManager.cropImage call ([002d3c179d](https://github.com/facebook/react-native/commit/002d3c179dd2515f0a4d894d9b7f70c4e538f728) by [@RSNara](https://github.com/RSNara))) +- Fix bug rendering nested text on iOS13 ([06599b3e59](https://github.com/facebook/react-native/commit/06599b3e594355a1d5062ede049ff3e333285516) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix longstanding bug where RCTNullIfNil() can return nil ([79b573511b](https://github.com/facebook/react-native/commit/79b573511bd55e6c82c0044e1930549ccfa8a923) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix crash in RCTScrollViewComponentView ([e7ef9921d3](https://github.com/facebook/react-native/commit/e7ef9921d3f91b02cfec4bbfd88b4968434e201c) by [@shergin](https://github.com/shergin)) +- Fix how the amount of free memory is calculated to mimic the logic Apple uses. ([b53d3d80f9](https://github.com/facebook/react-native/commit/b53d3d80f991937915a87ba8515f403551de139e)) +- Fix animated gifs incorrectly looping ([6f2e6f170e](https://github.com/facebook/react-native/commit/6f2e6f170e3ee785d1ba844971447ea24f91185e) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix `tintColor` in SegmentedControlIOS component ([be89e4d928](https://github.com/facebook/react-native/commit/be89e4d928a504de304f5afb19bd3cc15ae3eb7d) by [@sammy-SC](https://github.com/sammy-SC)) + +## v0.61.5 + +This is a patch release that consist of a few commits requested in the [dedicated conversation](https://github.com/react-native-community/releases/issues/151) to improve the quality of the 0.61 release. Thanks to everyone who contributed! + +### Fixes + +#### Android specific + +- Fix bundling assets in monorepo ([a3b0804867](https://github.com/facebook/react-native/commit/a3b08048674e324dbe1f0ca816f35607e9e06a2f) by [@Esemesek](https://github.com/Esemesek)) +- Fix multiple `set-cookie` not aggregated correctly in response headers ([1df8bd4932](https://github.com/facebook/react-native/commit/1df8bd4932f42958c01dccf44cee92b75a6988ed) by **Vincent Cheung**) + +## v0.61.4 + +This is a patch release that consist of a few commits requested in the [dedicated conversation](https://github.com/react-native-community/releases/issues/150) to improve the quality of the 0.61 release. Thanks to everyone who contributed! + +### Fixed + +- Fix build with Hermes on Windows ([81a6b6ed3c](https://github.com/facebook/react-native/commit/81a6b6ed3c54498f6f2148c106846352405949bf) by [@B27](https://github.com/B27)) +- Fix Chrome debugger showing console.logs at incorrect locations ([42ac240bce](https://github.com/facebook/react-native/commit/42ac240bceb104474494c6007df0089baec00f7a) by [@rickhanlonii](https://github.com/rickhanlonii)) + +#### iOS specific + +- Fix bug in iOS 13 when application would be terminated immediately when in background ([d7c9173b07](https://github.com/facebook/react-native/commit/d7c9173b07171164bcadf73855454e90e07b31be) by [@radko93](https://github.com/radko93)) + +## v0.61.3 + +This is a patch release that consist of a few commits requested in the [dedicated conversation](https://github.com/react-native-community/releases/issues/148) to improve the quality of the 0.61 release. Thanks to everyone who contributed! + +### Fixed + +- Fix bug where ScrollView contentInset top set to undefined wouldn't default to 0 ([d576a5bcc0](https://github.com/facebook/react-native/commit/d576a5bcc0e03dd9c4ccd982f723d6e376e5b680) by [TheSavior](https://github.com/TheSavior)) +- Fix TimingAnimation rounding error issue ([bfd01552af](https://github.com/facebook/react-native/commit/bfd01552af6c074a425da2e7cc1a5908faba2644) by [MartinSherburn](https://github.com/MartinSherburn)) + +#### iOS specific + +- Fix selecting videos from library in iOS 13 ([63769518e0](https://github.com/facebook/react-native/commit/63769518e0c7db60eb39bb5f47fe24f4bc664862) by [fatalsun](https://github.com/fatalsun)) +- Fix bug in iOS13 nested text rendering ([7cf43afa8d](https://github.com/facebook/react-native/commit/7cf43afa8d6a03ccb4cfdc09f81891eabe8b8b70) by [PeteTheHeat](https://github.com/PeteTheHeat)) + +#### Android specific + +- Release underlying resources when JS instance is GC'ed on Android try ([9b2374b542](https://github.com/facebook/react-native/commit/9b2374b542f87b7baefcfb4a3eb4f57029069b57) by [janicduplessis](https://github.com/janicduplessis)) + +## v0.61.2 + +This is a patch release that consist of a few commits requested in the [dedicated conversation](https://github.com/react-native-community/releases/issues/146) to improve the quality of the 0.61 release. Thanks to everyone who contributed! + +### Fixed + +#### Android specific + +- Fix elevation issues on Android ([8fd9ab2f54](https://github.com/facebook/react-native/pull/26682) by [@grabbou](https://github.com/grabbou)) + +### Added + +- Use `warnOnce` for excessive number of callbacks error ([0cafa0f5d1](https://github.com/facebook/react-native/commit/0cafa0f5d1e7fa5369b765f4b97f38bf1608230a) by [@janicduplessis](https://github.com/anicduplessis)) +- Include transform in OUTER_PROPS ([b94438](https://github.com/facebook/react-native/commit/b94438) by [@migbot](https://github.com/migbot)) + +#### iOS specific + +- Better iOS13 support in `StatusBar` API ([796b3a1f88](https://github.com/facebook/react-native/commit/796b3a1f8823c87c9a066ea9c51244710dc0b9b5) by [@gaodeng](https://github.com/gaodeng)) + +#### Android specific + +- Improve error message in NativeModuleRegistryBuilder ([113c4e229c](https://github.com/facebook/react-native/commit/113c4e229c374232c46a89afd74df7117a3447c1) by [@vonovak](https://github.com/vonovak)) + +## v0.61.1 + +This is a patch release that consist of a few commits requested in the [dedicated conversation](https://github.com/react-native-community/releases/issues/144) to improve the quality of the 0.60 release. Thanks to everyone who contributed! + +### Fixed + +#### iOS specific + +- Fix ShareSheet crash on iOS 13 ([a4fbb8e75b](https://github.com/facebook/react-native/commit/a4fbb8e75bd9f521037926a68a8b75eaca2eca74) by [@tomtargosz](https://github.com/tomtargosz)) + +#### Android specific + +- Allow again for injecting custom root view via ReactActivityDelegate ([9f0dede1c9](https://github.com/facebook/react-native/commit/9f0dede1c913612e1241432f4cbccdc74d23a1e4) by [@kmagiera](https://github.com/kmagiera)) + +## v0.61.0 + +This is a major release that includes the new reloading experience Fast Refresh. It also removes the React `.xcodeproj`, fixes `use_frameworks!` for CocoaPods support, adds a `useWindowDimensions` hook, and upgrades to React 16.9. + +### Added + +- Add Fast Refresh by default ([17f8e5810f](https://github.com/facebook/react-native/commit/17f8e5810f3260ce1b24c61665883bab8847aabe) by [@gaearon](https://github.com/gaearon)) +- Add `useWindowDimensions` hook to replace most `Dimensions` usage ([103ec2f770](https://github.com/facebook/react-native/commit/103ec2f770dbb785ef4bc26f8662c74edded796a) by [@sahrens](https://github.com/sahrens)) + +#### Android specific + +- Add exception in .gitignore for `debug.keystore` to the android template. ([d55025694b](https://github.com/facebook/react-native/commit/d55025694be8b4ee5d09c8fdc910d42a5f144883) by [@bondehagen](https://github.com/bondehagen)) +- Add jitpack repository to template ([1a92cf9b2a](https://github.com/facebook/react-native/commit/1a92cf9b2afa718a81299b4be5ab6bdff16f4863) by [@iyegoroff](https://github.com/iyegoroff)) + +#### iOS specific + +- Add RCTWeakProxy to properly deallocate RCTUIImageViewAnimated ([947e71a922](https://github.com/facebook/react-native/commit/947e71a922c0db5d3d3780d249d1a8d183534c22) by [@mmmulani](https://github.com/mmmulani)) + +### Changed + +- Use prettyFormat for Metro logging ([abd7faf354](https://github.com/facebook/react-native/commit/abd7faf3547e165abfc52383d3709b9d4d2e9006) by [@cpojer](https://github.com/cpojer)) +- Tweak messages and fix the warning condition ([2a3ac0429b](https://github.com/facebook/react-native/commit/2a3ac0429b0e4c443d185807a39b41fc5a2ab1d2) by [@gaearon](https://github.com/gaearon)) +- Allow jest globals in **mocks** directories ([e78c01375a](https://github.com/facebook/react-native/commit/e78c01375aef88e0bb4029479acac9e85ecaf080) by [@artdent](https://github.com/artdent)) +- Make Animation EndCallback type allow any return value ([306c8d64d9](https://github.com/facebook/react-native/commit/306c8d64d91f87b248f627333de7f24355248088) by [@draperunner](https://github.com/draperunner)) +- create two layout pass reason flexLayout and flexMeasure instead of flex ([6ce985463b](https://github.com/facebook/react-native/commit/6ce985463b2724451baed8b0486b298f969e36e7) by [@SidharthGuglani](https://github.com/SidharthGuglani)) +- Use shorthand for Fragment in App.js ([7cac6a4b6c](https://github.com/facebook/react-native/commit/7cac6a4b6cfa8c1b54db62f2b1510f7c52f4574d) by [@ferdicus](https://github.com/ferdicus)) +- Use eslint-plugin-prettier recommended config ([d2b92fffb1](https://github.com/facebook/react-native/commit/d2b92fffb1d14dd0ec628e9dcdfd76e39f2067ff) by [@Justkant](https://github.com/Justkant)) +- Support string command arguments ([0314305e12](https://github.com/facebook/react-native/commit/0314305e1202e48c74091e15da8574f1b92ce441) by [@TheSavior](https://github.com/TheSavior)) +- chore: Link to CLA wiki and CLA form. ([e2d55d5c5e](https://github.com/facebook/react-native/commit/e2d55d5c5ef40ccae3220dc0e1fca7cf3592c676) by [@JustinTRoss](https://github.com/JustinTRoss)) +- CLI is now ^3.0.0-alpha.1 ([5edd1c674c](https://github.com/facebook/react-native/commit/5edd1c674c911a6c59aaad8ed36ce12fa98787ff) by [@thymikee](https://github.com/thymikee)) +- Flow is now v0.104.0 ([59db059dbd](https://github.com/facebook/react-native/commit/59db059dbddb8101212f3739eecf0db494cfab41) by [@mroch](https://github.com/mroch)) +- React is now at 16.9 ([40e8a5f685](https://github.com/facebook/react-native/commit/40e8a5f685376300aa5365de4557cd395996b9a2), [0ccedf3964](https://github.com/facebook/react-native/commit/0ccedf3964b1ebff43e4631d1e60b3e733096e56) by [@TheSavior](https://github.com/TheSavior)) +- Use Metro for auto-collapsing internal stack frames ([77125a1ac3](https://github.com/facebook/react-native/commit/77125a1ac364a6b7e2382fdc86cc19a3e2eba089) by [@motiz88](https://github.com/motiz88)) +- Move React error message formatting into ExceptionsManager ([2dadb9e2b0](https://github.com/facebook/react-native/commit/2dadb9e2b0ba26223ed83a30af620ce3e62e245f) by [@motiz88](https://github.com/motiz88)) +- Improve VirtualizedList error message ([bef87b648c](https://github.com/facebook/react-native/commit/bef87b648c4bed228f1c5889abe0181a271edf76) by [@vonovak](https://github.com/vonovak)) + +#### Android specific + +- Bump Hermes to v0.2.1 ([811401bcac](https://github.com/facebook/react-native/commit/811401bcac02f3e6e154c7e0f76f9f82eeaa6959) by [@sunnylqm](https://github.com/sunnylqm)) +- Use centralized package for DoNotStrip annotation ([35fc0add2d](https://github.com/facebook/react-native/commit/35fc0add2d3a278bf90257284fe23e03898008de) by [@passy](https://github.com/passy)) + +#### iOS specific + +- Do not override ActivityIndicator color when setting its size ([14b0ed4c5d](https://github.com/facebook/react-native/commit/14b0ed4c5d872cd992f6e1ca072a2c44c8ece25f) by [@cabelitos](https://github.com/cabelitos)) +- fix display problems when image fails to load ([71d7d6883c](https://github.com/facebook/react-native/commit/71d7d6883cb9a3d18666f04a444de7b4a611b304)) +- Renamed yoga podspec to Yoga ([82a8080f07](https://github.com/facebook/react-native/commit/82a8080f0704e83079d0429e4e367f5131052e64) by [@axe-fb](https://github.com/axe-fb)) +- Update loading pre-bundled message ([eb92f8181f](https://github.com/facebook/react-native/commit/eb92f8181f3119bbc69ff7cb5aff2e03d993b8b3) by [@rickhanlonii](https://github.com/rickhanlonii)) + +### Deprecated + +- Deprecate method UIManagerModule.playTouchSound() ([e3ec8dbe15](https://github.com/facebook/react-native/commit/e3ec8dbe15a07e86530e1fd801c27ad8c1023b5c) by [@mdvacca](https://github.com/mdvacca)) +- Deprecate UIManager.measureLayoutRelativeToParent ([e42009b784](https://github.com/facebook/react-native/commit/e42009b7849f1cfd6d6d34e28c564ec5e39680bb) by [@mdvacca](https://github.com/mdvacca)) + +#### Android specific + +- DrawerLayoutAndroid drawerPosition now expects a string, number is deprecated ([305b0a2814](https://github.com/facebook/react-native/commit/305b0a28142414d559d2d08795a5963716dc4b0f) by [@TheSavior](https://github.com/TheSavior)) + +### Removed + +#### Android specific + +- Remove supportLibVersion variable in build.gradle ([fee7f0617e](https://github.com/facebook/react-native/commit/fee7f0617ee6e4f10edf6b8e36da6c5fb00d22ac) by [@ferdicus](https://github.com/ferdicus)) + +#### iOS Specific + +- Remove 's.static_framework = true' requirement for podspec ([ca9e108110](https://github.com/facebook/react-native/commit/ca9e108110e4a3cc39044805f879d9a9cb637c41) by [@jtreanor](https://github.com/jtreanor)) + +### Fixed + +- Add ErrorUtils to eslint globals ([76af5f9163](https://github.com/facebook/react-native/commit/76af5f916303d7906ea522076c965292145a1370) by [@rodineijf](https://github.com/rodineijf)) +- URL: Do not prepend baseUrl if the URL is not a relative URL ([e104204ae0](https://github.com/facebook/react-native/commit/e104204ae083d31e0b9967373ce79f2f1ca8fbb6) by [@jeswinsimon](https://github.com/jeswinsimon)) +- Memory Leak due to JSStringRelease not called ([b8d6ef3726](https://github.com/facebook/react-native/commit/b8d6ef372663fe6d467144abfc5d2c9352dc28d6) by [@sachinservicemax](https://github.com/sachinservicemax)) +- Fixed rotateZ native animation ([f4f08d3c54](https://github.com/facebook/react-native/commit/f4f08d3c549f2af7cd04ef78fe800d3bc12af1f0) by [@Titozzz](https://github.com/Titozzz)) +- Fix indentation in Gradle files ([9b0adb5ad1](https://github.com/facebook/react-native/commit/9b0adb5ad132b8ff37e707a4943411d92b4e58dc) by [@sonicdoe](https://github.com/sonicdoe)) +- Fix handling of failed image downloads ([71d7d6883c](https://github.com/facebook/react-native/commit/71d7d6883cb9a3d18666f04a444de7b4a611b304) by [@sammy-SC](https://github.com/sammy-SC)) +- Fix SectionList scrollToLocation and prevent regressions ([8a82503b54](https://github.com/facebook/react-native/commit/8a82503b54e3c63230a07de99ec082b2dcb54bc7) by [@vonovak](https://github.com/vonovak)) +- [General][internal] Fix incorrect `module.name_mapper` in template .flowconfig ([e6b2cf0418](https://github.com/facebook/react-native/commit/e6b2cf04188fc9647bae4bef4cca5d4dde22a657) by [@MoOx](https://github.com/MoOx)) +- Fall back to `JSON.stringify` in `console.log` if Symbol is unavailable ([179889704b](https://github.com/facebook/react-native/commit/179889704b6f9d56cb990d5b9bba6ee5ea2cd13f) by [@cpojer](https://github.com/cpojer)) +- Pop frames correctly in console.error handler ([3eaf245540](https://github.com/facebook/react-native/commit/3eaf2455402b5ad73c8a059311f0cb213df9dd28) by [@motiz88](https://github.com/motiz88)) +- Add documentation to TextInput's Flow types ([d00f0882fb](https://github.com/facebook/react-native/commit/d00f0882fbdd532f8698d2569bd771ca5843d0f5) by [@empyrical](https://github.com/empyrical)) + +#### Android specific + +- Add missing Hermes include ([1db96a3c46](https://github.com/facebook/react-native/commit/1db96a3c469b872e851553207e5420d54afc731a) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix UIManager.measure to consider scale and rotation transforms ([28d50189f3](https://github.com/facebook/react-native/commit/28d50189f3350e7550bf03ea5bd1363839ee2911) by [@floriancargoet](https://github.com/floriancargoet)) + +#### iOS specific + +- Fixed iOS packager connection ([4ab9da134c](https://github.com/facebook/react-native/commit/4ab9da134c988db832b1a2daa90ce38bf8c419eb) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fixed compatibility with CocoaPods frameworks. ([8131b7bb7b](https://github.com/facebook/react-native/commit/8131b7bb7b4794e0e7003a6e3d34e1ebe4b8b9bc) by [@jtreanor](https://github.com/jtreanor)) +- Don't call sharedApplication in App Extension ([c5ea18f738](https://github.com/facebook/react-native/commit/c5ea18f7389fe821e7a9882e4b1b30b0a1b266f4) by [@zhongwuzw](https://github.com/zhongwuzw)) + +## v0.60.6 + +This is a small patch release with a commit to fix the build break in MSVC to help the users of react-native-windows. ([9833ee7bc1](https://github.com/facebook/react-native/commit/9833ee7bc19982acd6ccaf6ac222bc24a97667a8) by [@acoates-ms](https://github.com/acoates-ms)) + +## v0.60.5 + +This is a patch release that consist of a few commits requested in the [dedicated conversation](https://github.com/react-native-community/releases/issues/130) to improve the quality of the 0.60 release. Thanks to everyone who contributed! + +### Added + +- Added a default Prettier config for new projects ([7254bab0b3](https://github.com/facebook/react-native/commit/7254bab0b3fa129cd238783ab993fbae1102d60a) by [@jpdriver](https://github.com/jpdriver)) + +#### Android specific + +- Add showSoftInputOnFocus to TextInput ([d88e4701fc](https://github.com/facebook/react-native/commit/d88e4701fc46b028861ddcfa3e6ffb141b3ede3d)) + +### Changed + +- Bump CLI to ^2.6.0 ([fafe5ee072](https://github.com/facebook/react-native/commit/fafe5ee0726061e3590b91d3b5cff04e33781f87) by [@thymikee](https://github.com/thymikee)) + +### Fixed + +- Ensure right version of Metro bundler is used ([1bb197afb1](https://github.com/facebook/react-native/commit/1bb197afb191eab134354386700053914f1ac181) by [@kelset](https://github.com/kelset)) + +#### Android specific + +- Fix `ClassNotFound` exception in Android during Release builds ([ffdf3f22c6](https://github.com/facebook/react-native/commit/ffdf3f22c68583fe77517f78dd97bd2e97ff1b9e) by [@thecodrr](https://github.com/thecodrr)) +- Remove unnecessary flag when running JS server ([a162554f5d](https://github.com/facebook/react-native/commit/a162554f5dc36fa0647b5bf52119a62bd20046e3) by [@thecodrr](https://github.com/thecodrr)) +- Correctly set the border radius on android ([b432b8f13b](https://github.com/facebook/react-native/commit/b432b8f13b4871dcafd690e57d37298662712b50) by [@cabelitos](https://github.com/cabelitos)) +- Fix addition of comma at the end of accessibility labels on Android. ([812abfdbba](https://github.com/facebook/react-native/commit/812abfdbba7c27978a5c2b7041fc4a900f3203ae) by [@marcmulcahy](https://github.com/marcmulcahy)) + +#### iOS specific + +- Don't call sharedApplication in App Extension ([c5ea18f738](https://github.com/facebook/react-native/commit/c5ea18f7389fe821e7a9882e4b1b30b0a1b266f4) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Delete fishhook ([46bdb4161c](https://github.com/facebook/react-native/commit/46bdb4161c84b33f1d0612e9c7cdd824462a31fd) by [@mmmulani](https://github.com/mmmulani)) + +You can participate to the conversation for the next patch release in the dedicated [issue](https://github.com/react-native-community/react-native-releases/issues/130). + +## v0.60.4 + +This is a patch release that contains two more Hermes related fixes, thanks to the contributors for helping improving the support! + +### Fixed + +#### Android specific + +- Generate correct source map if hermes not enabled ([b1f81be4bc](https://github.com/facebook/react-native/commit/b1f81be4bc21eb9baa39dd7ef97709d9927ad407) by [@HazAT](https://github.com/HazAT)) +- Generate source maps outside of assets/ ([60e75dc1ab](https://github.com/facebook/react-native/commit/60e75dc1ab73b2893ec2e25c0320f32b3cf12b80) by [@motiz88](https://github.com/motiz88)) + +You can participate to the conversation for the next patch release in the dedicated [issue](https://github.com/react-native-community/react-native-releases/issues/130). + +## v0.60.3 + +This is a patch release that fixes the binary path to Hermes package, thanks to [@zoontek](https://github.com/zoontek)) for creating the PR! + +You can participate to the conversation for the next patch release in the dedicated [issue](https://github.com/react-native-community/react-native-releases/issues/130). + +## v0.60.2 + +This is a patch release that fixes the path to Hermes package. + +You can participate to the conversation for the next patch release in the dedicated [issue](https://github.com/react-native-community/react-native-releases/issues/130). + +## v0.60.1 + +This is a patch release that includes the Hermes JavaScript Engine announced at Chain React Conf 2019. + +Check out the documentation to opt-in and give [Hermes a try](https://reactnative.dev/docs/hermes). + +You can participate to the conversation for the next patch release in the dedicated [issue](https://github.com/react-native-community/react-native-releases/issues/130). + +## v0.60.0 + +This feature release of React Native includes many milestone changes for the platform. Please refer to the [blog post](https://reactnative.dev/blog/2019/07/03/version-60) for selected details. For upgrading users, some of the progress comes with breaking changes; manual intervention may be required for your app. We're also aware that existing CocoaPods integrations using `use_frameworks` are not out-of-the-box compatible with this version, but please consider [various workarounds](https://github.com/facebook/react-native/issues/25349) while we prepare a long-term solution for a future release. If you're interested in helping evaluate our next release (0.61), subscribe to the dedicated issue [here](https://github.com/react-native-community/react-native-releases/issues/130). + +Have you ever considered contributing to React Native itself? Be sure to check out [Contributing to React Native](https://github.com/facebook/react-native/blob/master/CONTRIBUTING.md). + +### Added + +- CLI autolinking support ([5954880875](https://github.com/facebook/react-native/commit/5954880875d8dfb9b7868aa316647f8fe2b3d8c3), [da7d3dfc7d](https://github.com/facebook/react-native/commit/da7d3dfc7d3bd83e7522175a720b30fee4c9b3d3) by [@zhongwuzw](https://github.com/zhongwuzw) and [@hramos](https://github.com/hramos)) +- New Intro screen ([6b393b27e1](https://github.com/facebook/react-native/commit/6b393b27e18e663d39b66fd121ee302bce29d77d), [233fddbe01](https://github.com/facebook/react-native/commit/233fddbe012098dce3719ba066d3dc653e05e6c9), [fe88e9e48c](https://github.com/facebook/react-native/commit/fe88e9e48ce99cb8b9da913051cc36575310018b), [aa926e349b](https://github.com/facebook/react-native/commit/aa926e349b1656b02b8c1a2048cc56b25f9567c1), [a9e8a71e53](https://github.com/facebook/react-native/commit/a9e8a71e531510baf126780cecdcbc64c934f4dd), [ad4a5d9a3e](https://github.com/facebook/react-native/commit/ad4a5d9a3eac9794038e93158d45e7f1ceb9e495), and [0245fd713e](https://github.com/facebook/react-native/commit/0245fd713ea9ff6fe334980f537e2254a9e3126c) by [@cpojer](https://github.com/cpojer), [@eliperkins](https://github.com/eliperkins), [@lucasbento](https://github.com/lucasbento), [@orta](https://github.com/orta), [@adamshurson](https://github.com/adamshurson), [@karanpratapsingh](https://github.com/karanpratapsingh) and [@glauberfc](https://github.com/glauberfc)) +- Add enhanced accessibility actions support ([7fb02bd908](https://github.com/facebook/react-native/commit/7fb02bd90884f0a717e8151d4d30767fe38392c1) by [@xuelgong](https://github.com/xuelgong)) +- Add additional accessibility roles and states ([1aeac1c625](https://github.com/facebook/react-native/commit/1aeac1c62528004d994200664368dc85fba1795d)) +- Add `isReduceMotionEnabled()` plus `reduceMotionChanged` to `AccessibilityInfo` ([0090ab32c2](https://github.com/facebook/react-native/commit/0090ab32c2aeffed76ff58931930fe40a45e6ebc) by [@estevaolucas](https://github.com/estevaolucas)]) +- Add support for cancelling fetch requests with `AbortController` ([h5e36b0c](https://github.com/facebook/react-native/commit/5e36b0c6eb2494cefd11907673aa018831526750) by [@janicduplessis](https://github.com/janicduplessis)) + +#### Android specific + +- Enable views to be nested within **Text**; this brings feature parity to Android, but be aware that it [has some limitations](https://github.com/facebook/react-native/commit/a2a03bc68ba062a96a6971d3791d291f49794dfd) ([5c399a9f74](https://github.com/facebook/react-native/commit/5c399a9f74f22c58c11f75abde32ac7dc269ccc0) by [@rigdern](https://github.com/rigdern)) +- Add a `touchSoundDisabled` prop to **Button**, **Touchable**, and **TouchableWithoutFeedback** ([45e77c8324](https://github.com/facebook/react-native/commit/45e77c8324f7dc2d53109e45a4e0b18cbab6a877) by [@yurykorzun](https://github.com/yurykorzun)) + +#### iOS specific + +- Add `announceForAccessibility` and `announcementFinished` APIs for making screen reader announcements ([cfe003238a](https://github.com/facebook/react-native/commit/cfe003238ab8c5686d185f6ce9e0776eeb4bb729) by [@rigdern](https://github.com/rigdern)) +- Ability to force network requests to use WiFi using the `allowsCellularAccess` property. This can ensure that network requests are sent over WiFi if communicating with a local hardware device and is accomplished by setting a flag. Default behavior of allowing network connections over cellular networks when available is unchanged. ([01c70f2fb9](https://github.com/facebook/react-native/commit/01c70f2fb9e8ac78a4d0cbd016d4de47316fe4d1) and [916186a7e6](https://github.com/facebook/react-native/commit/916186a7e6c43b1a1c68652ab82862bcd8fb1e01) by [@bondparkerbond](https://github.com/bondparkerbond)and [@zhongwuzw](https://github.com/zhongwuzw)) +- `$RN_CACHE_DIR` can now be used to manually specify the iOS build cache directory ([845eee403e](https://github.com/facebook/react-native/commit/845eee403e1cd3cb36935ef142f411f2b5075346) by [@hramos](https://github.com/hramos)) + +### Changed + +- _BREAKING_ Migrated to AndroidX; please see [this thread](https://github.com/react-native-community/discussions-and-proposals/issues/129#issuecomment-503829184) for more details on this change +- Cleanup **RedBox** message and stack output; it's now far easier to understand ([49d26eb0c4](https://github.com/facebook/react-native/commit/49d26eb0c4aeb611c6cb37a568708afa67b48c18) by [@thymikee](https://github.com/thymikee)) +- Add default `scrollEventThrottle` value to **Animated.FlatList** and **Animated.SectionList**; this now behaves consistently with **Animated.ScrollView** ([933e65e245](https://github.com/facebook/react-native/commit/933e65e245b30f7dc5a26aa51881153fb7c3628e) by [@janicduplessis](https://github.com/janicduplessis)) +- Remove invariant on nested sibling **VirtualizedLists** without unique listKey props; they now trigger a **RedBox** ([af5633bcba](https://github.com/facebook/react-native/commit/af5633bcba224f71f035ba4214a93b69723c9b93)) +- **FlatList** and **VirtualizedList**'s default `keyExtractor` now checks `item.id` and `item.key` ([de0d7cfb79](https://github.com/facebook/react-native/commit/de0d7cfb79c7f4011d4b6748b1afc656d33fd5ac) by [@sahrens](https://github.com/sahrens)) +- **SectionList**'s `scrollToLocation` on iOS now counts `itemIndex` like Android; both platforms are now consistent, and the `itemIndex` value 0 now represents scrolling to the first heading ([248a108abf](https://github.com/facebook/react-native/commit/248a108abf206b7ae32208537f0b73a8192a4829) by [@vonovak](https://github.com/vonovak)) +- Slightly speedup core initialization by moving native version check to DEV only ([5bb2277245](https://github.com/facebook/react-native/commit/5bb22772452e49dbcfbf183f6ebeee4576e67947) by [@mmmulani](https://github.com/mmmulani)) +- `react` is now at v16.8.6 ([53cec2dc1f](https://github.com/facebook/react-native/commit/53cec2dc1f1f5d143d0bb9752629b72350ebd112), [ee681b72ce](https://github.com/facebook/react-native/commit/ee681b72ce89539e5764ed59e5dfea4fab04d48c), and [6001acb319](https://github.com/facebook/react-native/commit/6001acb319958242f8d8e2dd40cb91a55b5eab2e) by [@kelset](https://github.com/kelset), [@mdvacca](https://github.com/mdvacca), [@gaearon](https://github.com/gaearon)) +- `react-native-community/cli` is now at v2.0.0 (by [@thymikee](https://github.com/thymikee)) +- `flow` is now at v0.98 ([0e1dfd4369](https://github.com/facebook/react-native/commit/0e1dfd436917a78a09da7b57a0b50397e6a0b6e1) by [@nmote](https://github.com/nmote)) +- `prettier` is now at v1.17.0 ([ff9f8f347d](https://github.com/facebook/react-native/commit/ff9f8f347d71630664dc3da1e8be0425799c0ce0)) +- `metro` packages are now at v0.54.1 ([7ff3874ec0](https://github.com/facebook/react-native/commit/7ff3874ec060bce568537a2238aea2c888e6e13f), [343f0a1d50](https://github.com/facebook/react-native/commit/343f0a1d50662aa37ef0b26d5436b2a0b40fbabb) by [@motiz88](https://github.com/motiz88)) +- Replace patched fetch polyfill with `whatwg-fetch@3.0` ([bccc92dfdd](https://github.com/facebook/react-native/commit/bccc92dfdd2d85933f2a9cb5c8d1773affb7acba) by [@janicduplessis](https://github.com/janicduplessis)) + +#### Android specific + +- Use class canonical name for `PARTIAL_WAKE_LOCK` tag ([88dbb4558c](https://github.com/facebook/react-native/commit/88dbb4558cd10f129f2c31e3b0b872924aba5416) by [@timwangdev](https://github.com/timwangdev)) + +#### iOS specific + +- _BREAKING_: Split React.podspec into separate podspecs for each Xcode project; your libraries will need to update for this change as well to avoid CocoaPods build errors ([2321b3fd7f](https://github.com/facebook/react-native/commit/2321b3fd7f666ce30f5dad4cd2673ddf22972056) by [@fson](https://github.com/fson)) +- Improve handling of native module exceptions; they are now propagated to crash reporting tools with the context and callstack ([629708beda](https://github.com/facebook/react-native/commit/629708bedae65a30e39d234da6b04d6fa101a779) by [@pvinis](https://github.com/pvinis)) +- Switch **Slider** `onSlidingComplete` event to a non-bubbling event on iOS to match Android ([7927437a6d](https://github.com/facebook/react-native/commit/7927437a6d5d63de2424d43d58085291c1067091) by [@rickhanlonii](https://github.com/rickhanlonii)) + +### Deprecated + +- **StatusBar** is no longer deprecated; thank you for the feedback ([a203ebe206](https://github.com/facebook/react-native/commit/a203ebe2062b3c12f85783f46030971f3aa5db1d) by [@cpojer](https://github.com/cpojer)) + +### Removed + +- **NetInfo** has been removed; its replacement is now available via the [react-native-community/netinfo](https://github.com/react-native-community/react-native-netinfo) package ([5a30c2a205](https://github.com/facebook/react-native/commit/5a30c2a2052ba76e88dbf71b5b5c92966591bf26) by [@cpojer](https://github.com/cpojer)) +- **WebView** has been removed; its replacement is now available via the [react-native-community/webview](https://github.com/react-native-community/react-native-webview) package ([](https://github.com/facebook/react-native/commit/6ca438a7f4bd7e6b317f0461aebbd5a7186151ed), [1ca9a95537](https://github.com/facebook/react-native/commit/1ca9a9553763a89c977f756b45486f8b9cedab80), and [954f715b25](https://github.com/facebook/react-native/commit/954f715b25d3c47c35b5a23ae23770a93bc58cee) by [@cpojer](https://github.com/cpojer) and [@thorbenprimke](https://github.com/thorbenprimke)) +- **Geolocation** has been removed; its replacement is now available via the [react-native-community/geolocation](https://github.com/react-native-community/react-native-geolocation) package ([17dbf98884](https://github.com/facebook/react-native/commit/17dbf988845bb7815dbb6182218c8c28d027fb91) and [9834c580af](https://github.com/facebook/react-native/commit/9834c580af654366bf0d38b78cd2694b0a0c477f) by [@cpojer](https://github.com/cpojer) and [@mmmulani](https://github.com/mmmulani)) + +### Fixed + +- Fix `Animated.Value` value after animation if component was re-mounted ([b3f7d53b87](https://github.com/facebook/react-native/commit/b3f7d53b87413abdf302c521114e4d77aa92e07f) by [@michalchudziak](https://github.com/michalchudziak)) +- Consistent reporting native module name on crash on native side ([fdd8fadea8](https://github.com/facebook/react-native/commit/fdd8fadea84f475714a16b6f0ec433f898d09558) and [b79d7db9db](https://github.com/facebook/react-native/commit/b79d7db9dbf588085b29274e507d34438e2e2595) by [@DimitryDushkin](https://github.com/DimitryDushkin)) +- Handle null filenames in symbolicated stack trace gracefully in **ExceptionsManager** ([2e8d39bed7](https://github.com/facebook/react-native/commit/2e8d39bed70e2e5eeddeb2dc98155bf70f9abebd) by [@motiz88](https://github.com/motiz88)) +- Fix HasteImpl platform name regex ([28e0de070d](https://github.com/facebook/react-native/commit/28e0de070d2dae9a486ab5915b6fd76723bd84ef) by [@CaptainNic](https://github.com/CaptainNic)) +- Fix a JS memory leak in Blob handling; this resolves multiple leaks around `fetch` ([05baf62721](https://github.com/facebook/react-native/commit/05baf6272143667694585a14fb59657fdc93c3b1) and [9ef5107d04](https://github.com/facebook/react-native/commit/9ef5107d04da374fc566d8b296572ddd992419f0) by [@janicduplessis](https://github.com/janicduplessis)) +- **SectionList**'s `scrollToLocation` now scrolls to the top of the sticky header as expected ([d376a444e3](https://github.com/facebook/react-native/commit/d376a444e318beabd8ebe9ccb41ffc300e12ea76) by [@danilobuerger](https://github.com/danilobuerger)) + +#### Android specific + +- Fix duplicate resource error in Android build ([962437fafd](https://github.com/facebook/react-native/commit/962437fafd02c936754d1e992479056577cafd05) and [eb534bca58](https://github.com/facebook/react-native/commit/eb534bca58a89ae306010626a8bdae92c23b8784) by [@mikehardy](https://github.com/mikehardy) and [@Dbroqua](https://github.com/Dbroqua)) +- Reorder operations of native view hierarchy ([5f027ec64d](https://github.com/facebook/react-native/commit/5f027ec64d6764fbbb9813fabb373194dec79db7) by [@lunaleaps](https://github.com/lunaleaps)) +- Fix performance regression from new custom fonts implementation ([fd6386a07e](https://github.com/facebook/react-native/commit/fd6386a07eb75a8ec16b1384a3e5827dea520b64) by [@dulmandakh](https://github.com/dulmandakh)) +- Fix internal test case around disabled state of buttons ([70e2ab2ec9](https://github.com/facebook/react-native/commit/70e2ab2ec9a1df60b39987946af18cac8621b3b0)) +- Fix extra call of **PickerAndroid**'s `onValueChange` on initialization; now it is only called when `selectedValue` changes ([82148da667](https://github.com/facebook/react-native/commit/82148da6672e613f34ffb48133cdefc235418dea) by [@a-c-sreedhar-reddy](https://github.com/a-c-sreedhar-reddy)) +- Fix **PickerAndroid** will reset selected value during items update ([310cc38a5a](https://github.com/facebook/react-native/commit/310cc38a5acb79ba0f1cda22913bd1d0cb296034) by [@Kudo](https://github.com/Kudo)) +- Fix unexpected PARTIAL_WAKE_LOCK when no headless tasks registered. ([bdb1d4377e](https://github.com/facebook/react-native/commit/bdb1d4377e47c6cd49ff619134d4860519a3cb0c) by [@timwangdev](https://github.com/timwangdev)) +- Fix calling **TextInput**'s `onKeyPress` method when the user types an emoji ([a5c57b4ed4](https://github.com/facebook/react-native/commit/a5c57b4ed4965ac4bb231399fd145da8095cece3)) +- Fix value of **TextInput**'s `onSelectionChange` start and end arguments by normalizing them ([2ad3bb2e2d](https://github.com/facebook/react-native/commit/2ad3bb2e2d62ffb780bab020f645626a16dd3b4a) by [@uqmessias](https://github.com/uqmessias)) +- In `Linking.getInitialURL` method, use the `InteractionManager` to wait for the current activity to finish initializing ([c802d0b757](https://github.com/facebook/react-native/commit/c802d0b757912358d703d4d8a114073377a905b9) by [@mu29](https://github.com/mu29)) +- Disable delta bundles on the first app run ([e4aff423ac](https://github.com/facebook/react-native/commit/e4aff423ac0421f4af7b9a111e5ad954f489da19) by [@wojteg1337](https://github.com/wojteg1337)) +- In **DatePickerAndroid**, work around Android Nougat bug displaying the wrong the spinner mode ([bb060d6cf8](https://github.com/facebook/react-native/commit/bb060d6cf89500778bba27d1da5925e2623c7a99) by [@luancurti](https://github.com/luancurti)) +- Fix crash in Animated Interpolation when inputMin === inputMax ([7abfd23b90](https://github.com/facebook/react-native/commit/7abfd23b90db08b426c3c91b0cb6d01d161a9b9e) by [@olegbl](https://github.com/olegbl)) +- Fix symbolication for **RedBox** and **YellowBox** when using delta bundling ([a05e9f8e09](https://github.com/facebook/react-native/commit/a05e9f8e094b25cc86ee297477cccafc3be5ef52) by [@motiz88](https://github.com/motiz88)) +- Fix **CameraRoll** crash on mime type guessing ([ebeb893b50](https://github.com/facebook/react-native/commit/ebeb893b50b4aa1ad77bdb203e4f8faed75db43a) by [@Sroka](https://github.com/Sroka)) + +#### iOS specific + +- Call designated initializer for SurfaceHostingProxyRootView ([3c125e867f](https://github.com/facebook/react-native/commit/3c125e867f52efd7f18b2bd8c9a21b246afcd788) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix **RedBox** JS symbolication when adding JS engine tag to the message ([920632cadb](https://github.com/facebook/react-native/commit/920632cadb108ceeacad93e9316e706608df2942) by [@motiz88](https://github.com/motiz88)) +- Fix **TextInput**'s `onSelectionChange` behavior in single line text inputs ([0c11d8d9b4](https://github.com/facebook/react-native/commit/0c11d8d9b4edf7830255f5b016d0ba7ef72ae827) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix accessibility problem with **TextInput** Clear Button ([4e37d37cbf](https://github.com/facebook/react-native/commit/4e37d37cbff27e61659440094a662e00eafd8fc4) by [@shergin](https://github.com/shergin)) +- Fix `renderingMode` not applied to GIF **Image**s ([75380aa329](https://github.com/facebook/react-native/commit/75380aa3296210777dc0be70a722701767276117) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix **ScrollView** `centerContent` not work in some cases ([2cdf9694b5](https://github.com/facebook/react-native/commit/2cdf9694b56e76477dde572eb3dc38be31361eab) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix crash on performance logger ([5d3d3987d8](https://github.com/facebook/react-native/commit/5d3d3987d8a81b84d43dc88808d7f50c7bf11d19) by [@zhigang1992](https://github.com/zhigang1992)) +- Do not run packager in Release mode ([4ea6204111](https://github.com/facebook/react-native/commit/4ea62041118fb031d7540726df2d29185c6b130d) by [@lucasbento](https://github.com/lucasbento)) +- Fix `code` and `reason` arguments being ignored when calling `WebSocket.close` ([0ac2171c54](https://github.com/facebook/react-native/commit/0ac2171c549b389228c4a37ae645eb0d9813b82d) by [@jeanregisser](https://github.com/jeanregisser)) +- Fix return value of `Linking.openURL()` ([4a5d0bdbd7](https://github.com/facebook/react-native/commit/4a5d0bdbd75c433d2f51f160657a0ad91e440272) by [@thib92](https://github.com/thib92)) +- When an accessibilityLabel can't be discerned, return `nil` instead of `@""` ([d4ff5ed258](https://github.com/facebook/react-native/commit/d4ff5ed258b75fe77c5d801af7b097b04fcd3690) by [@sammy-SC](https://github.com/sammy-SC)) +- Fix Xcode build when the project's path contains whitespace ([f0770b6b37](https://github.com/facebook/react-native/commit/f0770b6b370f483fdd729bdba04069cc783353dc)) +- Move accessibility props to UIView+React ([9261035c2b](https://github.com/facebook/react-native/commit/9261035c2bf2fe9522806fb1c535a1835e7acfa2) by [@janicduplessis](https://github.com/janicduplessis)) + +## v0.59.10 + +This is likely the last patch release for version 59 of React Native for the foreseeable future: it contains an important Android side update for the JavaScript Core, to prevent a great number of crashes mostly related to Samsung devices - thanks to [@Kudo](https://github.com/Kudo) for his work on fixing this via [557989a86f](https://github.com/facebook/react-native/commit/557989a86f8730113393ed229927d607a478e524)! + +Thanks everyone who participated in the [discussion](https://github.com/react-native-community/releases/issues/127). + +## v0.59.9 + +This is a patch fix release addressing a couple ScrollView regressions, and "future-proof" RN 59 from crashes caused by upgrading Gradle (now can support up to 5.4.1 & 3.4.0 for the plugin) and Xcode 11 Beta 1. You can upgrade to this version without upgrading your tooling. + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/124) for cherry-picking commits. You can participate to the conversation for the next patch release in the dedicated [issue](https://github.com/react-native-community/react-native-releases/issues/127). + +### Changed + +- If `isInteraction` is not specified in the config, it would always default to `true` which would block interactions like VirtualizedList updates. This is generally not what you want with useNativeDriver since the animation won't be interrupted by JS. If something does end up interfering with an animation and causes frame drops, `isInteraction` can be set manually. ([8f186b84ae](https://github.com/facebook/react-native/commit/8f186b84aeeb2613bf6ae08f20a8547d40179007) by [@sahrens](https://github.com/sahrens)) + +- Update detox to match master ([c6a5c09e2b](https://github.com/facebook/react-native/commit/c6a5c09e2b330891242af5c0b3ed7875f32c189e) by [@kelset](https://github.com/kelset)) + +#### Android specific + +- Bump Gradle to 5.4.1 & Android Gradle plugin to 3.4.0 ([b4017a9923](https://github.com/facebook/react-native/commit/b4017a9923b09fed4b693a8e4cfadd30ce34c88d), [d9f5a9dc16](https://github.com/facebook/react-native/commit/d9f5a9dc16f68cecc995bf8ba64fb726e397fadf), [30348f7899](https://github.com/facebook/react-native/commit/30348f789946dc99f5ccd02c85c8decbdb9ac29b), [6976a93126](https://github.com/facebook/react-native/commit/6976a931266126f249458a099bfaf509f9d81a05) by [@dulmandakh](https://github.com/dulmandakh)) + +### Fixed + +- Fixes wrong time unit of scroll event throttle ([1148c03f6f](https://github.com/facebook/react-native/commit/1148c03f6f51329710e23fba99a6916fff3ba42c) by [@zhongwuzw](https://github.com/zhongwuzw)) + +#### Android specific + +- Fix indexed RAM bundle ([d8fa1206c3](https://github.com/facebook/react-native/commit/d8fa1206c3fecd494b0f6abb63c66488e6ced5e0) by [@dratwas](https://github.com/dratwas)) + +#### iOS specific + +- Fix Xcode 11 Beta 1 builds ([46c7ada535](https://github.com/facebook/react-native/commit/46c7ada535f8d87f325ccbd96c24993dd522165d) by [@ericlewis](https://github.com/ericlewis)) + +## v0.59.8 + +This is a patch fix release addressing regressions, crashes, and a few developer-experience pain points (in particular, check the `KeyboardAvoidingView` change). Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/118) for cherry-picking commits. + +### Fixed + +- Fix regexp on `hasteImpl` ([bcd1e2](https://github.com/facebook/react-native/commit/28e0de070d2dae9a486ab5915b6fd76723bd84ef) by [@CaptainNic](https://github.com/CaptainNic)) +- Fix sparse array handling in `EventEmitter#listeners()` ([f68dc8](https://github.com/facebook/react-native/commit/f68dc8) by [@ide](https://github.com/ide)) +- Fix **VirtualizedList** to call `_updateViewableItems` immediately ([08141e](https://github.com/facebook/react-native/commit/efe6a0f0b56191907e8f13be2aee28fe1dcdf555) by [@sahrens](https://github.com/sahrens)) +- Fix prop overrides of **TouchableWithoutFeedback** ([0c4206](https://github.com/facebook/react-native/commit/68825f9ca5a6c8c70390e8499d9663c5be475639) by [@aleclarson](https://github.com/aleclarson)) +- Fix resolve relative size rendering error in inspector ([4884ab](https://github.com/facebook/react-native/commit/972ee2edbd4e1c4201da1606bf5a4c5add9f0083) by [@gandreadis](https://github.com/gandreadis)) +- Fix **VirtualizedSectionList** by making sure to check array bounds ([54f91d](https://github.com/facebook/react-native/commit/929908f28728c217ab4a16c8596e0957295f4d67) by [@vonovak](https://github.com/vonovak)) +- Update `_scrollAnimatedValue` offset of **ScrollView** ([e0d1b3](https://github.com/facebook/react-native/commit/58c956768af75047b2acdca429a28945a6a8b8c0) by [@miyabi](https://github.com/miyabi)) +- Fix infinite `setState` in **VirtualizedList** ([c40a93](https://github.com/facebook/react-native/commit/88787b5e7a7f6dd9c3b258b9dfb60b93ca5a5cea) by [@sahrens](https://github.com/sahrens)) + +#### iOS specific + +- Fix incorrect opacity behavior for **Text** component ([f71357](https://github.com/facebook/react-native/commit/d99e657e3909ff14cd623d1df7d3d13056fdd851) by [@shergin](https://github.com/shergin)) +- Fix **Text** shadow displays when `text Offset` is `{0,0}` ([17a81b](https://github.com/facebook/react-native/commit/9b63b50ad562c8567336898c7511a9a5198a4d6b) by [@Woodpav](https://github.com/Woodpav)) +- Add convert compatible of **NSString** for bridge message data ([c37e9c](https://github.com/facebook/react-native/commit/ffa3b0d4d601fe6788319a7cfd4185b8e4bf462f) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix nullability warnings in **RCTExceptionsManager** ([2b7d79](https://github.com/facebook/react-native/commit/31850df116fdd1595dddcd7b37a21568e679ffa7) by [@jtreanor](https://github.com/jtreanor)) +- Fix app to reconnect with metro after the bundler is closed and reopened ([c28676](https://github.com/facebook/react-native/commit/62bac80f90cf5a4ab216488b4ede441f0e3f86ba) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Fix throttle below 16ms on **ScrollView** ([39776a](https://github.com/facebook/react-native/commit/c87de765f6a9ebf656c188fa2115a1ba01b7939c) by [@sahrens](https://github.com/sahrens)) + +#### Android specific + +- Fix JS errors during bundle load were reported as `UnknownCppException` ([84e263](https://github.com/facebook/react-native/commit/6f6696fa63dc5f7029cb121c7e0ee98f8d271602)) +- Add logic to catch `MissingWebViewPackageException` ([379874](https://github.com/facebook/react-native/commit/954f715b25d3c47c35b5a23ae23770a93bc58cee) by [@thorbenprimke](https://github.com/thorbenprimke)) +- Revert "[improve RTL](https://github.com/facebook/react-native/commit/b3c74967ca6b20d7bda84c690ae3a99dfe255843)" ([f3801d](https://github.com/facebook/react-native/commit/8d3e16831a93079fc5a855a7b0f8b4be508c6942) by [@thorbenprimke](https://github.com/thorbenprimke)) + +### Added + +- Add listener for non-value animated node ([4a82dc](https://github.com/facebook/react-native/commit/68a5ceef312c7e3ac74d616b960c1cfde46a109d) by [@osdnk](https://github.com/osdnk)) +- Set **ScrollView** throttle by default ([74d740](https://github.com/facebook/react-native/commit/b8c8562ffb424831cc34a18aeb25e5fec0954dd0) by [@sahrens](https://github.com/sahrens)) + +### Changed + +- Make **KeyboardAvoidingView** with `behavior="height"` resize on keyboard close ([7140a7](https://github.com/facebook/react-native/commit/3711ea69375ea420800bac97914aa0d24fc9b1a6) by [@WaldoJeffers](https://github.com/WaldoJeffers)) +- Update network inspector to have smarter scroll stickiness ([57dc37](https://github.com/facebook/react-native/commit/c06473ab464e07edbb4715f58cd13674273bb29b) by [@AlanFoster](https://github.com/AlanFoster)) + +## v0.59.7 + +This patch release was unpublished. + +## v0.59.6 + +This patch release was unpublished. + +## v0.59.5 + +This is a patch fix release addressing regressions, crashes, and a few developer-experience pain points. Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/113) for cherry-picking commits. + +### Fixed + +- Remove wrapper around **ListEmptyComponent** ([54af5b](https://github.com/facebook/react-native/commit/46276444508581bac7b9f27edd56ec0c8ec450bc) by [@AntoineDoubovetzky](https://github.com/AntoineDoubovetzky)) + +#### Android specific + +- Enforced thread safety on UIImplementation methods that mutate the shadowNodeRegistry ([f5a318](https://github.com/facebook/react-native/commit/f5a31801a03b61df3d7bc2fc86df7bad272082e2) by [@SudoPlz](https://github.com/sunnylqm)) +- Fixed a `NoSuchKeyException` when parsing JS stack frames without line numbers ([d7bd6c](https://github.com/facebook/react-native/commit/c953e0b4319da0976ece877c09b648a55bc57d9f) by [@Salakar](https://github.com/Salakar)) +- Fixed `mostRecentEventCount` is not updated ([b8aac0](https://github.com/facebook/react-native/commit/60c0a60c508346f7639d32fde0376fabded9f3f0) by [@jainkuniya](https://github.com/jainkuniya)) + +#### iOS specific + +- Pass back correct dimensions for application window in Dimensions module ([72b4cc](https://github.com/facebook/react-native/commit/33b55ccccad56e0b97af294749d728b67b03e658) by [@rdonnelly](https://github.com/rdonnelly)) +- Fixed warning: "RCTImagePickerManager requires main queue setup" ([effb02](https://github.com/facebook/react-native/commit/6508b88cfdccdb2da6bfde05faac4647436ce4e7) by [@scarlac](https://github.com/scarlac)) + +## v0.59.4 + +This is a patch fix release addressing regressions, crashes, and a few developer-experience pain points. Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/100) for cherry-picking commits. + +### Changed + +- Make Jest transform @react-native-community packages by default ([7e23c7c565](https://github.com/facebook/react-native/commit/7e23c7c5654818fa076eeb627b709d39130f57f6) by [@thymikee](https://github.com/thymikee)) + +#### iOS specific + +- Add `scrollToOverflowEnabled` prop to **ScrollView** ([6f4239b37c](https://github.com/facebook/react-native/commit/6f4239b37c3059d6cb1fdaf2dcd3b6c962dde471) by [@mysport12](https://github.com/mysport12)) + +### Fixed + +- Fix **Touchable** long-press ([59e50237bf](https://github.com/facebook/react-native/commit/59e50237bff9521d2b78d7576abf4e23d844ac1b) by [@Kida007](https://github.com/Kida007)) + +#### Android specific + +- Fix a crash when setting `underlineColorAndroid` in **TextInput** ([556aa93ed7](https://github.com/facebook/react-native/commit/556aa93ed72d9dc0f18a1c6d7dec3d9c182fee85) by [@sunnylqm](https://github.com/sunnylqm)) + +#### iOS specific + +- Fix universal links not working in iOS 12 / Xcode 10 ([56679ed359](https://github.com/facebook/react-native/commit/56679ed359834c2177c8837d744cc7bf2ceb6b0a) by [@IljaDaderko](https://github.com/IljaDaderko)) +- Fix triangle views ([7a6fe0cda0](https://github.com/facebook/react-native/commit/7a6fe0cda0a1089c1c82fdd5f7f2db940f70feae) by [@zhongwuzw](https://github.com/zhongwuzw)) + +## v0.59.3 + +This is a patch fix release addressing regressions, crashes, and a few developer-experience pain points. Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/100) for cherry-picking commits. + +### Changed + +#### Android specific + +- Improve RTL support ([b3c74967ca](https://github.com/facebook/react-native/commit/b3c74967ca6b20d7bda84c690ae3a99dfe255843) by [@dulmandakh](https://github.com/dulmandakh)) + +### Fixed + +- Fix **VirtualizedList**, **SectionList** and **FlatList** behavior on rendering list headers with inverted prop and zero items ([c13f5d48cf](https://github.com/facebook/react-native/commit/c13f5d48cfe3e7c0f6c6d0b745b50a089d6993ef) by [@michalchudziak](https://github.com/michalchudziak)) +- Fix **VirtualizedList** debug mode crash ([02e8e531dd](https://github.com/facebook/react-native/commit/02e8e531ddfd86e9abf7ef47fbf30445afeb37cf)) +- Fix running Metro on Windows ([43d3313788](https://github.com/facebook/react-native/commit/43d3313788a5f0a36abdbfadc000b06b2188fc06) and [9db347fabc](https://github.com/facebook/react-native/commit/9db347fabca19c66f669faf4054c81cc3624be03) by [@aliazizi](https://github.com/aliazizi) and [@nazreinkaram](https://github.com/nazreinkaram)) + +#### Android specific + +- Fix IllegalStateException when invalid URL or headers are passed ([aad4dbbbfe](https://github.com/facebook/react-native/commit/aad4dbbbfe937d1924e5359556979ab067198a58) by [@dryganets](https://github.com/dryganets)) +- Fix IllegalStateException when tapping next on Android Keyboard ([b943db418f](https://github.com/facebook/react-native/commit/b943db418f4f0b9d0865642aaca3e1a2f1529663) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific + +- Show Perf Monitor after reloading JS ([15619c22e5](https://github.com/facebook/react-native/commit/15619c22e57f73dfbed7bbe5fd6d9b3d2a8c9225) by [@usrbowe](https://github.com/usrbowe)) +- Fix **TextInput**'s `maxLength` when inserting characters at begin ([17415938c7](https://github.com/facebook/react-native/commit/17415938c7180a95811db949122b8ad24a442866) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix runtime crash in Xcode 10.2 when using `RCT_EXTERN_MODULE` for swift classes ([ff66600224](https://github.com/facebook/react-native/commit/ff66600224e78fec5d0e902f8a035b78ed31a961)) + +## v0.59.2 + +This is a patch fix release addressing regressions, crashes, and a few developer-experience pain points. Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/100) for cherry-picking commits. + +### Fixed + +#### Android specific + +- Crash on pre-26 Android devices when setting **TextInput** content type ([d4aa1e7a52](https://github.com/facebook/react-native/commit/d4aa1e7a52b51fa5d7fc9ded132b7b50170f2190) by [@hramos](https://github.com/hramos)) +- Crash when scroll to index 0 in a **SectionList** ([8fa116cc0e](https://github.com/facebook/react-native/commit/8fa116cc0e1cadbb6cf0734cfde0e0b8060f6b59) by [@danilobuerger](https://github.com/danilobuerger)) +- **Switch**'s `trackColor` being reset when toggled ([7652e31d8c](https://github.com/facebook/react-native/commit/7652e31d8c233c1c831f6597c8a2f7ce3d9c0b6e) and [d6ee448e15](https://github.com/facebook/react-native/commit/d6ee448e15a25a7485482a4702aadb2e396445c7) by [@dulmandakh](https://github.com/dulmandakh) and [@ejanzer](https://github.com/ejanzer)) + +#### iOS specific + +- **ScrollView** offset out of content size ([9c1c5a7455](https://github.com/facebook/react-native/commit/9c1c5a7455d90ec837a9a6141c096de70b798e43) by [@zhongwuzw](https://github.com/zhongwuzw)) +- **RefreshControl** state's race condition ([95d399bc82](https://github.com/facebook/react-native/commit/95d399bc825c5471e08b83eff4b1b1b510e384a0) by [@rostislav-simonik](https://github.com/rostislav-simonik)) +- Start Metro packager from project root ([fe3aebf87b](https://github.com/facebook/react-native/commit/fe3aebf87b4123f8b16cdfcb9e2e774e6e0bf0b6) by [@MatthieuLemoine](https://github.com/MatthieuLemoine)) +- **TextInput**s that are single-line reverting to default text ([e38be82dfa](https://github.com/facebook/react-native/commit/e38be82dfa8b49385b990629318f027de26500cf) by [@PeteTheHeat](https://github.com/PeteTheHeat)) + +### Changed + +#### Android specific + +- Add TLS 1.3 support to all Android versions using Conscrypt; to use this, you must add `implementation('org.conscrypt:conscrypt-android:2.0.0')` to `build.gradle` ([75af15ede4](https://github.com/facebook/react-native/commit/75af15ede44135110e40de75a649d5b15430c590) by [@dulmandakh](https://github.com/dulmandakh)) +- Turn off Metro JS Deltas by default for Android ([845189c17d](https://github.com/facebook/react-native/commit/845189c17de621cc5aa373503220c1c12f649c3c) by [@PeteTheHeat](https://github.com/PeteTheHeat)) + +## v0.59.1 + +This is a small patch release that addresses two critical issues from the 0.59.0 release. + +### Fixed + +#### Android specific + +- Template build gradle error on x86_64 ([4b996da470](https://github.com/facebook/react-native/commit/4b996da470b43f97fd0426b54bda739d7717fb28) by [@grabbou](https://github.com/grabbou)) + +#### iOS specific + +- Build error warning of **Text** module ([d834197746](https://github.com/facebook/react-native/commit/d834197746371b203bd7d7aaabdc2bc581acc867) by [@zhongwuzw](https://github.com/zhongwuzw)) + +## v0.59.0 + +Welcome to release 0.59 of React Native! For highlights of this release, please view the dedicated [blog post](https://reactnative.dev/blog/2019/03/12/releasing-react-native-059). Thanks to those who gave feedback during the [release candidate phase](https://github.com/react-native-community/react-native-releases/issues/79). If you're interested in helping evaluate our next release (0.60), subscribe to the dedicated issue [here](https://github.com/react-native-community/react-native-releases/issues/99). + +### Added + +- Add a Metro configuration to the template with inline require/import options; read more about it [in the blog post](https://reactnative.dev/blog/2019/03/12/releasing-react-native-059) ([ae11993d0f](https://github.com/facebook/react-native/commit/ae11993d0f6c6de661867b5d032d844e91c83c6f) by [@cpojer](https://github.com/cpojer)) + +#### Android specific + +- **Text** and **TextInput** now has prop [maxFontSizeMultiplier](https://reactnative.dev/docs/text#maxfontsizemultiplier) ([4936d284df](https://github.com/facebook/react-native/commit/4936d284df36071047ce776d9e2486c0371f7b97) by [@rigdern](https://github.com/rigdern)) +- **TextInput** now has prop [autoComplete](https://reactnative.dev/docs/textinput#autocomplete) prop ([f15145639d](https://github.com/facebook/react-native/commit/f15145639dab1e8d7a1c79a127b7d45c91d025a8)) +- **CameraRoll**'s `getPhotos` now supports `assetType: "All"` to let users pick from video and photos simultaneously ([54534e79d7](https://github.com/facebook/react-native/commit/54534e79d724ff57572efc43f65100067f35d4c1) by [@kesha-antonov](https://github.com/kesha-antonov)) +- **Text** and **TextInput** now support `textAlign:justify` for android O+ (api level >=26) ([d2153fc58d](https://github.com/facebook/react-native/commit/d2153fc58d825006076a3fce12e0f7eb84479132) by [sunnylqm](https://github.com/sunnylqm)) + +#### iOS specific + +- **TextInput** now has prop `rejectResponderTermination` to enable TextInputs inside Swipeables to function properly ([11df0eae5f](https://github.com/facebook/react-native/commit/11df0eae5ff8f530bfaf56aaf2209ff48f3ed9ac) by [@cmcewen](https://github.com/cmcewen)) +- **ActionSheetIOS** has a new prop `destructiveButtonIndexes` for an `Array` of destructive indexes ([67e7f16944](https://github.com/facebook/react-native/commit/67e7f16944530aa0d1a4d375b0de5efd5c432865) by [@sdg9](https://github.com/sdg9)) +- Add `isEventFromThisApp` to `KeyboardEvent` notifications to disambiguate keyboard events when apps are running side-by-side ([05f35c296d](https://github.com/facebook/react-native/commit/05f35c296d91d946acf4edd94106fbdd0dd69a29) by [@nossbigg](https://github.com/nossbigg)) +- Allow changing the project path in `react-native-xcode.sh` using env var `PROJECT_ROOT` ([9ccde378b6](https://github.com/facebook/react-native/commit/9ccde378b6e6379df61f9d968be6346ca6be7ead) by [@janicduplessis](https://github.com/janicduplessis)) + +### Changed + +- `React` is now at `v16.8.3` ([ccefc700d0](https://github.com/facebook/react-native/commit/ccefc700d0120539eba73747d1d6b65effb0645d) and ([2af13b4477](https://github.com/facebook/react-native/commit/2af13b4477342d3498ab302ceb5297fcbc17e097) by [@cpojer](https://github.com/cpojer) and [@hramos](https://github.com/hramos)) +- `Flow` dependency is now at `v0.92.0` ([5ee738659b](https://github.com/facebook/react-native/commit/5ee738659b4ac7b0e73b9dba09a63091d4571ed9) by [@pakoito](https://github.com/pakoito)) +- `@react-native-community/cli` dependency is at `v1.2.1` ([a252aee2ea](https://github.com/facebook/react-native/commit/a252aee2eabd9eeffb279b9fcf1827093ef4039c) and [5e1504b0fc](https://github.com/facebook/react-native/commit/5e1504b0fca99cad3bfe2339ac0e7862b2315f9c) by [@grabbou](https://github.com/grabbou)) +- Enhance Flow types definitions for **ViewPropTypes** ([7ff9456f2e](https://github.com/facebook/react-native/commit/7ff9456f2e5fd72286f5be52598988707eaef69c) by [@danibonilha](https://github.com/danibonilha)) + +#### Android specific + +- Clarify error message to direct people to `react-native start` rather than `react-native bundle` ([46aaa02274](https://github.com/facebook/react-native/commit/46aaa02274a51ebe2aaa9fca2422dcebf9323475) by [@sunnylqm](https://github.com/sunnylqm)) +- **BREAKING** - removed `OkHttpClientProvider.replaceOkHttpClient` method; please use `OkHttpClientProvider.setOkHttpClientFactory` from 0.54+ ([7cbdd7b6ac](https://github.com/facebook/react-native/commit/7cbdd7b6ac7db2192f7d0193d22326041517a63e) by [@cdlewis](https://github.com/cdlewis)) +- **BREAKING** - remove `ViewHelper`, use `ViewCompat` instead; this may also require changing the `android:theme` to be from `Theme.AppCompat`; read more about it [in the blog post](https://reactnative.dev/blog/2019/03/12/releasing-react-native-059) ([c493cfe708](https://github.com/facebook/react-native/commit/c493cfe7083a6b97b6ec9eb9cb59cf1fdec45458) by [@dulmandakh](https://github.com/dulmandakh)) +- Add nullable annotations to `ReadableMap`, `WritableMap`, `ReadableArray`, `Writable`, `ReactPackage`, and native module interfaces; this may impact Kotlin usage ([b640b6faf7](https://github.com/facebook/react-native/commit/b640b6faf77f7af955e64bd03ae630ce2fb09627), [c93cbdf1b2](https://github.com/facebook/react-native/commit/c93cbdf1b272cfd60124d9ddb4c52b58ca59d319), [7b33d6b0b9](https://github.com/facebook/react-native/commit/7b33d6b0b96578a548e9a7f973eb59ac9236697b), and [84f40da990](https://github.com/facebook/react-native/commit/84f40da990dfd21eb1c21e20f2be0f8b2c5a78e4) by [@dulmandakh](https://github.com/dulmandakh)) +- `Soloader` is now at `v0.6.0` ([07d1075f37](https://github.com/facebook/react-native/commit/07d1075f372bb864ddc62b9c8f613b03becfa568) by [@dulmandakh](https://github.com/dulmandakh)) +- Android Support Library is now at `v28.0.0` ([5bbed43854](https://github.com/facebook/react-native/commit/5bbed43854957a37c4b51f49f30669665a72e7f7) by [@dulmandakh](https://github.com/dulmandakh)) +- `targetSdkVersion` is now at `v28` ([57f444bd8a](https://github.com/facebook/react-native/commit/57f444bd8a175038c367fa1b7d93e2e8ba9de7ed) by [@dulmandakh](https://github.com/dulmandakh)) +- Android Plugin is now at `v3.3.1` ([da5b5d2fa1](https://github.com/facebook/react-native/commit/da5b5d2fa134aa09dda4a620be9fa4d3d419201f) by [@dulmandakh](https://github.com/dulmandakh)) +- Enable Java 8 support ([38eb2a70af](https://github.com/facebook/react-native/commit/38eb2a70afa87c49c1e62754f5ae3cd26e7f59c3) by [@dulmandakh](https://github.com/dulmandakh)) +- Suppress misleading missing permission warnings ([d53dbb0dfb](https://github.com/facebook/react-native/commit/d53dbb0dfb99bdee5cd7eeaaa6f4ae51dcca00c5) by [@dulmandakh](https://github.com/dulmandakh)) +- Add back `buildToolsVersion` to build.gradle ([cf52ab561d](https://github.com/facebook/react-native/commit/cf52ab561d9fa0e4d14de7a8f3324cbc2b25bf92) by [@dulmandakh](https://github.com/dulmandakh)) +- **TimePickerAndroid** has better Flow types definitions ([2ed1bb2e01](https://github.com/facebook/react-native/commit/2ed1bb2e01ab7360d9bf13e4f9e13cb9c9c9d32e) by [@yushimatenjin](https://github.com/yushimatenjin)) +- `ReactActivity`, `ReactSlider`, `ReactTextView`, and `ReactPicker` extends `AppCompatActivity`; updates to `TimePickerDialogModule` and `DatePickerDialogModule` as well ([dda2b82a0a](https://github.com/facebook/react-native/commit/dda2b82a0a49da52b43b50db5a2bda50a216c09b), [3b9604feda](https://github.com/facebook/react-native/commit/3b9604feda8f9e8fe3dd884912ec7d9be67d7f1d), [ba0c3ffd5b](https://github.com/facebook/react-native/commit/ba0c3ffd5b46963a8bb27b40eb396965535cd927), [833429dd63](https://github.com/facebook/react-native/commit/833429dd633b33fff71224a7ce663b60681a7f81), [adc1410572](https://github.com/facebook/react-native/commit/adc14105727f708c990b7a744a0ea270ff0fba13), [c6c5a173bc](https://github.com/facebook/react-native/commit/c6c5a173bce3d8c847931d26eddb295956285438), and [be361d0fc1](https://github.com/facebook/react-native/commit/be361d0fc1930b1679c4226e15c1a5b416b94105) by [@dulmandakh](https://github.com/dulmandakh)) +- Fix lint error/warnings that cause older Android crashes ([d2fc19f4aa](https://github.com/facebook/react-native/commit/d2fc19f4aa94888b7c3d3f4a5fb621bf96a1aff9) by [@dulmandakh](https://github.com/dulmandakh)) +- The error message on getting Android drawable folder suffix now gives more information ([a159a33c02](https://github.com/facebook/react-native/commit/a159a33c02e0c0d7aa245adfd540a066ec065362) by [@BrunoVillanova](https://github.com/BrunoVillanova)) +- `SYSTEM_ALERT_WINDOW` permissions available only in debug builds ([84a2fb0a4a](https://github.com/facebook/react-native/commit/84a2fb0a4a67cd9dc37cf4e5bab814f25181cfb7) by [@dulmandakh](https://github.com/dulmandakh)) +- Add talkback navigation support for links and header ([b9d3743cda](https://github.com/facebook/react-native/commit/b9d3743cda95d1f475dbec8f6d72935941519deb) by [@yangweigbh](https://github.com/yangweigbh)) +- **FlatList** has `removeClippedSubviews` default to `true` on Android ([1a499f43b2](https://github.com/facebook/react-native/commit/1a499f43b2d03cc27dd6c25c8f13a767862afba1) by [@fred2028](https://github.com/fred2028)) + +#### iOS specific + +- Moved iOS build cache directory from `~/.rncache` to `~/Library/Caches/com.facebook.ReactNativeBuild` ([1024dc251e](https://github.com/facebook/react-native/commit/1024dc251e1f4777052b7c41807ea314672bb13a) by [@sryze](https://github.com/sryze)) +- Keyboard API Event flow types have been improved ([7ee13cc84c](https://github.com/facebook/react-native/commit/7ee13cc84c342244d3aa9e485de0e759482287ea) by [@nossbigg](https://github.com/nossbigg)) +- Expose **AsyncLocalStorage** get/set methods to native code ([7b8235a95a](https://github.com/facebook/react-native/commit/7b8235a95ad9519e9735cc1555a8d3aa5bb7c0ee) by [@ejmartin504](https://github.com/ejmartin504)) +- Clear RCTBridge **launchOptions** when bridge is reloaded ([19d04a312b](https://github.com/facebook/react-native/commit/19d04a312bf4221cd26beff6d0da6dd296a28cd0) by [@venik](https://github.com/venik)) + +### Deprecated + +The following deprecations are part of our Lean Core initiative; read more about it [in the blog post](https://reactnative.dev/blog/2019/03/12/releasing-react-native-059). + +- Deprecated [MaskedViewIOS](https://reactnative.dev/docs/maskedviewios) as it has now been moved to [react-native-community/masked-view](https://github.com/react-native-community/react-native-masked-view) ([4ac65f5413](https://github.com/facebook/react-native/commit/4ac65f5413ee59f7546b88a2eae2c4ce6fa8826b) by [@FonDorn](https://github.com/FonDorn)) +- Deprecated [ViewPagerAndroid](https://reactnative.dev/docs/viewpagerandroid) as it has now been moved to [react-native-community/viewpager](https://github.com/react-native-community/react-native-viewpager) ([77300ca91c](https://github.com/facebook/react-native/commit/77300ca91c17d371f6ba04230b8c2e8f5cd99ab8) by [@ferrannp](https://github.com/ferrannp)) +- Deprecated [AsyncStorage](https://reactnative.dev/docs/asyncstorage) as it has now been moved to [react-native-community/asyncstorage](https://github.com/react-native-community/react-native-async-storage) ([ffe37487b2](https://github.com/facebook/react-native/commit/ffe37487b228b77a3697c32767e91f1dd68041d8) by [@Krizzu](https://github.com/Krizzu)) +- Deprecated [Slider](https://reactnative.dev/docs/slider) as it has now been moved to [react-native-community/slider](https://github.com/react-native-community/react-native-slider) ([bf888a7582](https://github.com/facebook/react-native/commit/bf888a7582763a593d8b36874d242653fc0a9575) by [@michalchudziak](https://github.com/michalchudziak)) +- Deprecated [NetInfo](https://reactnative.dev/docs/netinfo) as it has now been moved to [react-native-community/netinfo](https://github.com/react-native-community/react-native-netinfo) ([d9c0dfe353](https://github.com/facebook/react-native/commit/d9c0dfe353eceb91efcec774bab0f65b6792e4fa) by [@matt-oakes](https://github.com/matt-oakes)) +- Deprecated [ImageStore](https://reactnative.dev/docs/imagestore) and directed users to `expo-file-system` and `react-native-fs` ([62599fa8ff](https://github.com/facebook/react-native/commit/62599fa8ff7f308259fe178fa37b7bcf3c1a408c) by [@EvanBacon](https://github.com/EvanBacon)) + +#### iOS specific + +- Replace deprecated `stringByReplacingPercentEscapesUsingEncoding:` with `stringByAddingPercentEncodingWithAllowedCharacters:` ([61ca119650](https://github.com/facebook/react-native/commit/61ca11965046f75e7500e5152c5f2b60df2a2cd5) by [@pvinis](https://github.com/pvinis)) + +### Removed + +- `react-native-git-upgrade` is now officially dead; use `react-native upgrade` instead (which uses [rn-diff-purge](https://github.com/react-native-community/rn-diff-purge) under the covers) ([a6bdacb257](https://github.com/facebook/react-native/commit/a6bdacb2575dcc3be2acec95d8a6db6e2db909c4) by [@cpojer](https://github.com/cpojer)) + +#### iOS specific + +- Remove the previously deprecated **TabBarIOS** ([02697291ff](https://github.com/facebook/react-native/commit/02697291ff41ddfac5b85d886e9cafa0261c8b98) by [@axe-fb](https://github.com/axe-fb)) +- **AlertIOS** is now replaced with **Alert** ([e2bd7db732](https://github.com/facebook/react-native/commit/e2bd7db732602b2c477fe040f2946bd8293df297) by [@wellmonge](https://github.com/wellmonge)) + +### Fixed + +- **KeyboardAvoidingView** now shows the correct height after the keyboard is toggled ([745484c892](https://github.com/facebook/react-native/commit/745484c892e40cfe15ded128f5a589edb28d8f6b) by [@shauns](https://github.com/shauns)) +- Adds fixes for react-native-windows UWP ([dfcbf9729f](https://github.com/facebook/react-native/commit/dfcbf9729fab64c4bd8c00e1d092ec4e9bae717f) by [@rozele](https://github.com/rozele)) +- The `Map` and `Set` polyfills no longer reject non-extensible object keys; also fix hash collision scenario ([90850cace9](https://github.com/facebook/react-native/commit/90850cace9991ed0a02605586ea5c32ce099de65) by [@benjamn](https://github.com/benjamn)) +- Corrected StyleSheet's transformation perspective to match iOS's behavior, regardless of screen density ([4c10f9321c](https://github.com/facebook/react-native/commit/4c10f9321c9d01dbcac4808e7e6674cba12f3aa5) by [@syaau](https://github.com/syaau)) +- Fix `yarn test` in new projects ([5218932b13](https://github.com/facebook/react-native/commit/5218932b13ad0649ff2a57aaf1ec682fe278c47d) by [@Esemesek](https://github.com/Esemesek)) +- Fix issue with `getInspectorDataForViewTag` that caused red screen when toggling inspector ([46f3285a3f](https://github.com/facebook/react-native/commit/46f3285a3f240f9325a548e677a1927402d76bd7) by [@TranLuongTuanAnh](https://github.com/TranLuongTuanAnh)) +- Fix `displayName` for `Image`; this will make tests no longer mistake it as `Component` ([4989123f8c](https://github.com/facebook/react-native/commit/4989123f8cab37c95b020e23b9a925746a3f3677) by [@linnett](https://github.com/linnett)) +- Fix regression of **VirtualizedList** jumpy header ([e4fd9babe0](https://github.com/facebook/react-native/commit/e4fd9babe03d82fcf39ba6a46376f746a8a3e960) by [@danilobuerger](https://github.com/danilobuerger)) +- Set `wait_for_recheck=true` to work around crash in Flow ([ffc9908bef](https://github.com/facebook/react-native/commit/ffc9908bef535ba1392c370ca4e9e4e528c3c4c5) by [@gabelevi](https://github.com/gabelevi)) +- Fix flow typing of **Text** ([10c8352141](https://github.com/facebook/react-native/commit/10c835214160cc5a5726c8dd9f0d42a0275d198b) by [@sahrens](https://github.com/sahrens)) +- Fix `jest` and `jest-junit` to be only development dependencies ([c7b57f1986](https://github.com/facebook/react-native/commit/c7b57f19869f31474c8ee17f7a1ac1551bab1b6e) by [@vovkasm](https://github.com/vovkasm)) +- Fix layout issue with **SwipeableQuickActionButton** ([ad52f52624](https://github.com/facebook/react-native/commit/ad52f526247af6eebadd2ea436b86ff7eb874f27) by [@varungupta85](https://github.com/varungupta85)) + +#### Android specific + +- Fix textTransform when used with other text styles on Android (#22670) ([3a33e75183](https://github.com/facebook/react-native/commit/3a33e75183bf196d61b46e662b4c3f84a5f570bd) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix warnings related to updating to gradle 4.10.1 or higher ([5be50d4820](https://github.com/facebook/react-native/commit/5be50d482082917351b46ee2e339e56e7e34e111) by [@misaku](https://github.com/misaku)) +- Fix issue with use of Android API 28 by adding security config for metro access ([5747094532](https://github.com/facebook/react-native/commit/5747094532bace3fe6b1ebdf55235e53189baa71), [19492b730b](https://github.com/facebook/react-native/commit/19492b730b6779486f83d5ddbaeeb870cb3d5e9c), [3b0b7ce8c3](https://github.com/facebook/react-native/commit/3b0b7ce8c3c3679610c14ca72beb1a9dcf84d930), and [84572c4051](https://github.com/facebook/react-native/commit/84572c4051f11f68ddf0928d2c3df5850ae15491) by [@Salakar](https://github.com/Salakar) and [@dulmandakh](https://github.com/dulmandakh)) +- Fix Inverted Horizontal **ScrollView** ([32cb9ec49c](https://github.com/facebook/react-native/commit/32cb9ec49c801fcebe61486149134ab542d9364b) by [@dmainas](https://github.com/dmainas)) +- Fix crash on **CheckBox** on older Android versions ([58437cd10a](https://github.com/facebook/react-native/commit/58437cd10a667bbcbc16781df855fd7c3d73bf49) by [@vonovak](https://github.com/vonovak)) +- Fix undefined error description in **Image** `onError` callback ([7795a672d3](https://github.com/facebook/react-native/commit/7795a672d3a24a5b50df6ad6d30555d856b557cc) by [@Jyrno42](https://github.com/Jyrno42)) +- Fix Android crash on animating with `useNativeDriver` ([e405e84fc3](https://github.com/facebook/react-native/commit/e405e84fc35923888442df748757787698040010) by [@scisci](https://github.com/scisci)) +- Fix dev settings menu not appearing for certain codebases due to namespace conflicts ([9968d0c203](https://github.com/facebook/react-native/commit/9968d0c2030c1065979db34cc9a244bd52b7b2a5) by [@khaled-cliqz](https://github.com/khaled-cliqz)) +- Fix exception occurring while fading a **TextView** ([f83281e2ce](https://github.com/facebook/react-native/commit/f83281e2ce2aece44b1207844d8a5149d5d2e78d) by [@mdvacca](https://github.com/mdvacca)) +- Fix **StatusBar** overwriting previously set `SystemUiVisibility` flags ([8afa0378cd](https://github.com/facebook/react-native/commit/8afa0378cd09b8fa6c30d759539fc9a680e8cae2) by [@rogerkerse](https://github.com/rogerkerse)) +- Prevent `fetch()` POST requests from appending `charset=utf-8` to `Content-Type` header ([4a807761a4](https://github.com/facebook/react-native/commit/4a807761a4aca9e551ff2cee8ca18a2450fb11ca) and [0d5aebbd9a](https://github.com/facebook/react-native/commit/0d5aebbd9ac92a90ec7ab1426ed92dd22ae8c736) by [@nhunzaker](https://github.com/nhunzaker)) +- Fix issue with **Location** that led to exceptions in two cases ([f32dc63546](https://github.com/facebook/react-native/commit/f32dc635467a2e93371f0cf2e40b07a712349288) by [@mikelambert](https://github.com/mikelambert)) + +#### iOS specific + +- Fix **TextInput** mistakenly capitalizing I's after emojiis ([f307ac7c5e](https://github.com/facebook/react-native/commit/f307ac7c5e3adb9b4c0f8b2e4b8cdc2f980c7733) by [@dchersey](https://github.com/dchersey)) +- Fix **TextView**'s `setAttributedText` for CJK languages on single-line text fields ([e38be82dfa](https://github.com/facebook/react-native/commit/e38be82dfa8b49385b990629318f027de26500cf) by [@mandrigin](https://github.com/mandrigin)) +- Fix RCTImageLoader multi thread crash ([5ed31ce524](https://github.com/facebook/react-native/commit/5ed31ce5240a7392afdc522120edef182e0014ed)) +- Fix removing keys of large values from **AsyncStorage** ([27b4d21564](https://github.com/facebook/react-native/commit/27b4d215641f9397ef415cbb2acfc1275e6110ac) by [@esprehn](https://github.com/esprehn)) +- Fix overscroll behavior on virtualized lists; behavior is now consistent ([4d5f85ed42](https://github.com/facebook/react-native/commit/4d5f85ed426cfb43dc5e63f915e416a47d76b965)) +- Fix **Alert** to not block input focus and blur ([e4364faa3c](https://github.com/facebook/react-native/commit/e4364faa3cab150b82272819fc92086fb4da297e) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix broken JSIexecutor search path ([2aa2401766](https://github.com/facebook/react-native/commit/2aa24017667721ba17a859ca4e13d43e52d86bc5) by [@amccarri](https://github.com/amccarri)) +- Fix potential linker issues when using Xcode project ([9f72e6a5d0](https://github.com/facebook/react-native/commit/9f72e6a5d02d84fe8ed545e0c0904199b9cb3c7a) by [@tyrone-sudeium](https://github.com/tyrone-sudeium)) +- Fix crash when `scrollEnabled` used in singleline textinput ([9ff43abe65](https://github.com/facebook/react-native/commit/9ff43abe653ac5af0e591b369228f0809caad204) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix crash in gif image usage ([d0cd3cae13](https://github.com/facebook/react-native/commit/d0cd3cae13a1b1fff8a2e378b5228d3cdccd695f) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix **geolocation** to not constantly reset accuracy to default of 100 meters ([bbcb97a29a](https://github.com/facebook/react-native/commit/bbcb97a29adc2a3a05728b47d28e28fa78d84df2) by [@omnikron](https://github.com/omnikron)) +- Fix iOS build issue related to missing `DoubleConversion` and `glog` to `cxxreact`, `jsi` and `jsiexecutor` subspecs in `React.podspec` file ([00392ac46b](https://github.com/facebook/react-native/commit/00392ac46b6319dcff2b6df2e5f7bb4ee094612f) by [@alexruperez](https://github.com/alexruperez)) +- Fix "'folly/folly-config.h' file not found" build error when using React via CocoaPods ([5560a47c1d](https://github.com/facebook/react-native/commit/5560a47c1dbc7daab1e4f4aac0667080fdea836a) by [@Salakar](https://github.com/Salakar)) +- Fix image cache to follow [MDN strategy](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#Freshness) ([fb8ba3fe95](https://github.com/facebook/react-native/commit/fb8ba3fe959fd2a0c4ef0025fd84f6deffd9d03b) and [fb8ba3fe95](https://github.com/facebook/react-native/commit/fb8ba3fe959fd2a0c4ef0025fd84f6deffd9d03b) by [@zhongwuzw](https://github.com/zhongwuzw)) +- Fix crash due to IllegalArgumentException when creating CookieManage ([cda8171af3](https://github.com/facebook/react-native/commit/cda8171af30815edfa331e07d1bbf605f0926303) by [@mdvacca](https://github.com/mdvacca)) +- Fix cursor placement after toggling `secureTextEntry` cursor spacing ([8ce3c1b43e](https://github.com/facebook/react-native/commit/8ce3c1b43edd47191c8e5ee8432c58f6e93dfca7) by [@ericlewis](https://github.com/facebook/react-native/commits?author=ericlewis)) + +## v0.58.6 + +This release is fairly small, as we approach stable status for [0.59](https://github.com/react-native-community/react-native-releases/issues/79). + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/95) for cherry-picking commits - you can participate in the decision process for the next patch release [here](https://github.com/react-native-community/react-native-releases/issues/97). + +### Fixed + +#### Android specific + +- Fix Inverted Horizontal ScrollView on Android (#23233) ([32cb9ec49c](https://github.com/facebook/react-native/commit/32cb9ec49c801fcebe61486149134ab542d9364b) by [@dmainas](https://github.com/dmainas)) + +#### iOS specific + +- Map TextInput textContentType strings to Objective-C constants (#22611) ([a89fe4165c](https://github.com/facebook/react-native/commit/a89fe4165c2a331a9d88636d89a5a48151ab8660) by [@levibuzolic](https://github.com/levibuzolic)) +- Don't reconnect inspector if connection refused (#22625) ([d9489c4e9c](https://github.com/facebook/react-native/commit/d9489c4e9c646b79025f07635b840e9974be8cd5) by [@msand](https://github.com/msand)) + +## v0.58.5 + +This release resolves a few bugs and includes a few improvements, listed below. + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/86) for cherry-picking commits - you can participate in the decision process for the next patch release [here](https://github.com/react-native-community/react-native-releases/issues/95). + +### Removed + +- Remove fallback cache ([9d60c20cb3](https://github.com/facebook/react-native/commit/9d60c20cb35074e92a90b803d3d6f420f6671635) by [@grabbou](https://github.com/grabbou)) + +### Fixed + +- Fixes capitalized I's when emojis are present after the text being edited. (#21951) ([f307ac7c5e](https://github.com/facebook/react-native/commit/f307ac7c5e3adb9b4c0f8b2e4b8cdc2f980c7733) by [@dchersey](https://github.com/dchersey)) +- Fix broken jsiexecutor search path. (#23274) ([2aa2401766](https://github.com/facebook/react-native/commit/2aa24017667721ba17a859ca4e13d43e52d86bc5) by [@amccarri](https://github.com/amccarri)) +- Fix duplicate symbols linker error in xcodeproj (#23284) ([9f72e6a5d0](https://github.com/facebook/react-native/commit/9f72e6a5d02d84fe8ed545e0c0904199b9cb3c7a) by [@tyrone-sudeium](https://github.com/tyrone-sudeium)) +- apply Network Security Config file (fixes #22375) (part 2 of #23105) (#23135) ([84572c4051](https://github.com/facebook/react-native/commit/84572c4051f11f68ddf0928d2c3df5850ae15491) by [@Salakar](https://github.com/Salakar)) +- Fix crash for web socket in some race conditions (#22439) ([dd209bb789](https://github.com/facebook/react-native/commit/dd209bb7891ed5f05b96a9922c7b0e39bf3ac9e9) by [@zhongwuzw](https://github.com/zhongwuzw)) + +#### iOS specific + +- Don't attempt to load RCTDevLoadingView lazily ([a9dd828c68](https://github.com/facebook/react-native/commit/a9dd828c68338dbf0e55ffa1838bf8ff574f317d) by [@fkgozali](https://github.com/fkgozali)) + +### Security + +#### Android specific + +- improve Android Network Security config (#23429) ([5747094532](https://github.com/facebook/react-native/commit/5747094532bace3fe6b1ebdf55235e53189baa71) by [@dulmandakh](https://github.com/dulmandakh)) + +## v0.58.4 + +This release resolves a few bugs and includes a few improvements, listed below. + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/81) for cherry-picking commits - you can participate in the decision process for the next patch release [here](https://github.com/react-native-community/react-native-releases/issues/86). + +### Added + +#### Android specific + +- Add error description to Image onError callback ([7795a672d3](https://github.com/facebook/react-native/commit/7795a672d3a24a5b50df6ad6d30555d856b557cc) by [@Jyrno42](https://github.com/Jyrno42)) + +### Changed + +#### Android specific + +- bump soloader to `0.6.0` ([07d1075f37](https://github.com/facebook/react-native/commit/07d1075f372bb864ddc62b9c8f613b03becfa568) by [@dulmandakh](https://github.com/dulmandakh)) + +### Removed + +- Remove jest and jest-junit from runtime dependencies (#23276) ([c7b57f1986](https://github.com/facebook/react-native/commit/c7b57f19869f31474c8ee17f7a1ac1551bab1b6e) by [@vovkasm](https://github.com/vovkasm)) + +### Fixed + +#### Android specific + +- Fixes Android crash on animated style with string rotation ([e405e84fc3](https://github.com/facebook/react-native/commit/e405e84fc35923888442df748757787698040010) by [@scisci](https://github.com/scisci)) + +#### iOS specific + +- fix incorrect type which makes animated gifs not loop forever on device (#22987) ([728a35fcf2](https://github.com/facebook/react-native/commit/728a35fcf2a2b0d695a4d7083b266eda486b1392) by [@chrisnojima](https://github.com/chrisnojima)) +- Fixes for running the simulator ([9a8c9596eb](https://github.com/facebook/react-native/commit/9a8c9596ebe41e27d37ba18d6bf09f1c931c1ff2) by [@osunnarvik](https://github.com/osunnarvik)), ([98bcfe00fb](https://github.com/facebook/react-native/commit/98bcfe00fbca066d6914a2680c3647b678caccc5) by [@cpojer](https://github.com/cpojer)) and ([8bddcb6cb0](https://github.com/facebook/react-native/commit/8bddcb6cb0914373a0aeb927f12a6d48ffc5bb84) by [@cpojer](https://github.com/cpojer)) + +## v0.58.3 + +This release resolves a regression in **StatusBar** using [these fixes](https://github.com/facebook/react-native/compare/v0.58.2...v0.58.3). + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/81) for cherry-picking commits - you can participate in the decision process for the next patch release [here](https://github.com/react-native-community/react-native-releases/issues/81). + +## v0.58.2 + +This release fixes an issue caused by a wrongly reverted merge commit, that caused a short timeframe of commits to not actually be in the original 0.58.0. Those commits have been added to the 0.58 changelog below, as many are intertwined with the original work. + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/81) for cherry-picking commits - you can participate in the decision process for the next patch release [here](https://github.com/react-native-community/react-native-releases/issues/81). + +## v0.58.1 + +There were some regressions with developer tools that prevented `react-native run-ios` from working properly in 0.58.0; this patch fix addresses that. + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/81) for cherry-picking commits - you can participate to the decision process for the next patch release [here](https://github.com/react-native-community/react-native-releases/issues/81). + +## v0.58.0 + +Welcome to first stable release of React Native of 2019! +There are a number of significant changes in this version, and we'd like to especially draw your attention to them: + +- [Modernizing](https://github.com/facebook/react-native/issues/21581) and [strengthening flow types](https://github.com/facebook/react-native/issues/22100) for core components +- Breaking changes to `ScrollView`, `CameraRollView`, and `SwipeableRow` that make it no longer bound to the component instance in certain methods +- Support for mutual TLS in WebKit +- Asset serving from directories besides `/assets` +- Numerous crash fixes and resolutions for unexpected behavior + +Aside from those: + +- if you are an iOS developer, you'll need to manually link `JavaScriptCore.framework` when upgrading; this can be done via Xcode, and following the steps shown [here](https://camo.githubusercontent.com/c09cd42747364b498efa7c82fcb73978ba076eae/687474703a2f2f646f63732e6f6e656d6f62696c6573646b2e616f6c2e636f6d2f696f732d61642d73646b2f616464696e672d6672616d65776f726b732e706e67). + +- Android developers, please note that Android's target SDK 27 is supported. Work is still underway to land target SDK 28 support, and it will come soon. + +Thanks to those who gave feedback during the [release candidate phase](https://github.com/react-native-community/react-native-releases/issues/41). If you're interested in helping evaluate our next release (0.59), subscribe to the dedicated issue [here](https://github.com/react-native-community/react-native-releases/issues/79). + +### Added + +- Add support for `publicPath` to enable serving static assets from different locations ([0b314960aa](https://github.com/facebook/react-native/commit/0b314960aa34c71fc731bac9c1f2b48f3223c5cb) by [@gdborton](https://github.com/gdborton)) +- Add **TouchableBounce** now has a simple `bounce()` function that can be used to trigger a bounce without callbacks ([7fe3f90156](https://github.com/facebook/react-native/commit/7fe3f90156e879fe53665efb5a90ba3a711475fa)) + +#### Android specific + +- Bundler server host can now be set using Android System Properties, making for easier debugging across multiple apps or app installs `adb shell setprop metro.host` ([e02a154787](https://github.com/facebook/react-native/commit/e02a154787274be1da3632cb1412554cbd53928b) by [@stepanhruda](https://github.com/stepanhruda)) +- Native Modules can now reject a promise with an additional `WritableMap` arg for extra properties (`userInfo`). See the interface defined in [`Promise.java`](https://github.com/facebook/react-native/blob/60b3942/ReactAndroid/src/main/java/com/facebook/react/bridge/Promise.java) for available methods. This is accessible in JavaScript as `Error.userInfo`. This is to match iOS's existing `Error.userInfo` behavior. See PR for examples. (#20940 by @Salakar) +- Native Modules now expose a `nativeStackAndroid` property to promises rejected with an Exception/Throwable - making native error stacks available inside Javascript: `Error.nativeStackAndroid`. This is to match iOS's existing `Error.nativeStackIOS` support. See PR for examples. (#20940 by @Salakar) + +#### iOS specific + +- Add `moduleForName: lazilyLoadIfNecessary` to **RCTBridge.h** to lookup modules by name and force load them, plus various improvements to LazyLoading ([d7a0c44590](https://github.com/facebook/react-native/commit/d7a0c44590bcf3fb9d055aeae3391d5bcd7e21be), [6534718a18](https://github.com/facebook/react-native/commit/6534718a1898aa472e255d2aa9a0a6cae305619a), [d7865ebde8](https://github.com/facebook/react-native/commit/d7865ebde879983b355d6f6e64232e4bd264081d), [04ea9762e2](https://github.com/facebook/react-native/commit/04ea9762e2013dcebf9f8a51d8974fa799e41cd5), [1f394fa673](https://github.com/facebook/react-native/commit/1f394fa673a876753fdc9ac2cb86a4d4a58cd8cd), [80f92adf1f](https://github.com/facebook/react-native/commit/80f92adf1f35e74ee6db0b2f445cc851463059cf), and [81b74ec1ed](https://github.com/facebook/react-native/commit/81b74ec1ed3792c0b406c30b0a1c01219a2d6243) by [@dshahidehpour](https://github.com/dshahidehpour), [@fkgozali](https://github.com/fkgozali), and [@mmmulani](https://github.com/mmmulani)) +- Add ability for **WebView** to `setClientAuthenticationCredential` when `useWebKit={true}` for mutual TLS authentication ([8911353c47](https://github.com/facebook/react-native/commit/8911353c47af018f78c1cff59dfab05b975e39ed) and [8911353c47](https://github.com/facebook/react-native/commit/8911353c47af018f78c1cff59dfab05b975e39ed) by [@mjhu](https://github.com/mjhu)) + +### Changed + +- Major improvements to Flow types for Core Components ([499c195eba](https://github.com/facebook/react-native/commit/499c195ebab0f276e3a58baf1e6172c1ba046a9e), [fbc5a4f5e6](https://github.com/facebook/react-native/commit/fbc5a4f5e65e024c10ad43d84f2b2353c9e92461), [f9050e0908](https://github.com/facebook/react-native/commit/f9050e09084cf3700bfc1954f97adf0f60cd8d88), [6476151717](https://github.com/facebook/react-native/commit/6476151717f44d3a90679f0f5293bed62a4f420e), [c03fc4087f](https://github.com/facebook/react-native/commit/c03fc4087ff9ac3ccbd1ab2261a1af329b354d99), [69213eea95](https://github.com/facebook/react-native/commit/69213eea9512c81ed998d240a6f5a3be05346b48), [136dfc8312](https://github.com/facebook/react-native/commit/136dfc831230e5418db02d1202e60d23a95c17b6), [3c0211b61a](https://github.com/facebook/react-native/commit/3c0211b61a1e723c3aaeba42c61b60bc724a3729), [c127000a7d](https://github.com/facebook/react-native/commit/c127000a7d2bb54599c9d80503528c3e8d75fddc), [636e146c4a](https://github.com/facebook/react-native/commit/636e146c4a27990547c81c2d36411d36b2c8e788), [c3dea894bd](https://github.com/facebook/react-native/commit/c3dea894bdb07d0b7ec18ab0388626d0340e6b69), [35a65cd704](https://github.com/facebook/react-native/commit/35a65cd704f2da67cd759c4d91251f8d4964b251), [79274979b7](https://github.com/facebook/react-native/commit/79274979b775e89d5f54a557a34062f873134199), [45c51835d6](https://github.com/facebook/react-native/commit/45c51835d69e111b67b4fcf1af39a13f7df1ee48), [a97d104b44](https://github.com/facebook/react-native/commit/a97d104b44daa068fa3848cc6c3225356f9dc318), [fb4825a2c6](https://github.com/facebook/react-native/commit/fb4825a2c65fba3aa905f7defb7d0c125fff644d), [84c5416617](https://github.com/facebook/react-native/commit/84c541661729dd20ab260c7468e48abbbe82affb), [3649a503cf](https://github.com/facebook/react-native/commit/3649a503cf52feac0386b4a10aab5ef6c4ec5ca0) by [@mottox2](https://github.com/mottox2), [@saitoxu](https://github.com/saitoxu), [@RSNara](https://github.com/RSNara), [@watanabeyu](https://github.com/watanabeyu), [@Tnarita0000](https://github.com/Tnarita0000), [@exced](https://github.com/exced), [@nd-02110114](https://github.com/nd-02110114), [@flowkraD](https://github.com/flowkraD)) +- Many public components were converted to ES6 classes ([ScrollView](https://github.com/facebook/react-native/commit/010e3302b8101287f231254086f3a8788a5a2c3e) by [@thymikee](https://github.com/thymikee), [CameraRollView](https://github.com/facebook/react-native/pull/21619), [SwipeableRow](https://github.com/facebook/react-native/pull/21876/files) and [ProgressBarAndroid](https://github.com/facebook/react-native/pull/21874) by [@exceed](https://github.com/exceed), [ProgressViewIOS](https://github.com/facebook/react-native/pull/21588) by [@empyrical](https://github.com/empyrical), [SegmentedControlIOS](https://github.com/facebook/react-native/pull/21888/files), [ToolbarAndroid](https://github.com/facebook/react-native/pull/21893/files) by [@nd-02110114](https://github.com/nd-02110114) +- Flow dependency is now at `v0.85.0` ([adc8a33fcf](https://github.com/facebook/react-native/commit/adc8a33fcfeb8fc163f48ae4a4bc5aaac98bcb0d) by [@samwgoldman](https://github.com/samwgoldman)) +- metro dependency is now at `v0.49.1` ([f867db366a](https://github.com/facebook/react-native/commit/f867db366aa4f0ead5a20c0d3154ca58be43fc20), [88882951e1](https://github.com/facebook/react-native/commit/88882951e1607b0af6f1772ef13135e037f9c4e3), [31bb551e75](https://github.com/facebook/react-native/commit/31bb551e75bda155b4821381e5497dc423326e3c), [de60e8643a](https://github.com/facebook/react-native/commit/de60e8643ac4e13a7f92175351268dd3c3e768db), and [de60e8643a](https://github.com/facebook/react-native/commit/de60e8643ac4e13a7f92175351268dd3c3e768db) by [@alexkirsz](https://github.com/alexkirsz) and [@rafeca](https://github.com/rafeca)) +- jest dependency is now at `v24.0.0-alpha.6` ([1b4fd64325](https://github.com/facebook/react-native/commit/1b4fd643256817d29163b37101da612867a225a1), [66aba09251](https://github.com/facebook/react-native/commit/66aba092514abd2b278a4fb66c30abffbdd5d5ff), and [06c13b3e06](https://github.com/facebook/react-native/commit/06c13b3e066636b414f5dc19c919dcb138763c71) by [@rafeca](https://github.com/rafeca) and [@rubennorte](https://github.com/rubennorte)) +- fbjs-scripts dependency is now at `v1.0.0` (#21880) ([cdbf719307](https://github.com/facebook/react-native/commit/cdbf719307f41e94a62307ec22463bb562d1c8de) by [@jmheik](https://github.com/jmheik)) +- folly dependency is now at `v2018.10.22.00` ([a316dc6ec3](https://github.com/facebook/react-native/commit/a316dc6ec34655981c0f226186f4fb668e4a01e2), [287934dba9](https://github.com/facebook/react-native/commit/287934dba943cd954164bde8b06f9ba85940b45f), and [a70625abd7](https://github.com/facebook/react-native/commit/a70625abd7bf4fba3dafb8a969a73854b7ddcd42) by [@Kudo](https://github.com/Kudo) and [@radko93](https://github.com/radko93)) +- React is set to `16.6.3` now via sync for revisions 4773fdf...6bf5e85 ([0cb59b5c23](https://github.com/facebook/react-native/commit/0cb59b5c23b76771a30f59cdcedaa3c95c4dd280) and [073ad6a036](https://github.com/facebook/react-native/commit/073ad6a0367c3156e03680c0ab0648feed2bf89c) by [@yungsters](https://github.com/yungsters)) +- Clearer error messages when hot reloading ([c787866d64](https://github.com/facebook/react-native/commit/c787866d644be4c8d30bb17c237a50fdd6e1a82d) by [@alexkirsz](https://github.com/alexkirsz)) +- Allow CxxModules to implement functions which take two callbacks ([8826d8b233](https://github.com/facebook/react-native/commit/8826d8b233c1e3325a575d5012b713c4786e6062) by [@acoates-ms](https://github.com/acoates-ms)) + +#### Breaking Changes 💥 + +- Public methods of components converted to ES6 classes are no longer bound to their component instance. For `ScrollView`, the affected methods are `setNativeProps`, `getScrollResponder`, `getScrollableNode`, `getInnerViewNode`, `scrollTo`, `scrollToEnd`, `scrollWithoutAnimationTo`, and `flashScrollIndicators`. For `CameraRollView`, the affected methods are: `rendererChanged`. For `SwipeableRow`, the affected methods are: `close`. Therefore, it is no longer safe to pass these method by reference as callbacks to functions. Auto-binding methods to component instances was a behaviour of `createReactClass` that we decided to not preserve when switching over to ES6 classes. (you can refer to [this example](https://github.com/react-native-community/react-native-releases/issues/81#issuecomment-459252692)) +- Native Modules in Android now require `@ReactModule` annotations to access `.getNativeModule` method on the `ReactContext`. This is how your updated Native Module should look like: + + ```diff + // CustomModule.java + + // ... + + import com.facebook.react.module.annotations.ReactModule; + + + @ReactModule(name="CustomBridge") + public class CustomModule extends ReactContextBaseJavaModule { + // ... + + @Override + public String getName() { + return "CustomBridge"; + } + + // ... + } + ``` + +#### Android specific + +- Optimize `PlatformConstants.ServerHost`, `PlatformConstants.isTesting`, and `PlatformConstants.androidID` for performance ([2bf0d54f15](https://github.com/facebook/react-native/commit/2bf0d54f155c28244fa60230871b3eed60a20c6d), [339d9d3afb](https://github.com/facebook/react-native/commit/339d9d3afba45bb28073db59e365caea37258891), and [9f9390ddfc](https://github.com/facebook/react-native/commit/9f9390ddfccab706ff2d346fdbd408c1cfc1c312) by [@stepanhruda](https://github.com/stepanhruda), [@fkgozali](https://github.com/fkgozali), and [@axe-fb](https://github.com/axe-fb)) + +#### iOS specific + +- Suppress yellow box about missing export for native modules ([5431607c6d](https://github.com/facebook/react-native/commit/5431607c6d4983e0adccf0192dd4dc4f5dc85443) by [@fkgozali](https://github.com/fkgozali)) + +### Removed + +- Remove `UIManager.measureViewsInRect()` ([d6236796b2](https://github.com/facebook/react-native/commit/d6236796b285e6ad19c53c5308a0ad9c10792a05) by [@shergin](https://github.com/shergin)) + +### Fixed + +- Fix potential UI thread stalling scenario from Yoga JNI bindings ([2a8f6c3028](https://github.com/facebook/react-native/commit/2a8f6c3028feec7fc9a01cbdfad45955c4771bf8) by [@davidaurelio](https://github.com/davidaurelio)) +- Fix crash happening due to race condition around bridge cxx module registry ([188cbb04ad](https://github.com/facebook/react-native/commit/188cbb04ad264aea32ae235b85b61e626b767b83), [188cbb04ad](https://github.com/facebook/react-native/commit/188cbb04ad264aea32ae235b85b61e626b767b83), and [188cbb04ad](https://github.com/facebook/react-native/commit/188cbb04ad264aea32ae235b85b61e626b767b83) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fix **View** and **Text**'s displayName; show the specific name rather than generic "Component" ([7a914fcef4](https://github.com/facebook/react-native/commit/7a914fcef4ae035221e1f984c104ba20430d6fad) by [@rajivshah3](https://github.com/rajivshah3)) +- Fix `react-native init --help` so that it doesn't return `undefined` ([58732a88b6](https://github.com/facebook/react-native/commit/58732a88b629b40b2d223a76fac46ecee5ae7295) by [@ignacioola](https://github.com/ignacioola)) +- Fix `react-native --sourceExts` ([ce860803a4](https://github.com/facebook/react-native/commit/ce860803a4341c4121a0bb504dc669349ac0db35) by [@elyalvarado](https://github.com/elyalvarado)) +- Fix accidental showing of **Modal** when `visible` prop is undefined or null ([cc13a7367b](https://github.com/facebook/react-native/commit/cc13a7367b08bd766749ddbfaacc25ade1f33a8f) by [@MateusAndrade](https://github.com/MateusAndrade)) +- Fix crash during **VirtualizedList** pagination ([5803772017](https://github.com/facebook/react-native/commit/580377201793314ca643250c1bd7cf1c47d49920)) +- Fix scenario where removing a module with remote debugging and Delta bundles may cause incorrect stack traces ([bea57d871f](https://github.com/facebook/react-native/commit/bea57d871f6b5bed76d1625b3e3f483695bd13e9) by [@alexkirsz](https://github.com/alexkirsz)) +- Fix regression in **StyleSheet** `setStyleAttributePreprocessor` ([04085337bc](https://github.com/facebook/react-native/commit/04085337bc47392922c7911b95b8fdaea98800e8) by [@brentvatne](https://github.com/brentvatne)) +- Fix React Native AsyncMode and DevTools ([aacb06c594](https://github.com/facebook/react-native/commit/aacb06c594dcd4581918035f713a69cf73bf125b) by [@bvaughn](https://github.com/bvaughn)) + +#### Android specific + +- Fix crash when removing root nodes ([b649fa96a0](https://github.com/facebook/react-native/commit/b649fa96a088a9e8ccbf3f979ebfa4a5e28a066f) by [@ayc1](https://github.com/ayc1)) +- Fix various **ReactInstanceManager** deadlocks and race conditions ([df7e8c64ff](https://github.com/facebook/react-native/commit/df7e8c64ff8f5ff739fba2ba5ed6b0610567235e), [df7e8c64ff](https://github.com/facebook/react-native/commit/df7e8c64ff8f5ff739fba2ba5ed6b0610567235e), and [be282b5287](https://github.com/facebook/react-native/commit/be282b5287f7eecf8a3fd14b06ab36454dbba5fe) by [@ayc1](https://github.com/ayc1)) +- Fix IllegalArgumentException when dismissing ReactModalHostView and DialogManager ([e57ad4ee37](https://github.com/facebook/react-native/commit/e57ad4ee37b02cd4c9e10a97d7a1d2b799204d7d) and [38e01a20c3](https://github.com/facebook/react-native/commit/38e01a20c343e60d5f8cd92fb26454e9940565df) by [@mdvacca](https://github.com/mdvacca)) +- Fix incorrect merged asset path with flavor for Android Gradle Plugin 3.2 ([e90319e9fa](https://github.com/facebook/react-native/commit/e90319e9fa18661144ad29faf36efba3750edb32) by [@yatatsu](https://github.com/yatatsu)) +- Fix HTTP connection ontimeout callback ([a508134724](https://github.com/facebook/react-native/commit/a50813472450f51d2ef24b40be99a22beefec33c)) +- Fix websocket properly closing when remote server initiates close ([2e465bca15](https://github.com/facebook/react-native/commit/2e465bca158ae9cfa89448e2a3bb8cc009397ac8) by [@syaau](https://github.com/syaau)) +- Fix compatibility issue for Android 16 device ([5939d078a0](https://github.com/facebook/react-native/commit/5939d078a01edc9f83fce102317540ffbcac17c1), [f22473e9e9](https://github.com/facebook/react-native/commit/f22473e9e9f73605cd27c5e38298bd793478c84d), and [f22473e9e9](https://github.com/facebook/react-native/commit/f22473e9e9f73605cd27c5e38298bd793478c84d) by [@gengjiawen](https://github.com/gengjiawen)) +- Fix issue where `Image.resizeMode` isn't respected while source is loading, resulting in unexpected padding ([673ef39561](https://github.com/facebook/react-native/commit/673ef39561ce6640e447fa40299c263961e4f178) by [@dulmandakh](https://github.com/dulmandakh)) +- Fix Android 28's inverted **ScrollView** so that momentum is in the proper direction ([b971c5beb8](https://github.com/facebook/react-native/commit/b971c5beb8c7f90543ea037194790142f4f57c80) by [@mandrigin](https://github.com/mandrigin)) +- Fix HTTP connection timeout callback to be appropriately called ([a508134724](https://github.com/facebook/react-native/commit/a50813472450f51d2ef24b40be99a22beefec33c)) +- Fix compatibility issue with Android 16 device ([5939d078a0](https://github.com/facebook/react-native/commit/5939d078a01edc9f83fce102317540ffbcac17c1) by [@gengjiawen](https://github.com/gengjiawen)) +- Fix crash when releasing RN views and removing root nodes([83405ff316](https://github.com/facebook/react-native/commit/83405ff3167eaba6fa59ca52c54943221a05ee09) and [b649fa96a0](https://github.com/facebook/react-native/commit/b649fa96a088a9e8ccbf3f979ebfa4a5e28a066f) by [@ayc1](https://github.com/ayc1)) +- Close websocket properly when remote server initiates close ([2e465bca15](https://github.com/facebook/react-native/commit/2e465bca158ae9cfa89448e2a3bb8cc009397ac8) by [@syaau](https://github.com/syaau)) +- Workaround a wrong fling direction for inverted ScrollViews on Android P ([b971c5beb8](https://github.com/facebook/react-native/commit/b971c5beb8c7f90543ea037194790142f4f57c80) by [@mandrigin](https://github.com/mandrigin)) +- Fix **Image** to respect `resizeMode` for `defaultSource` images rather than showing padding while loading ([673ef39561](https://github.com/facebook/react-native/commit/673ef39561ce6640e447fa40299c263961e4f178) by [@dulmandakh](https://github.com/dulmandakh)) + +#### iOS specific + +- Fix case where content of inline views didn't get relaid out ([798517a267](https://github.com/facebook/react-native/commit/798517a267841675956cb52a1c0ae493a913962a) by [@rigdern](https://github.com/rigdern)) +- Fix issue with **ImagePickerIOS**'s inconsistent image when using the front-facing camera ([4aeea4d2dc](https://github.com/facebook/react-native/commit/4aeea4d2dc14cf02dc3766043e2938bf367c6170)) +- Fix race condition and crash around shutdown of the JSC for iOS 11 and earlier ([bf2500e38e](https://github.com/facebook/react-native/commit/bf2500e38ec06d2de501c5a3737e396fe43d1fae) by [@mhorowitz](https://github.com/mhorowitz)) +- Fix crash in **NetInfo**'s \_firstTimeReachability ([eebc8e230a](https://github.com/facebook/react-native/commit/eebc8e230a9f72c3dde34a5cfd59bbffba55e53d) by [@mmmulani](https://github.com/mmmulani)) +- Fix case where inline view is visible even though it should have been truncated ([70826dbafc](https://github.com/facebook/react-native/commit/70826dbafcb00c08e0038c5066e33848141be77b) by [@rigdern](https://github.com/rigdern)) +- Fix crash with **ScrollView** related to content offsets ([585f7b916d](https://github.com/facebook/react-native/commit/585f7b916d63b7b4d22a7347334765ffcd7945e9) by [@shergin](https://github.com/shergin)) +- Fix an issue where **CameraRoll** wasn't showing the front-facing camera consistently during capture and preview ([4aeea4d2dc](https://github.com/facebook/react-native/commit/4aeea4d2dc14cf02dc3766043e2938bf367c6170)) +- Fix case where inline view is visible even though it should have been truncated ([70826dbafc](https://github.com/facebook/react-native/commit/70826dbafcb00c08e0038c5066e33848141be77b) by [@rigdern](https://github.com/rigdern)) + +### Known issues + +It is possible that you'll face an AAPT error regarding missing resources, [here](https://github.com/infinitered/ignite-andross/issues/244) is an example of this error, in this case, you should try to update the build tools versions to `buildToolsVersion = "28.0.2"` in your android/build.gradle file. If you maintain a react-native library which uses native code you should avoid using hardcoded versions of the build tools and use the packaged version numbers, here is an example you can [follow](https://github.com/react-native-community/react-native-linear-gradient/blob/master/android/build.gradle) + +## v0.57.8 + +**NOTE WELL**: when you upgrade to this version you **NEED** to upgrade `react` and `react-test-renderer` to version `"16.6.3"`. + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/71) for cherry-picking commits - you can participate to the decision process for the next release [here](https://github.com/react-native-community/react-native-releases/issues/75). + +### Added + +- Fix: Add displayName to ActivityIndicator (#22417) ([53da585832](https://github.com/facebook/react-native/commit/53da5858326bbddd2df112f86b2c1e935adc3882)) + +### Changed + +- Switch: Improve Accessibility ([0c8db08f51](https://github.com/facebook/react-native/commit/0c8db08f519fdf5162dff1d9a18b58885c4c7d2f) by [@yungsters](https://github.com/yungsters)) +- React sync for revisions 3ff2c7c...6bf5e85 ([073ad6a036](https://github.com/facebook/react-native/commit/073ad6a0367c3156e03680c0ab0648feed2bf89c) by [@yungsters](https://github.com/yungsters)) + +#### iOS specific + +- Extend reason message for `RCTFatalException` (#22532) ([2831d9ef61](https://github.com/facebook/react-native/commit/2831d9ef614280d08699f3134eeaeda84c30234e) by [@zackzachariah](https://github.com/zackzachariah)) + +### Removed + +- Remove trailing slash from origin header if no port is specified (#22290) ([cbe7d41f3f](https://github.com/facebook/react-native/commit/cbe7d41f3f509aaa8b8b0819b0d8ad4996fd7296)) + +### Fixed + +- Fix text alpha bug ([fd78eee11b](https://github.com/facebook/react-native/commit/fd78eee11b71799aa7fa57bbd70d59c6c642c3b3) by [@necolas](https://github.com/necolas)) +- fix possible NPE in StatusBarModule ([0f3be77b7d](https://github.com/facebook/react-native/commit/0f3be77b7d4177c8f94d775bf8ef2a2b68f1e828) by [@mdvacca](https://github.com/mdvacca)) +- Fixes animated gifs incorrectly looping/not stopping on last frame (#21999) ([de759b949e](https://github.com/facebook/react-native/commit/de759b949e4aa4904fd60a2fcbb874a3c857b50c) by [@staufman](https://github.com/staufman)) +- Fix ListEmptyComponent is rendered upside down when using inverted flag. (#21496) ([198eb02697](https://github.com/facebook/react-native/commit/198eb0269781803cc16254916b0477916afbcb0e) by [@hyochans](https://github.com/hyochans)) +- Fix bug in comparison logic of object property (#22348) ([c3b3eb7f73](https://github.com/facebook/react-native/commit/c3b3eb7f73b0fb4035d4b2478bf9827caf746372) by [@vreality64](https://github.com/vreality64)) +- Fix dispatch of OnLayout event for first render ([844e11967d](https://github.com/facebook/react-native/commit/844e11967d9292bd5cfe423d0fd57e34388f2337) by [@mdvacca](https://github.com/mdvacca)) +- KeyboardAvoidingView: Duration cannot be less then 10ms (#21858) ([87b6533937](https://github.com/facebook/react-native/commit/87b65339379362f9db77ae3f5c9fa8934da34b25)) +- default hitSlop values to 0 (#22281) ([f6d3a61677](https://github.com/facebook/react-native/commit/f6d3a6167730cc9253b796b859d8f1f33f821687) by [@Taylor123](https://github.com/Taylor123)) + +#### iOS specific + +- Fixed for supporting mediaPlaybackRequiresUserAction under iOS 10. (#22208) ([c45d290b07](https://github.com/facebook/react-native/commit/c45d290b079f95466ad4054acf7b93c66cabc429) by [@ifsnow](https://github.com/ifsnow)) +- Use main.jsbundle in iOS template for production build (#22531) ([a2ef5b85d8](https://github.com/facebook/react-native/commit/a2ef5b85d8c46cefd5873bf5fc6dddabf1d51d13) by [@radeno](https://github.com/radeno)) +- Use relative path for SCRIPTDIR (#22598) ([0314fca63a](https://github.com/facebook/react-native/commit/0314fca63a035c95864e5b198e1fbd9a5ee1d2a7) by [@sunnylqm](https://github.com/sunnylqm)) +- Fix UIScrollView crash ([585f7b916d](https://github.com/facebook/react-native/commit/585f7b916d63b7b4d22a7347334765ffcd7945e9) by [@shergin](https://github.com/shergin)) +- Avoid using `-[UITextView setAttributedString:]` while user is typing (#19809) ([f77aa4eb45](https://github.com/facebook/react-native/commit/f77aa4eb459b9dcb7f0b558ad3f04e0c507955e9)) + +### Security + +- Bump ws package to 1.1.5 due to vulnerability issues (#21769) ([96ce6f9538](https://github.com/facebook/react-native/commit/96ce6f9538ed3559ffea6040a47b1d6a30546ab9) by [@prog1dev](https://github.com/prog1dev)) + +## v0.57.7 + +**NOTE WELL**: when you upgrade to this version you **NEED** to upgrade `react` and `react-test-renderer` to version `"16.6.1"`. + +This patch release fixes version 0.57.6 about losing focus in `TextInput` because of [ada7089066](https://github.com/facebook/react-native/commit/ada70890663503b65b42bb5f6f98d3df412ecdc4). + +Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/64) for cherry-picking commits. + +## v0.57.6 + +**INFO NOTE**: It's highly recommended that you skip this version and upgrade to 0.57.7. + +**NOTE WELL**: when you upgrade to this version you **NEED** to upgrade `react` and `react-test-renderer` to version `"16.6.1"`. +This patch release fixes a number of crashes, resolves build issues (both for iOS and Android). Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/64) for cherry-picking commits. + +### Added + +#### iOS specific + +- Add iOS 12 textContentType options (#21079) ([644fc57fad](https://github.com/facebook/react-native/commit/644fc57fad4b163e96c3b3d6ec441c7b566d2d43) by [@ultramiraculous](https://github.com/ultramiraculous)) + +### Removed + +- Remove useless additional blur call (#22156) ([ada7089066](https://github.com/facebook/react-native/commit/ada70890663503b65b42bb5f6f98d3df412ecdc4)) + +### Fixed + +- Improving Modal `visible` prop check to handle undefined and null (#22072) ([cc13a7367b](https://github.com/facebook/react-native/commit/cc13a7367b08bd766749ddbfaacc25ade1f33a8f) by [@MateusAndrade](https://github.com/MateusAndrade)) +- Fix crash in nativeInjectHMRUpdate (#22412) ([0b4fd621e3](https://github.com/facebook/react-native/commit/0b4fd621e3ab511510d6852af67183a3581d1aad) by [@vovkasm](https://github.com/vovkasm)) +- Fix IllegalArgumentException when dismissing ReactModalHostView ([e57ad4ee37](https://github.com/facebook/react-native/commit/e57ad4ee37b02cd4c9e10a97d7a1d2b799204d7d) by [@mdvacca](https://github.com/mdvacca)) +- Fix regression in StyleSheet.setStyleAttributePreprocessor (#22262) ([04085337bc](https://github.com/facebook/react-native/commit/04085337bc47392922c7911b95b8fdaea98800e8) by [@brentvatne](https://github.com/brentvatne)) +- Fix React Native AsyncMode and DevTools ([f41383fb6d](https://github.com/facebook/react-native/commit/f41383fb6d6d0858e1b09dda79a74632d7932d07) by [@bvaughn](https://github.com/bvaughn)) +- CxxReact: Silence 'unused lambda capture' warnings in open-source (#22240) ([0c0540965a](https://github.com/facebook/react-native/commit/0c0540965ad9e3cdd9af16f606e141eca8ab2193) by [@empyrical](https://github.com/empyrical)) + +#### Android specific + +- Fixed HTTP connection timeout on Android (#22164) ([a508134724](https://github.com/facebook/react-native/commit/a50813472450f51d2ef24b40be99a22beefec33c)) +- resizeMode applies to Image.defaultSource (#22216) ([673ef39561](https://github.com/facebook/react-native/commit/673ef39561ce6640e447fa40299c263961e4f178) by [@dulmandakh](https://github.com/dulmandakh)) +- Android: Close websocket properly when remote server initiates close (#22248) ([2e465bca15](https://github.com/facebook/react-native/commit/2e465bca158ae9cfa89448e2a3bb8cc009397ac8) by [@syaau](https://github.com/syaau)) +- Workaround a wrong fling direction for inverted ScrollViews on Android P (#21117) ([b971c5beb8](https://github.com/facebook/react-native/commit/b971c5beb8c7f90543ea037194790142f4f57c80) by [@mandrigin](https://github.com/mandrigin)) +- Fix crash when releasing RN views ([83405ff316](https://github.com/facebook/react-native/commit/83405ff3167eaba6fa59ca52c54943221a05ee09) by [@ayc1](https://github.com/ayc1)) + +#### iOS specific + +- iOS: Support inline view truncation (#21456) ([70826dbafc](https://github.com/facebook/react-native/commit/70826dbafcb00c08e0038c5066e33848141be77b) by [@rigdern](https://github.com/rigdern)) +- NetInfo: try to solve crash with releasing \_firstTimeReachability ([eebc8e230a](https://github.com/facebook/react-native/commit/eebc8e230a9f72c3dde34a5cfd59bbffba55e53d) by [@mmmulani](https://github.com/mmmulani)) +- Generate ip.txt before SKIP_BUNDLING check (#20554) ([9c1ea45d38](https://github.com/facebook/react-native/commit/9c1ea45d38a6ec731894443debe8879fa3876ab7) by [@keatongreve](https://github.com/keatongreve)) +- Revert [Performance improvement for loading cached images on iOS ] ([7eeb305933](https://github.com/facebook/react-native/commit/7eeb305933fca695c5a15d675bb10569c3385109) by [@kelset](https://github.com/kelset)) +- Fix inability to remove 'Disabled' state from AccessibilityStates ([5eaa2d29c0](https://github.com/facebook/react-native/commit/5eaa2d29c0c4c633a40f7241408737c754edea84)) + +## v0.57.5 + +**NOTE WELL**: when you upgrade to this version you **NEED** to upgrade `react` and `react-test-renderer` to version `"16.6.1"`. + +This patch release fixes a number of crashes, resolves build issues (both for iOS and Android), and brings React to v16.6.1. Thanks everyone who contributed code or participated in the [discussion](https://github.com/react-native-community/react-native-releases/issues/54) for cherry-picking commits. + +### Changed + +- React is now at v16.6.1 ([8325e09e5c](https://github.com/facebook/react-native/commit/8325e09e5cd8538fded1b5a1b4fff1854e17eb22) and [76c99f20e3](https://github.com/facebook/react-native/commit/76c99f20e39ef1b5fa93487bc8c82e7c6aede5dd) by [@yungsters](https://github.com/yungsters)) + +#### iOS specific + +- Performance improvement for loading cached images ([54f7eb3424](https://github.com/facebook/react-native/commit/54f7eb34243715a1d4bc821ccbadeec12486d22c) and [3a98318c91](https://github.com/facebook/react-native/commit/3a98318c91283a1bba35c0bca93b975d4a550330) by [@esamelson](https://github.com/esamelson) and others) + +### Fixed + +- Fix crash in **VirtualizedList** during pagination ([5803772017](https://github.com/facebook/react-native/commit/580377201793314ca643250c1bd7cf1c47d49920)) +- Fix polyfilling of **regeneratorRuntime** to avoid setting it to undefined in some situations ([2a7e02edf6](https://github.com/facebook/react-native/commit/2a7e02edf64c20410b2f95f35e313279545b40db) by [@rafeca](https://github.com/rafeca)) +- Fix **View**, **Text**, and **ActivityIndicator**'s `displayName` ([7a914fcef4](https://github.com/facebook/react-native/commit/7a914fcef4ae035221e1f984c104ba20430d6fad) and [53da585832](https://github.com/facebook/react-native/commit/53da5858326bbddd2df112f86b2c1e935adc3882) by [@rajivshah3](https://github.com/rajivshah3) and others) +- Fix crash that happens when a component throws an exception that contains a null message ([6debfdf6d6](https://github.com/facebook/react-native/commit/6debfdf6d6172cec2d87fd1e780c3b347d41dc1d) by [@mdvacca](https://github.com/mdvacca)) + +#### Android specific + +- Fix incorrect merged asset path with flavor for Android Gradle Plugin 3.2 ([e90319e9fa](https://github.com/facebook/react-native/commit/e90319e9fa18661144ad29faf36efba3750edb32) by [@yatatsu](https://github.com/yatatsu)) +- Fix crash in **ReadableNativeArray.getType** when size of ReadableNativeArray's length > 512 ([09c78fe968](https://github.com/facebook/react-native/commit/09c78fe968e1bb71108c4058e76ebf70178e5a8b) by [@dryganets](https://github.com/dryganets)) + +#### iOS specific + +- Fix crash in rapid use of **NetInfo.getCurrentConnectivity** ([67afaefa78](https://github.com/facebook/react-native/commit/67afaefa78c314b38249a7e2758e0af38c18f34a) by [@mmmulani](https://github.com/mmmulani)) +- Fix Xcode 10 errors relating to third-party ([277c19c93e](https://github.com/facebook/react-native/commit/277c19c93eacf3e3ce63f71236fd399214d6e6d0) by [@mmccartney](https://github.com/mmccartney)) +- Fix build errors when path to `$NODE_BINARY` contains spaces ([7d4e94edcc](https://github.com/facebook/react-native/commit/7d4e94edccfc2f642fcbd1d6aa00756f02e3a525) by [@sundbry](https://github.com/sundbry)) +- Fix case where content of inline views didn't get relaid out ([798517a267](https://github.com/facebook/react-native/commit/798517a267841675956cb52a1c0ae493a913962a) by [@rigdern](https://github.com/rigdern)) +- Fix **InputAccessoryView**'s safe area when not attached to a **TextInput** ([2191eecf54](https://github.com/facebook/react-native/commit/2191eecf54b5c4bf278dfaf23fec46d44ac9a1f0) by [@janicduplessis](https://github.com/janicduplessis)) + +## v0.57.4 + +**NOTE WELL**: when you upgrade to this version you **NEED** to upgrade `react` and `react-test-renderer` to version `"16.6.0-alpha.8af6728"` (next version, 0.57.5, will update to `16.6.0`, and it will come soon). Also, please check the _Known issues_ section below, especially if you are using Xcode 10. + +Thanks to everyone that contributed to the [discussion](https://github.com/react-native-community/react-native-releases/issues/48) for cherry-picking the commits that landed in this release, and the developers who submitted those commits! + +### Added: new features + +#### Android specific additions + +- Android textTransform style support ([22cf5dc566](https://github.com/facebook/react-native/commit/22cf5dc5660f19b16de3592ccae4c42cc16ace69) by Stephen Cook) + +### Changes: existing functionality that is now different + +- Add deprecation notice to SwipeableListView ([99471f87b9](https://github.com/facebook/react-native/commit/99471f87b944b26bbdaa0fb0881db91c1118b741) by [@TheSavior](https://github.com/TheSavior)) + +#### Android specific changes + +- Consolidate native dependencies versions ([ba608a2db7](https://github.com/facebook/react-native/commit/ba608a2db786a8e983a6e30b31662fac254286c0) by [@dulmandakh](https://github.com/dulmandakh)) +- bump okhttp3 to 3.11 ([10fc548809](https://github.com/facebook/react-native/commit/10fc548809cc08db209ae6696b723341925137d1) by [@dulmandakh](https://github.com/dulmandakh)) +- Android: Send `` metrics in onTextLayout events ([737f93705c](https://github.com/facebook/react-native/commit/737f93705ca8b5d3fdd207f870cf27adcf1e885b) by [@mmmulani](https://github.com/mmmulani)) +- Use TextLegend example in Android as well ([335927db44](https://github.com/facebook/react-native/commit/335927db44fe47e20db4503a1ab5fcf8d62144a8) by [@mmmulani](https://github.com/mmmulani)) + +#### iOS specific changes + +- Bump xcode@1.0.0 ([b9514995a2](https://github.com/facebook/react-native/commit/b9514995a26b4c3f6d555257740457dd4d6cfeae) by [@peat-psuwit](https://github.com/peat-psuwit)) +- Text: send metrics after rendering (iOS) ([737f93705c](https://github.com/facebook/react-native/commit/737f93705ca8b5d3fdd207f870cf27adcf1e885b) by [@mmmulani](https://github.com/mmmulani)) +- Allow specifying iOS version for run-ios with simulator option ([0fab27cbac](https://github.com/facebook/react-native/commit/0fab27cbaca57b90119ab36104af4d0b3052ae30) by [@elyalvarado](https://github.com/elyalvarado)) +- Relax the requirement that lazy module cannot be initialized on the main thread ([dbc864c9cd](https://github.com/facebook/react-native/commit/dbc864c9cd95f9df268d85a642742e84e2360db4) by [@spredolac](https://github.com/spredolac)) + +### Fixed: bugs that have been resolved + +- Fix crashes on invalid regex ([298f14da12](https://github.com/facebook/react-native/commit/298f14da1210460b3e25c6002e8d1aa5f7b4e0ef) by [@RSNara](https://github.com/RSNara)) +- Fix pull to refresh refresh component clipping on Android ([8a3a0ad2d0](https://github.com/facebook/react-native/commit/8a3a0ad2d0f894a3d8c1e403a9336dab17c2dde8) by Andy Huang) +- ListView requestAnimationFrame leak ([70b5eb3aa2](https://github.com/facebook/react-native/commit/70b5eb3aa27822fa11571c3d8d3628ecf03268ab) by [@exced](https://github.com/exced)) + +#### Android specific fixes + +- reverted [Update bad method](https://github.com/facebook/react-native/commit/1592a8d42411d1f91c8ceb738c0533c1cee73f71) +- Fix accessibility role crash ([1f96ff62cf](https://github.com/facebook/react-native/commit/1f96ff62cf786f93c91e6625bf2b819077902251) by Haseeb Saeed) +- Fix accessibilityRole value lookup ([1f96ff62cf](https://github.com/facebook/react-native/commit/1f96ff62cf786f93c91e6625bf2b819077902251) by [@ayc1](https://github.com/ayc1)) +- Fix DynamicFromMap object pool synchronization ([b0d68c0bb9](https://github.com/facebook/react-native/commit/b0d68c0bb971a44dfdf7722682933f1e96e1cd45) by [@haitaoli](https://github.com/haitaoli)) +- Back out "[react-native][pr] Rounded corner rendering fixed on Android N." ([bb407fa1ec](https://github.com/facebook/react-native/commit/bb407fa1ec0bd0367373961fdc0e840150840068) by Jonathan Lee) +- Fix onTextLayout metrics on Android when using alignText ([1c240ae898](https://github.com/facebook/react-native/commit/1c240ae898e26534b8d9a09a334dec02e96faa05) by [@mmmulani](https://github.com/mmmulani)) +- Cleaning up imports in ViewGroupManager ([082a869dae](https://github.com/facebook/react-native/commit/082a869daef3cf602a088d0418c185279052b8c3) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific fixes + +- Fix issue when inserting text at 0 when maxLength is set ([17415938c7](https://github.com/facebook/react-native/commit/17415938c7180a95811db949122b8ad24a442866) by [@ejanzer](https://github.com/ejanzer)) + +### Known issues + +There are a few issues that don't have a finalized solution (as it happens for 0.x projects). In particular: + +- when using Xcode 10 and `react-native init`, your build may fail due to third-party build steps ([#20774](https://github.com/facebook/react-native/issues/20774)). There is a [commit](https://github.com/facebook/react-native/commit/b44c5ae92eb08125d466cf151cb804dabfbbc690) we are planning to cherry pick in a future release that should help - in the meantime, you should be able to run these commands from the project folder to fix the issue (you should need to do it only once per project): + + ```bash + cd node_modules/react-native + scripts/ios-install-third-party.sh + cd third-party/glog-0.3.5/ + ../../scripts/ios-configure-glog.sh + ``` + +- React `16.6.0` works for the most part, aside from the Context API (check [this issue](https://github.com/facebook/react-native/issues/21975)) - and if you are eager to test the new React Hooks you will have to be patient, as they are not production ready and `16.7.alpha` is **not** yet [supported](https://github.com/facebook/react-native/issues/21967) by React Native. + +## v0.57.3 + +**NOTE WELL**: when you upgrade to this version you **NEED** to upgrade `react` and `react-test-renderer` to version `"16.6.0-alpha.8af6728"`. Also, please check the _Known issues_ section below, especially if you are using Xcode 10. + +Thanks to everyone that contributed to the [discussion](https://github.com/react-native-community/react-native-releases/issues/46) for cherry-picking the commits that landed in this release, and the developers who submitted those commits! + +### Added: new features + +- Expose enableBabelRuntime config param externally ([89a358f347](https://github.com/facebook/react-native/commit/89a358f34786198c8a9a2d379588efd57b6a0eec) by [@rafeca](https://github.com/rafeca)) + +#### Android specific additions + +- Add test for InterpolatorType ([b7526b2095](https://github.com/facebook/react-native/commit/b7526b2095e4a5c8641e8264786d1622d6390029) by [@ejanzer](https://github.com/ejanzer)) + +### Changes: existing functionality that is now different + +- React sync for revisions ade5e69...d836010 ([fa6035bda6](https://github.com/facebook/react-native/commit/7142e9b1c5f95e82ceb04798b166318385004147) by [@yungsters](https://github.com/yungsters)) +- React: Bump Canary Version ([8258b6a280](https://github.com/facebook/react-native/commit/8258b6a2801121bebb25272bfcc5d3da1fb5ae39) by [@yungsters](https://github.com/yungsters)) +- FBJS: Upgrade to ^1.0.0 ([ee034596fe](https://github.com/facebook/react-native/commit/ee034596fecfb47ff9e6e1fc30cefb0e970e7d80) by [@yungsters](https://github.com/yungsters)) +- Bump metro@0.48.1 ([bf47589b8b](https://github.com/facebook/react-native/commit/bf47589b8be145750e954d09684370463a616779) by [@rafeca](https://github.com/rafeca)) +- Update to Detox 9 ([15c05988e9](https://github.com/facebook/react-native/commit/15c05988e980118151bdf41ed82ebb8c8e30a0f3) by [@kelset](https://github.com/kelset)) +- Add Deprecation Warning to ListView ([e90f5fa263](https://github.com/facebook/react-native/commit/e90f5fa2630f8a89e15fa57c70ada83e75a20642) by [@TheSavior](https://github.com/TheSavior)) +- Deprecate legacyImplementation of FlatList ([3aa8f09b44](https://github.com/facebook/react-native/commit/3aa8f09b4437eab8b91429b7325f8a6173ffa49a) by [@TheSavior](https://github.com/TheSavior)) + +#### Android specific changes + +- bump Android NDK to r17c ([436cf154bb](https://github.com/facebook/react-native/commit/436cf154bb9cf4fc0bcafd7115d33544ce36b759) by [@dulmandakh](https://github.com/dulmandakh)) +- Resolve protocol http, https when not in lowercase ([d00bdb9bb8](https://github.com/facebook/react-native/commit/d00bdb9bb8b9b11bce900689c7e28cebd2eb0807) by [@hyunjongL](https://github.com/hyunjongL)) +- Normalize scheme for URL on Android ([4b6f02ea75](https://github.com/facebook/react-native/commit/4b6f02ea758a9ab5853a29ebfc054eaa98e6dc53) by [@radeno](https://github.com/radeno)) + +#### iOS specific changes + +- Bump up the buffer size and show a warning if the trace might be truncated ([1fc8a46570](https://github.com/facebook/react-native/commit/1fc8a46570561a32657ffccb0f5a12c6f4d6a3dd) by [@alexeylang](https://github.com/alexeylang)) + +### Fixed: bugs that have been resolved + +- Fix deprecation warning message in Switch ([997f382adc](https://github.com/facebook/react-native/commit/997f382adcc7f82fccd97ac671d13e86aef7171e) by [@radko93](https://github.com/radko93)) + +#### Android specific fixes + +- Fix default accessibility delegate ([fa6035bda6](https://github.com/facebook/react-native/commit/fa6035bda6c606868977179534cb941f26fbdb92) by [@ayc1](https://github.com/ayc1)) +- Fix accessibility role/label ([fa6035bda6](https://github.com/facebook/react-native/commit/fa6035bda6c606868977179534cb941f26fbdb92) by [@ayc1](https://github.com/ayc1)) +- When converting arguments JS->Java, handle integers correctly ([bb9b9a8b9d](https://github.com/facebook/react-native/commit/bb9b9a8b9d5868c7ab5034117b785943496f6405) by [@mhorowitz](https://github.com/mhorowitz)) +- Fix CameraRoll.getPhotos() crash on Android if device has a problematic video asset ([4768bea0cf](https://github.com/facebook/react-native/commit/4768bea0cf288cf9c8097fc498b896610728c645) by [@naxel](https://github.com/naxel)) +- Android ScrollView fix for snapToInterval not snapping to end ([6eeff75849](https://github.com/facebook/react-native/commit/6eeff75849c9b8bf91592c1b7906b4dab8fba518) by [@olegbl](https://github.com/olegbl)) +- Fix for InterpolatorType crash ([01a1004808](https://github.com/facebook/react-native/commit/01a1004808928e29a6d6c698b3b18312fed17a02) by [@ejanzer](https://github.com/ejanzer)) +- Update bad method ([1592a8d424](https://github.com/facebook/react-native/commit/1592a8d42411d1f91c8ceb738c0533c1cee73f71) by [@grabbou](https://github.com/grabbou)) + +#### iOS specific fixes + +- Dealloc first time RCTNetInfo reachability callback ([e7e63fd409](https://github.com/facebook/react-native/commit/e7e63fd4092a81beec482fc48d05f1a048801037) by [@mmmulani](https://github.com/mmmulani)) +- iOS: fix the baseline issue when displaying a mixture of different-language characters ([c1561ab441](https://github.com/facebook/react-native/commit/c1561ab4411854bef96b5d268d38002a013d6d3e) by [@BingBingL](https://github.com/BingBingL)) +- Fix artifacting on RN-drawn borders with asymmetric radii ([9e6522374b](https://github.com/facebook/react-native/commit/9e6522374bc605bb1a92ff02842878ace35e9f3d) by [@jamesreggio](https://github.com/jamesreggio)) +- check isAvailable key on simulator object ([1031872784](https://github.com/facebook/react-native/commit/1031872784e9373082797e5bf5c815816af2105b) by [@antonychan](https://github.com/antonychan)) +- ios-simulator: change default iphone version ([6d09df5b72](https://github.com/facebook/react-native/commit/6d09df5b726ac951417b87a49bc345ebc9142951) by Vitor Capretz) + +### Known issues + +There are a few issues that don't have a finalized solution. In particular, when using Xcode 10 and `react-native init`, your build may fail due to third-party build steps ([#20774](https://github.com/facebook/react-native/issues/20774)). There is an open pull request which we are testing and hope to land soon ([#21458](https://github.com/facebook/react-native/pull/21458)). In the meantime, you can find a workaround here: [https://github.com/facebook/react-native/issues/20774](https://github.com/facebook/react-native/issues/20774). + +## v0.57.2 + +Thanks to everyone that contributed to the [discussion](https://github.com/react-native-community/react-native-releases/issues/45) for cherry-picking the commits that landed in this release, and the developers who submitted those commits! + +### Added: new features + +#### Android specific additions + +- Android subpixel text ([65e4e674fc](https://github.com/facebook/react-native/commit/65e4e674fca7127fd7800ae011cab449561f475b) by [@kevinresol](https://github.com/kevinresol)) + +### Changes: existing functionality that is now different + +- ReactScrollView should account for `overflow: scroll` ([201f2f189f](https://github.com/facebook/react-native/commit/201f2f189f2c41092397e5457eda83b0764ee4cd) by [@mcolotto](https://github.com/mcolotto)) +- bump metro 0.47.0 ([4750f52b34](https://github.com/facebook/react-native/commit/4750f52b34f524cae8ca08fcacec063c0725e4de) by [@rafeca](https://github.com/rafeca)) +- Use babel runtime instead of relying on global babelHelpers and regenerator ([36033bd0ed](https://github.com/facebook/react-native/commit/36033bd0edecd20fe2ae5edd56408bcc134378e7) by [@janicduplessis](https://github.com/janicduplessis)) +- React: Upgrade to react-devtools@^3.4.0 ([25119f95c8](https://github.com/facebook/react-native/commit/25119f95c81039761dd505c216c1e499003c6294) by [@yungsters](https://github.com/yungsters)) +- Change new Date() to Date.now() to save on date allocations ([bbb2d9a5b3](https://github.com/facebook/react-native/commit/bbb2d9a5b358bc0c150fe6ff74c45594c987e949) by [@dulinriley](https://github.com/dulinriley)) +- Make config object read-only ([2c1057062e](https://github.com/facebook/react-native/commit/2c1057062e81f8b43d3f942a35371fb3db841bed) by [@rafeca](https://github.com/rafeca)) +- Cleanup the transformer flow types ([28dedfb6d6](https://github.com/facebook/react-native/commit/28dedfb6d61e64a50d78aa06ee4f744665a54c2a) by [@rafeca](https://github.com/rafeca)) +- bump metro 0.47.1 ([12ab08a5aa](https://github.com/facebook/react-native/commit/12ab08a5aab3e14c9b2fb35454b16708b8ce093d) by [@rafeca](https://github.com/rafeca)) + +#### Android specific changes + +- Android ScrollView support for `overflow: visible` ([4af4da9089](https://github.com/facebook/react-native/commit/4af4da9089e20aa84bc5660bfb37763556442a4e) by [@olegbl](https://github.com/olegbl)) +- Expose a getter for overflow setting in ReactViewGroup ([02ad56f541](https://github.com/facebook/react-native/commit/02ad56f5419675572d684c3cc8a28644f29afffa) by [@kmagiera](https://github.com/kmagiera)) +- Add workaround for Android Gradle Plugin 3.2 change to asset dir ([ff084a4e80](https://github.com/facebook/react-native/commit/ff084a4e8071adb4ff6198b32aa8a7e8e29cca1c) by [@edilaic](https://github.com/edilaic)) + +### Fixed: bugs that have been resolved + +- Fix HEAD request failing with `Invalid response for blob` ([7e9c3f77cc](https://github.com/facebook/react-native/commit/7e9c3f77cce881dbb47af266993da5a2b6e98b5b) by [@anthonyhumphreys](https://github.com/anthonyhumphreys)) +- Check if child view != null before dropping ([af181fb192](https://github.com/facebook/react-native/commit/af181fb192c83e1dd0575c24e38d8814bbf187d6) by [@chrusart](https://github.com/chrusart)) + +#### Android specific fixes + +- Fix event handlers for DPad arrows on Android TV ([4d71b1525d](https://github.com/facebook/react-native/commit/4d71b1525d357a61a1740d6de5c1b97b6527f986) by [@krzysztofciombor](https://github.com/krzysztofciombor)) +- Rounded corner rendering fixed on Android N ([748cf82c97](https://github.com/facebook/react-native/commit/748cf82c974d6cf5d5df64b6e6013211c870530c) by [@dryganets](https://github.com/dryganets)) +- Android: fix cookies lost on Android 5.0 and above ([ea53727e16](https://github.com/facebook/react-native/commit/ea53727e16223d412fcbba49df79cc68b39f5d93) by chenwenyu) +- allow zero offset when shadow radius is nonzero ([97f0e43710](https://github.com/facebook/react-native/commit/97f0e43710a990c30e14d66bf67c7d612377d3f2) by Timothy Kukulski) +- Android ScrollView fix for pagingEnabled ([e0170a9445](https://github.com/facebook/react-native/commit/e0170a944501bb487e899b92363bf5aa64b29299) by [@olegbl](https://github.com/olegbl)) + +### Removed: features that have been removed; these are breaking + +- Remove global babelHelpers and regenerator ([458d56c0a1](https://github.com/facebook/react-native/commit/458d56c0a1ac73c088660830a8bf2db65de7d9a2) by [@janicduplessis](https://github.com/janicduplessis)) +- Remove overflow hidden killswitch ([59aada873e](https://github.com/facebook/react-native/commit/59aada873e13bf0b1f5e3a10cfe9a5a45c28f9fb) by [@ayc1](https://github.com/ayc1)) +- Remove absolute path parameter from transformers ([2e0d5c87e9](https://github.com/facebook/react-native/commit/2e0d5c87e93bb970ef1c8864ca44b47b36d6ae2e) by [@rafeca](https://github.com/rafeca)) + +## v0.57.1 + +We are trying, for 0.57, to approach it as a version with a longer "support", while waiting for some features to land that will allow for [0.58 to be cut](https://github.com/react-native-community/react-native-releases/issues/41). + +Thanks to everyone that contributed to the [discussion](https://github.com/react-native-community/react-native-releases/issues/34) for cherry-picking the commits that landed in this release, and the developers who submitted those commits! + +### Added: new features + +- Expose AllowFileAccess property in WebView ([0c576ef84a](https://github.com/facebook/react-native/commit/0c576ef84a1c7f79b228f205cc687ab1b945bda1) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific additions + +- Expose scrollEnabled as iOS prop for TextInput ([b9c28c236b](https://github.com/facebook/react-native/commit/b9c28c236bc971a5fbc51a3bda09c3980d547b96) by Chun Chen) + +### Changes: existing functionality that is now different + +- Give RNPM the ability to look for plugins in `@Scoped` modules ([4b106be477](https://github.com/facebook/react-native/commit/4b106be47765dd391f7a4cc6cf0e705ae977b90a) by [empyrical](https://github.com/empyrical)) +- Upgrade babel-eslint to 9.0.0 ([44dc283bcd](https://github.com/facebook/react-native/commit/44dc283bcd0a75826d9be86cdc727e32d5697ef2) by [@rafeca](https://github.com/rafeca)) +- bump metro 0.45.6 ([7bac0565e8](https://github.com/facebook/react-native/commit/7bac0565e82981d4a6e2b500d376ba9fa8aba721) by [@rafeca](https://github.com/rafeca)) + +#### iOS specific changes + +- Making RCTIsIPhoneX() return true for the R and Max models ([5e7c3ca005](https://github.com/facebook/react-native/commit/5e7c3ca0057f6084d692e30ae4db863fb20968ff) by [@shergin](https://github.com/shergin)) +- Way to register RCT_MODULE in Plugin2.0 instead of +load ([5c160e5ded](https://github.com/facebook/react-native/commit/5c160e5dedae713c686d88d4b9d4308b596e68a7) by Jeff Thomas) +- Update RCTLinkingManager.h to explicitly state the 'nullability' of parameters ([2271d1f912](https://github.com/facebook/react-native/commit/2271d1f912435eba7da2414ea4665ba8e56c7ad7) by Warren Knox) + +### Fixed: bugs that have been resolved + +- Pass the maxWorkers config param correctly to Metro ([7a69f1aa27](https://github.com/facebook/react-native/commit/7a69f1aa272a9b71755033a80f6f4aa5e9dcbaf6) by [@rafeca](https://github.com/rafeca)) +- Fix ignored --projectRoot/watchFolders arguments (([9fca769e76](https://github.com/facebook/react-native/commit/9fca769e7666df696299b422c140d6509e726ec6) by [@oblador](https://github.com/oblador)) +- Debug only code were leaking into release builds on iOS. (([d1ff0b0cc5](https://github.com/facebook/react-native/commit/d1ff0b0cc51c31cae89689b2ad2f4b35f29531d8) by [@dryganets](https://github.com/dryganets)) + +#### iOS specific fixes + +- Fix RCTNetInfo first time connection status ([e7e63fd409](https://github.com/facebook/react-native/commit/e7e63fd4092a81beec482fc48d05f1a048801037) by [@karanjthakkar](https://github.com/karanjthakkar)) + +### Removed: features that have been removed; these are breaking + +#### iOS specific removals + +- Removing development team from Xcode project ([8103c431c8](https://github.com/facebook/react-native/commit/8103c431c897c02d47cfad1e71bb2e6ddaabbdc0) by [@hramos](https://github.com/hramos)) + +## v0.57.0 + +Welcome to the 0.57 release of React Native! This release addresses a number of issues and has some exciting improvements. We again skipped a monthly release, focused on quality by extending the release candidate phase, and let some upstream packages reach stable for inclusion. + +This release includes [599 commits by 73 different contributors](https://github.com/facebook/react-native/compare/0.56-stable...0.57-stable)! In response to feedback, we've prepared a changelog that contains only user-impacting changes. Please share your input and let us know how we can make this even more useful, and as always [let us know](https://github.com/react-native-community/react-native-releases/issues/34) if you have any feedback on this process. + +### Highlights + +#### New features + +- Accessibility APIs now support accessibility hints, inverted colors, and easier usage of defining the element's role and states; read more at [@ziqichen6's excellent blog post](https://reactnative.dev/blog/2018/08/13/react-native-accessibility-updates) +- On iOS, `WKWebView` can now be used within the `WebView` component; read more at [@rsnara's awesome blog post](https://reactnative.dev/blog/2018/08/27/wkwebview) +- Better support for out-of-tree platforms. For details, please refer to [the discussion](https://github.com/react-native-community/discussions-and-proposals/issues/21) that the community used to get this up and running (there will be a new page in the docs dedicated to it too) - huge props to @empyrical for working on this! + +#### Tooling updates + +- Android tooling has been updated to match newer configuration requirements (SDK 27, gradle 4.4, and support library 27); building with Android plugin 3.2 doesn't work due to the gradle scripts, so **please** stay on Android Studio 3.1 for now +- Support Babel 7 stable landed! Be sure to read [here](https://blogs.msdn.microsoft.com/typescript/2018/08/27/typescript-and-babel-7/) about using TypeScript and check out the [Babel 7 migration guide](https://babeljs.io/docs/en/next/v7-migration) for help migrating. +- Metro has been upgraded (with Babel 7 and better transformer support), and in the next major release we plan on having two new features (ram bundles and inline requires) optional for you all to use - you can read how it will happen [here](https://github.com/react-native-community/discussions-and-proposals/blob/master/core-meetings/2018-09-metro-meeting.md); moreover, if you have a custom packager config, we recommend you read also the "updating to this version" section. +- Flow, React, and related packages have also been updated; this includes [working support](https://github.com/facebook/react-native/commit/5491c3f942430982ce9cb6140ed1733879ed3d1d) for the [React Profiler](https://reactjs.org/blog/2018/09/10/introducing-the-react-profiler.html). + +#### The Slimmening is happening + +As mentioned a few times in the past, the core team is reviewing the repository to trim it to the base React Native features in order to make the whole ecosystem more maintainable (by using a _divide-et-impera_ approach, the community will move faster and enable pull requests to be reviewed and merged quicker). This change requires extracting some components into their own separate repos and removing old, unused code ([details here](https://github.com/react-native-community/discussions-and-proposals/issues/6)). + +0.57 is **not** directly affected by any changes, but we want you to know that: + +- `WebView` will be moved to its own repo at [react-native-community/react-native-webview](https://github.com/react-native-community/react-native-webview). There is already a base implementation there. Help us out by giving that a try, and expect that `WebView` will be deprecated soon +- `NavigatorIOS` will be **fully** removed from the main codebase starting 0.58.0 (via [this commit](https://github.com/facebook/react-native/commit/0df92afc1caf96100013935d50bdde359b688658)); it is now deprecated + +### Updating to this version + +1. Upgrade the version of React Native in the `package.json` from `0.56.0` to `0.57.0`, and the React version to `16.5` +2. Change the babel-preset dependency from `"babel-preset-react-native": "^5",` to `"metro-react-native-babel-preset": "^0.45.0",`, then change the `.babelrc` configuration to: + + ```JSON + { + "presets": ["module:metro-react-native-babel-preset"] + } + ``` + +3. Ensure that you have all the babel dependencies to version `^7.0.0` (you may also need to add `"babel-core": "7.0.0-bridge.0"` as a yarn resolution to ensure retro-compatibility). The Babel team has released a tool, [babel-upgrade](https://github.com/babel/babel-upgrade), that should help you in this migration. +4. Upgrading android gradle version to 4.4 + 1. In your project's `android/gradle/wrapper/gradle-wrapper.properties` file, change the `distributionUrl` to `https\://services.gradle.org/distributions/gradle-4.4-all.zip` + 2. In `android/build.gradle` file add `google()` right above `jcenter()` in both `buildscript` and `allprojects` repositories. Then change Android build tools to version 3.1.4 `classpath 'com.android.tools.build:gradle:3.1.4'` + 3. In `android/app/build.gradle` file update all your `compile` statements to be `implementation`, e.g. `implementation 'com.facebook.fresco:animated-gif:1.10.0'` + 4. Do note that when running your app from within Android Studio, you may encounter `Missing Byte Code` errors. This is due to [a known issue](https://issuetracker.google.com/issues/72811718) with version 3.1.x of the android tools plugin. You'll need to disable Instant Run to get past this error. +5. If you have a custom packager configuration via `rn-cli.config.js`, you probably need to update it to work with the updated Metro configuration structure (for full detail refer to Metro's [documentation](https://facebook.github.io/metro/docs/en/configuration)); here are some commonly encountered changes to `rn-cli.config.js`: + + ```diff + -const blacklist = require('metro/src/blacklist') + +const blacklist = require('metro-config/src/defaults/blacklist') + + // ... + + module.exports = { + + watchFolders: alternateRoots, + + resolver: { + + blacklistRE: blacklist + + }, + + transformer: { + + babelTransformerPath: require.resolve('./scripts/transformer.js'), + + }, + - getProjectRoots() { + - return [ + - path.resolve(__dirname), + - ].concat(alternateRoots) + - }, + - getBlacklistRE() { + - return blacklist; + - }, + - transformModulePath: require.resolve('./scripts/transformer.js'), + } + ``` + +6. Run `yarn` to ensure that all the new dependencies have been installed + +### Added: new features + +- Add .nvmrc and ensure node version required is compatible with ESLint 5 ([30b9d81087](https://github.com/facebook/react-native/commit/30b9d81087cb86f5fb272d00bfee63a0632009f5) by [@slorber](https://github.com/slorber)) +- Major improvements to accessibility features ([48b3d1322b](https://github.com/facebook/react-native/commit/48b3d1322b884f62eb5aeb36136bcd76c502e42d), [b5b704dc19](https://github.com/facebook/react-native/commit/b5b704dc19b80a1909d66adcd617220a98c7aace), [c36e8b3307](https://github.com/facebook/react-native/commit/c36e8b3307295690cddf74e3a41ca0ac11ac4c6b), [40f6998b67](https://github.com/facebook/react-native/commit/40f6998b6766e8aa3c038a1416e5c62cbafca109), [c1d0ccde0f](https://github.com/facebook/react-native/commit/c1d0ccde0f6f8615fce077ef7ee0867a14ca0fb7), [5eaa2d29c0](https://github.com/facebook/react-native/commit/5eaa2d29c0c4c633a40f7241408737c754edea84), [10b603fdd3](https://github.com/facebook/react-native/commit/10b603fdd34919f72304720c25d1420668a6213a), [d9eeae91a0](https://github.com/facebook/react-native/commit/d9eeae91a08123c3a458704869acd6f637fc4c53), [3cfa7ae698](https://github.com/facebook/react-native/commit/3cfa7ae69847cc3b687930346016b248f2427864), [5acb7211bb](https://github.com/facebook/react-native/commit/5acb7211bb211e0ef48334630ddccbb3f0ffa2da), [5741f77156](https://github.com/facebook/react-native/commit/5741f771562962110e105114a2c65def4baa805b), [d0b86ecb4f](https://github.com/facebook/react-native/commit/d0b86ecb4f33d6b10a99062f050a4d659db4ddfc), [e739143809](https://github.com/facebook/react-native/commit/e7391438093cd5dd5033204cdce62e66509e66e1), [c27b495a89](https://github.com/facebook/react-native/commit/c27b495a89e71ff13959eb4c34605a527514fa1e), [5aa040dfb7](https://github.com/facebook/react-native/commit/5aa040dfb780c09a6efa5d3072232dea775d432f), [03036f79f7](https://github.com/facebook/react-native/commit/03036f79f7b062ae11015b33cca3dd7e4e67dda6), [3bedc78a35](https://github.com/facebook/react-native/commit/3bedc78a35b9efc259299744f4134ac0e880d1ea), [ca01290d8e](https://github.com/facebook/react-native/commit/ca01290d8e8fe73494f317ed9f81d339e65fdea0), [121e2e5ca6](https://github.com/facebook/react-native/commit/121e2e5ca6cdb17051c6d8072072f7f480ac2015), [1bc52267f5](https://github.com/facebook/react-native/commit/1bc52267f504eb02c8744c380fa2de878b0ab79f), [48b3d1322b](https://github.com/facebook/react-native/commit/48b3d1322b884f62eb5aeb36136bcd76c502e42d), [ef3d8b23c3](https://github.com/facebook/react-native/commit/ef3d8b23c35246d4e088d532c41723e06b688f1b), [ef3d8b23c3](https://github.com/facebook/react-native/commit/ef3d8b23c35246d4e088d532c41723e06b688f1b), [50e400128e](https://github.com/facebook/react-native/commit/50e400128eba554af5de4ca267430524e3eff107), and [f39d0923c7](https://github.com/facebook/react-native/commit/f39d0923c78686118a5d268c0e659d2608d28df0) by [@ziqichen6](https://github.com/ziqichen6)) +- Add `YogaNodeProperties` implementation based on `ByteBuffer` ([0c97e75dfe](https://github.com/facebook/react-native/commit/0c97e75dfeec831abb6cb39889309d8299cdce9f) and [23657ccf5b](https://github.com/facebook/react-native/commit/23657ccf5bcab6c511903660b3c617c3b8248f20) by [@davidaurelio](https://github.com/davidaurelio)) +- Add `FlatList` and `SectionList` to Animated exports ([daa7c78055](https://github.com/facebook/react-native/commit/daa7c78055857cd2d9ea650de0c4b0f72d3f2acf) by [@yunyu](https://github.com/yunyu)) +- Adding new styling props to `FlatList`/`VirtualizedList` for `ListHeaderComponent` and `ListFooterComponent` ([a2675ced4e](https://github.com/facebook/react-native/commit/a2675ced4efe0df7745bf38908efa41d4d7a9841)) +- Added more info to Module Registry systraces ([c7fdd2701f](https://github.com/facebook/react-native/commit/c7fdd2701f7edc1a771a04c890da4d742dca6ffb) by [@axe-fb](https://github.com/axe-fb)) +- Added support for out-of-tree platform plugins via a new `haste` field in `package.json`; read more in the [docs entry](https://reactnative.dev/docs/out-of-tree-platforms) ([03476a225e](https://github.com/facebook/react-native/commit/03476a225e012a0285650780430d64fc79674f0f) by [@empyrical](https://github.com/empyrical)) +- Added `snapToOffsets` to `ScrollView` and made a number of fixes to `snapToInterval` as well ([fd744dd56c](https://github.com/facebook/react-native/commit/fd744dd56ca183933a67e8398e1d20da14a31aab) by [@olegbl](https://github.com/olegbl)) + +#### Android specific additions + +- Allow registering custom packager command handlers ([b3ef1c3a56](https://github.com/facebook/react-native/commit/b3ef1c3a5645793ef42d25bb16ef023a743a1f9f) by [@fkgozali](https://github.com/fkgozali)) +- Implement `AccessibilityInfo.setAccessibilityFocus` for Android ([be715ec705](https://github.com/facebook/react-native/commit/be715ec7053a77fa6c9087990a493d17c1155de2) by [@draperunner](https://github.com/draperunner)) +- Add Support for `overflow` style property ([b81c8b51fc](https://github.com/facebook/react-native/commit/b81c8b51fc6fe3c2dece72e3fe500e175613c5d4) and [bbdc12eda7](https://github.com/facebook/react-native/commit/bbdc12eda7dec135799b7f4c41fe678180970dd2)by [@yungsters](https://github.com/yungsters)) + +#### iOS specific additions + +- `WebView` can now use `WKWebView` internally if you pass `useWebKit={true}` ([7062e5bdb5](https://github.com/facebook/react-native/commit/7062e5bdb5582bb21d1ef890965f08cc20d292b7), [1442c265da](https://github.com/facebook/react-native/commit/1442c265da36601114ce184cd5bc322f45dc1b44), [3703927e7e](https://github.com/facebook/react-native/commit/3703927e7e12ffc8922644ea251cd6f7a384570c), [7a6dd9807c](https://github.com/facebook/react-native/commit/7a6dd9807cda45c2d60641864f2d6c8d401e8ae3), [e5f95aba9b](https://github.com/facebook/react-native/commit/e5f95aba9b23376de498456282ad17113ef44cd9), [1741fe9571](https://github.com/facebook/react-native/commit/1741fe95710556f30dc2442aaaae23e31dad4cc0), [90e85a4adc](https://github.com/facebook/react-native/commit/90e85a4adc749666f81034119f281ac54840e7df), [0022354525](https://github.com/facebook/react-native/commit/0022354525eae0a368704da65c9d0f85f33ba5fb), [03b57d9db6](https://github.com/facebook/react-native/commit/03b57d9db6509fa3e715f23c8270caf6ca091acd), [1584108805](https://github.com/facebook/react-native/commit/1584108805ca6c8eff7a77e15c8553028665b53f), [a997c0ac16](https://github.com/facebook/react-native/commit/a997c0ac16d8863333d057269a8b5e28994b84eb), [4ca949b46e](https://github.com/facebook/react-native/commit/4ca949b46ec8fd72b5305daa06fac3ef58a8fa5f), [721763020a](https://github.com/facebook/react-native/commit/721763020a4a7b4b3cad1a9c074ec2e51a8d840b), [1af17f1648](https://github.com/facebook/react-native/commit/1af17f164828b6d6fa0450af46baf945745363e7), [215fa14efc](https://github.com/facebook/react-native/commit/215fa14efc2a817c7e038075163491c8d21526fd), [bacfd92976](https://github.com/facebook/react-native/commit/bacfd9297657569006bab2b1f024ad1f289b1b27), [95801f1eda](https://github.com/facebook/react-native/commit/95801f1eda2d723d9b87760d88fa9f1a1bb33ab1), [b18fddadfe](https://github.com/facebook/react-native/commit/b18fddadfeae5512690a0a059a4fa80c864f43a3), [28b058c341](https://github.com/facebook/react-native/commit/28b058c341690bd35e1d59885762ec29614a3d45), and [78fcf7c559](https://github.com/facebook/react-native/commit/78fcf7c5598ce7f5d0d62110eb34fe5a4b962e71) by [@rsnara](https://github.com/rsnara)) +- Add `accessibilityHint` for iOS ([253b29dbd8](https://github.com/facebook/react-native/commit/253b29dbd8ddb11824866e423c00a4a68bb856f3) by [@draperunner](https://github.com/draperunner)) + +### Changes: existing functionality that is now different + +- _[BREAKING]_ In the CLI, `unbundle` is now `ram-bundle` ([ebf5aeab28](https://github.com/facebook/react-native/commit/ebf5aeab280f2ebc439ec39d25c48fdf1980cf73) by [@jeanlauliac](https://github.com/jeanlauliac)) +- Bump minimum Node version to 8.3 (#20236) ([e64e13fce3](https://github.com/facebook/react-native/commit/e64e13fce394332ce609f0def35fa573f30138e9) by [@hramos](https://github.com/hramos)) +- Updated React ([70913a4623](https://github.com/facebook/react-native/commit/70913a4623c53db8a0db578eec30cad8671f8319), [b7bb25fe4c](https://github.com/facebook/react-native/commit/b7bb25fe4c1bfbedb5b8c75725721cf901dc54b0), and [672528ffde](https://github.com/facebook/react-native/commit/672528ffde3b467ccdfd6b1ce0352f150b20c922) by [@acdlite](https://github.com/acdlite), [@hramos](https://github.com/hramos), and [@yungsters](https://github.com/yungsters)) +- Upgrade Flow to v0.76.0 ([eac34e3021](https://github.com/facebook/react-native/commit/eac34e30215d88b5fe9056f9678275b894032636) by [@gabelevi](https://github.com/gabelevi)) +- Upgrade jest to 23.4.1 ([51cf9eb3e8](https://github.com/facebook/react-native/commit/51cf9eb3e823a13304570b352b81734f069c18c3) by [@rafeca](https://github.com/rafeca)) +- Upgrade babel-eslint to v9.0.0-beta.2 with better support for Flow ([abf1188de2](https://github.com/facebook/react-native/commit/abf1188de225e4b7d36ecbad316af92ca29c85c2) by [@rubennorte](https://github.com/rubennorte)) +- Upgrade ESLint to 5.1.0 ([0f2f0cad41](https://github.com/facebook/react-native/commit/0f2f0cad41f632d1dbb0c676d5edea5db62eb01c) by [@rubennorte](https://github.com/rubennorte)) +- Upgrade Babel to v7.0.0 ([b9d1c832b0](https://github.com/facebook/react-native/commit/b9d1c832b0bb7161bcec48d655e878af609b8350), [724c7498b6](https://github.com/facebook/react-native/commit/724c7498b6f10f6fd03eb217160508001fb1c5b3) by Peter van der Zee, and [bf8e1b4ffa](https://github.com/facebook/react-native/commit/bf8e1b4ffab4958587efdf3ce97e4ebdd887a20c) by [@rubennorte](https://github.com/rubennorte) and [@rafeca](https://github.com/rafeca)) +- Metro is now at v0.45.0 ([169d6839bb](https://github.com/facebook/react-native/commit/169d6839bb32d0149036ab1641d13318c0eb6f9d), [bda84a32d0](https://github.com/facebook/react-native/commit/bda84a32d08d6de3849d6afac4cbbf309837b676), [877212e18c](https://github.com/facebook/react-native/commit/877212e18c86905feda9faa1b2508c0c39396227), [169812f9ce](https://github.com/facebook/react-native/commit/169812f9ce60317dd7320384007879be16278678), [cfeb60c19b](https://github.com/facebook/react-native/commit/cfeb60c19bd23e683f1809f6535439c81e8ed166) by [@CompuIves](https://github.com/CompuIves) and [@rafeca](https://github.com/rafeca)) +- Hide pre-bundled notification when not on dev mode ([edf71005b5](https://github.com/facebook/react-native/commit/edf71005b5a4d7cfb09eae14f5765d30b9c5704e) by [@yancouto](https://github.com/yancouto)) +- Refined `StyleSheet.compose` Flow Type ([50a481d23a](https://github.com/facebook/react-native/commit/50a481d23ae72a434849d2c85007e411b0c2bb1f) by [@yungsters](https://github.com/yungsters)) +- Catch JS bundle load failure and prevent calls to JS after that ([201ba8c69d](https://github.com/facebook/react-native/commit/201ba8c69d2defc284a04acadcd13df001028ada) by [@fkgozali](https://github.com/fkgozali)) +- Use new Metro configuration in react-native cli ([a32620dc3b](https://github.com/facebook/react-native/commit/a32620dc3b7a0ebd53feeaf7794051705d80f49e) and [aaf797ad67](https://github.com/facebook/react-native/commit/aaf797ad67b965f64450b199c554c65ad8dad351) by [@CompuIves](https://github.com/CompuIves)) +- Whitelist `react-native-dom` in haste/cli config defaults ([c4bcca6685](https://github.com/facebook/react-native/commit/c4bcca66853cd231486de61f11cbcec42427b7b2) by [@vincentriemer](https://github.com/vincentriemer)) +- In the CLI, don't override `metro.config.js` settings ([c5297c75cb](https://github.com/facebook/react-native/commit/c5297c75cb6da58a241c8f91b0d2fefbc5835a46) by [@rozele](https://github.com/rozele)) + +#### Breaking Changes + +- Public methods of Image (`blur`, `focus`, `measure`, `measureInWindow`, `measureLayout`, `setNativeProps`) are no longer bound to the image component instance. Therefore, it is unsafe to pass these methods by reference (i.e: as callbacks) to functions. So, things like `setTimeout(this._imgRef.focus, 1000)` will no longer work. Please instead do: `setTimout(() => this._imgRef.focus(), 1000)`. + +#### Android specific changes + +- `Image` source without a uri now returns null ([28c7ccf785](https://github.com/facebook/react-native/commit/28c7ccf785132458fce32c234ce777a6fe475c93) by [@himabindugadupudi](https://github.com/himabindugadupudi)) +- `targetSdkVersion` is 26 ([bfb68c09ee](https://github.com/facebook/react-native/commit/bfb68c09ee88c6e1d91d3b54c01746f9a98c7c6c) by [@dulmandakh](https://github.com/dulmandakh)) +- Upgrade NDK to r17b ([6117a6c720](https://github.com/facebook/react-native/commit/6117a6c7205c969f93d39ba02e0583881572d5fa) by [@dulmandakh](https://github.com/dulmandakh)) +- Upgrade NDK toolchain to 4.9 ([ccdd450b12](https://github.com/facebook/react-native/commit/ccdd450b1284b73bee80a9709c864816cbfc1108) by [@dulmandakh](https://github.com/dulmandakh)) +- Upgrade Android Support Library to version 27.1.1 and set compileSdkVersion to 27; buildToolsVersion comes along for the ride, too ([874cca1ac2](https://github.com/facebook/react-native/commit/874cca1ac258ec224bade999722d7a34c307def0) and [044b399e65](https://github.com/facebook/react-native/commit/044b399e6590d84065a9b186750f77bc9d851aac) by [@dulmandakh](https://github.com/dulmandakh)) +- Upgrade Android gradle plugin to 3.1.4, Gradle wrapper to 4.4 ([6e356895e7](https://github.com/facebook/react-native/commit/6e356895e79fb92640295a14483af1a430732247) and [33d20da41b](https://github.com/facebook/react-native/commit/33d20da41b814a2fb9ba02cbab8b61a819cad95b) by [@gengjiawen](https://github.com/gengjiawen) and [@dulmandakh](https://github.com/dulmandakh)) +- Upgrade to soloader 0.5.1 ([b6f2aad9c0](https://github.com/facebook/react-native/commit/b6f2aad9c0119d11e52978ff3fa9c6f269f04a14) by [@gengjiawen](https://github.com/gengjiawen)) +- Upgrade mockito to 2.19.1 ([3ea803a814](https://github.com/facebook/react-native/commit/3ea803a814f43edb3ec256dd85d778c652ca99d1) by [@dulmandakh](https://github.com/dulmandakh)) +- Upgrade glog to 0.3.5 ([b5fca80605](https://github.com/facebook/react-native/commit/b5fca806059e628edb504cb1bacf62e89ee6f102) by [@dulmandakh](https://github.com/dulmandakh)) + +### Fixed: bugs that have been resolved + +- Fixed builds on Windows machines ([3ac86c366c](https://github.com/facebook/react-native/commit/3ac86c366c91f8d62f0128057019b94a783b4249) by [@rafeca](https://github.com/rafeca)) +- Fixed building tvOS ([1f1ddd0261](https://github.com/facebook/react-native/commit/1f1ddd0261762bdeff3e747250400b208b18839b)) +- Fixed `TextInputState`'s `currentlyFocusedField()` ([b4b594cec1](https://github.com/facebook/react-native/commit/b4b594cec1d91c38faac11a90a787ae692e35296) by [@janicduplessis](https://github.com/janicduplessis)) +- `` fix for jumpy content when `initialScrollIndex` specified ([e0c73633cf](https://github.com/facebook/react-native/commit/e0c73633cfc0a62df9d39991b0df65fa5875609a) by [@rbrosboel](https://github.com/rbrosboel)) +- Fix local-cli assetRegistryPath and middlewares ([f05943de0a](https://github.com/facebook/react-native/commit/f05943de0abfc16da41163c6b91a04ecc8de8e67) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix issue with when all are `flexGrow` and `flexShrink` set to 0 except for one ([90a408ea6f](https://github.com/facebook/react-native/commit/90a408ea6ff7833e33b4058f490073e04460d00b) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- Fix react-native CLI's debugger UI path and metro host/port arg usage ([5067540487](https://github.com/facebook/react-native/commit/50675404873c1ffac0deedc51fe745168051148b) by [@Kureev](https://github.com/Kureev)) +- Hotfix to include `react-native-windows` in hasteImpl accepted paths ([54942746d4](https://github.com/facebook/react-native/commit/54942746d4037e1153e14fcfc95e4edc772d296a) by [@rubennorte](https://github.com/rubennorte)) +- Fix some classes of incorrect Flow errors for `Animated` ([db2159d0b3](https://github.com/facebook/react-native/commit/db2159d0b3fd57556383eff68d32d32246dd9081) by [@yunyu](https://github.com/yunyu)) +- Fixed a typo in DockerTests.md ([c1831d50cf](https://github.com/facebook/react-native/commit/c1831d50cfd35b7a7393e50bc71d8389b36021ce) by [@kant](https://github.com/kant)) +- Fix invalid use of destructuring in jest preprocessor ([9d5bd50737](https://github.com/facebook/react-native/commit/9d5bd507372c7b63e59a94383c3e3091d96409de) by [@umairda](https://github.com/umairda)) +- Fixed a CLI crash when using old versions of node ([e61176d650](https://github.com/facebook/react-native/commit/e61176d650e2b5fe51dd6cd4c429ff47a1a9b1dc) by [@keksipurkki](https://github.com/keksipurkki)) + +#### Android specific fixes + +- Fix issue with AsyncStorage not behaving properly on Android 7+ ([1b09bd7fba](https://github.com/facebook/react-native/commit/1b09bd7fba92431d63d2cecb83565491e91db396)) +- Fixed extreme `` slowness ([5017b86b52](https://github.com/facebook/react-native/commit/5017b86b525e3ef6023f0f8a88e6fd1cf98024e0) by [@gnprice](https://github.com/gnprice)) +- Fixed `` placeholder not being completely visible ([84022321c4](https://github.com/facebook/react-native/commit/84022321c437e597660ecd8a773e51bdf8855f4e) and [86f24ccf71](https://github.com/facebook/react-native/commit/86f24ccf71f4c41904838c8c7e13268c300fd745) by [@jainkuniya](https://github.com/jainkuniya)) +- Fix Horizontal ``'s scroll position during layout changes with RTL content ([de573277bf](https://github.com/facebook/react-native/commit/de573277bf64703aefdeb52db2c2524b2c241bab)) +- Fix Horizontal `` overflow issue ([d5465a9a0a](https://github.com/facebook/react-native/commit/d5465a9a0a840f7e759bb8fb6679b01017eb3d05)) +- Fixing crash on SDK 15 on ReactTextInputLocalData ([1bb2bead8b](https://github.com/facebook/react-native/commit/1bb2bead8bef850037c8b72209cd72a442572821)) +- Fix Drawing Rect for ReactScrollView ([6a16bec882](https://github.com/facebook/react-native/commit/6a16bec882cba809bdf9027367b76f6543b6617d) by [@yungsters](https://github.com/yungsters)) +- Fixed NoSuchKeyException Thrown From ReadableNativeMap bysafely unwrapping ReadableMap by defaulting to 0 if key not present ([1a6666a116](https://github.com/facebook/react-native/commit/1a6666a116fd8b9e8637956de2b41a1c315dd470) by [@Bhavik-P](https://github.com/Bhavik-P)) +- Fixed runAndroid to enable the use of a package on port <> 8081 for Windows ([3cd0737fe2](https://github.com/facebook/react-native/commit/3cd0737fe2dce9df29822854bfbfaf2f22346c69) by [@ihenshaw](https://github.com/ihenshaw)) +- Don't crash on upload retry when trying to fetch on a varying quality network ([79fe925f1d](https://github.com/facebook/react-native/commit/79fe925f1daa053d5a5d92a228e5c7beff565ab4) by [@dryganets](https://github.com/dryganets)) + +#### iOS specific fixes + +- Fix `TextInput.clear()` and `TextInput.setNativeProps({text: ''})` to work ([2307ea60d0](https://github.com/facebook/react-native/commit/2307ea60d03edd234511bfe32474c453f30c1693) by [@magicien](https://github.com/magicien)) +- Correct fishhook import in RCTReconnectingWebSocket ([75a0273de2](https://github.com/facebook/react-native/commit/75a0273de21948b0b959263100f09111f738ec35)) +- Change in RCTImagePickerManager to handle crashes if height/width is nil ([82af7c989b](https://github.com/facebook/react-native/commit/82af7c989be42a516f438f162d21f699be297e79) by [@abhi06276](https://github.com/abhi06276)) +- Fix controlled `` on iOS when inputting in Chinese/Japanese ([892212bad2](https://github.com/facebook/react-native/commit/892212bad2daadd373f4be241e4cd9889b0a1005) by [@mmmulani](https://github.com/mmmulani)) +- Fixed `` bug encountered with brownfield apps ([fab5fffbb3](https://github.com/facebook/react-native/commit/fab5fffbb3eb8668c9202dec5e770330d49880b0) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- Fixed missing selection indicator lines on `` ([e592d6f8c7](https://github.com/facebook/react-native/commit/e592d6f8c7b0409ab6f0a2dbf6ebe3cea28c3e79) by [@VSchlattinger](https://github.com/VSchlattinger)) +- Fix crash in RCTImagePicker on iOS ([934c50fbe0](https://github.com/facebook/react-native/commit/934c50fbe07e49391ba27c3469f99bec65e48d39) by [@mmmulani](https://github.com/mmmulani)) +- Fix `undefined_arch` error received when building in Xcode 10 beta ([e131fffb37](https://github.com/facebook/react-native/commit/e131fffb37a545363daf11735a0243165b57f63f) by [@futuun](https://github.com/futuun)) +- Add support for connecting to the Packager when running the iOS app on device when using custom Debug configuration ([079bf3f206](https://github.com/facebook/react-native/commit/079bf3f2067cb268b60e75cd9e1bc51a9c85359c)) +- Fixed RCTAnimation import for integrating with cocoapods ([eef8d47a37](https://github.com/facebook/react-native/commit/eef8d47a37211bf7d4978db75df1fedd9cacbde8) by [@LukeDurrant](https://github.com/LukeDurrant)) + +### Removed: features that have been removed; these are breaking + +- _[BREAKING]_ Removed `ScrollView.propTypes`; use flow or typescript for verifying correct prop usage instead ([5b6ff01764](https://github.com/facebook/react-native/commit/5b6ff01764502c88848867c7e04cab969da384a2) by [@sahrens](https://github.com/sahrens)) + +#### Android specific removals + +- `ReactInstancePackage` is now deprecated; use `@link ReactPackage` or `@link LazyReactPackage` ([b938cd524a](https://github.com/facebook/react-native/commit/b938cd524a20c239a5d67e4a1150cd19e00e45ba) by [@axe-fb](https://github.com/axe-fb)) + +## v0.56.0 + +Welcome to the June 2018 release of React Native! +Over 60 contributors made [821 commits](https://github.com/facebook/react-native/compare/0.55-stable...0.56-stable) since March - and we are extremely grateful to every single one of you. + +As you'll see in a second, this new version has some important **breaking changes** that required a lot of extra efforts to bring to a stable 0.56. This was the main reason behind skipping April and May from the monthly release cycle, but looking forward we are planning on going back to do a rollout every month. + +### Highlights + +#### React Native now uses **Babel 7** + +When upgrading to 0.56, make sure to bump your `babel-preset-react-native` `package.json` dependency to `5.0.2` or newer (but still as _fixed_ value). + +React Native library authors will need to update their libraries to make use of the updated Babel preset as Babel 7 is **not** backwards compatible. + +If you have issues upgrading to Babel 7, please double check the [related documentation](https://new.babeljs.io/docs/en/next/v7-migration.html#versioning-dependencies-blog-2017-12-27-nearing-the-70-releasehtml-peer-dependencies-integrations), in particular the sections related to _Package Renames_ and _Scoped Packages_. + +The [`babel-bridge`](https://github.com/babel/babel-bridge) library may be used if you need to use libraries that have not yet upgraded to Babel 7. You may also enforce the Babel 7 dependency via tools like [yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/). Overall, you need to ensure all the `@babel/*` deps are fixed at version `7.0.0-beta.47`. + +#### **Node 8** is now the minimum required version + +Trailing commas are now allowed. + +#### **iOS 9** is now the minimum required version + +Any device that can run iOS 8, can upgrade to iOS 9. Developers who support iOS 8 in their apps may continue doing so as this is a Xcode-level setting (`IPHONEOS_DEPLOYMENT_TARGET`). + +#### **Xcode 9** is now the minimum required version + +We recommend using Xcode 9.4 as that is what we use to run our tests. + +#### **Android** projects are now compiled using the _Android 26 SDK_ + +The target API level is left unchanged in this release. + +Starting August 2018, new apps submitted to the Play Store will need to target API 26 as a minimum. You can now opt your project in to use API 26 (or newer) as the target. Please let us know about any issues, as we'd like to finalize support for Android API 26 by the time `0.57.0` is released. + +#### `WebView` will only load http(s) URLs by default + +Geolocation is disabled by default. + +#### Consistently Throw for `` + +Removes a pitfall that people may run into when releasing an app for Android if the bulk of the testing has been performed on iOS only. Nesting a `` within a `` component (e.g. ``) is unsupported on Android, but using this pattern on iOS has not thrown errors in the past. With this release, nesting a `` inside a `` will now throw an error on iOS in order to reduce the parity gap between the platforms. + +#### Flow improvements, migrating away from PropTypes + +Added Flow types for several components. + +We're migrating away from PropTypes and runtime checks and instead relying on **Flow**. You'll notice many improvements related to Flow in this release. + +- Fix project settings warnings on newer Xcode versions, remove unnecessary console logging. +- Modernized `YellowBox`. + Sort warnings by recency, group warnings by format string, present stack traces, show status of loading source maps, support inspecting each occurrence of a warning, and bug fixes. +- Prettier files! +- Lots of bug fixes. + +#### State of React Native + +Heads-up: the Facebook internal team is [currently working on a rewrite of some core architecture pieces](https://reactnative.dev/blog/2018/06/14/state-of-react-native-2018). This is a **work in progress** and we do not expect it to be ready for use in open source quite yet, but we felt the need to let you know what those commits mentioning Fabric are about. + +--- + +### Added: new features + +- Update `babelHelpers` with Babel 7 support ([fbd1beaf66](https://github.com/facebook/react-native/commit/fbd1beaf666be9c09a380784f8c0cd34ba083a6b)) +- `FlatList` is now Strict Mode compliant ([a90d0e3614](https://github.com/facebook/react-native/commit/a90d0e3614c467c33cf85bcbe65be71903d5aecc)) +- Enable `?.` optional chaining operator plugins ([aa6f394c42](https://github.com/facebook/react-native/commit/aa6f394c4236e5a4998c3be8ed61ec1bab950775)) +- Support `flexWrap: 'wrap-reverse'` ([d69e55060f](https://github.com/facebook/react-native/commit/d69e55060fd76d91eccc45905d250a9fce4b2c49)) +- Add prop type `accessibilityTraits` to `Text` ([654435d1ed](https://github.com/facebook/react-native/commit/654435d1ed9e584e65fff601e1fa50591e042664)) +- Add devDependencies support for templates ([c4ab03a18e](https://github.com/facebook/react-native/commit/c4ab03a18e75e6ed55444b5d86f3ceee435b9a78)) +- Add support for springDamping in `SpringInterpolator` ([1dde989919](https://github.com/facebook/react-native/commit/1dde989919d2c272ca7fcaa5c4b2d9ee02c490a0)) + +#### Android specific additions + +- Add support for build.gradle with CRLF for use with `react-native link` ([843cfc3b20](https://github.com/facebook/react-native/commit/843cfc3b202433aad9a236b1b623da7c45e1ac15)) +- add decimal pad to android ([75e49a0637](https://github.com/facebook/react-native/commit/75e49a0637eaa3bd3bb7e445648f084a42d9c8af)) +- Add a way to dismiss PopupMenu elements ([353c070be9](https://github.com/facebook/react-native/commit/353c070be9e9a5528d2098db4df3f0dc02d758a9)) +- Implement `Image.defaultSource` ([b0fa3228a7](https://github.com/facebook/react-native/commit/b0fa3228a77d89d6736da6fcae5dd32f74f3052c)) +- Support Image resizeMode=repeat ([0459e4ffaa](https://github.com/facebook/react-native/commit/0459e4ffaadb161598ce1a5b14c08d49a9257c9c)) +- Yoga: Add back deprecated `getParent` methods for non-breaking API change ([c3c5c3cbce](https://github.com/facebook/react-native/commit/c3c5c3cbce24a31f73ae6339e377ee76ca6401ad)) + +#### iOS specific additions + +- Run tests using Xcode 9.4 and iOS 11.4 ([c55bcd6ea7](https://github.com/facebook/react-native/commit/c55bcd6ea729cdf57fc14a5478b7c2e3f6b2a94d)) +- Add support for Homebrew-installed Node ([0964135a17](https://github.com/facebook/react-native/commit/0964135a178b459e06b44a49a4ecb0dd6c5bec9b)) +- Add textTransform style support ([8621d4b797](https://github.com/facebook/react-native/commit/8621d4b79731e13a0c6e397abd93c193c6219000)) +- Add docs for Swift usage to `RCTBridgeModule.h` ([ca898f4367](https://github.com/facebook/react-native/commit/ca898f4367083e0943603521a41c48dec403e6c9)) + +--- + +### Changes: existing functionality that is now different + +- Upgrade React Native to Babel 7 ([f8d6b97140](https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c)) +- New projects created using `react-native init` will use Babel 7 ([e315ec9891](https://github.com/facebook/react-native/commit/e315ec9891eb0bcb51afb0e797dbd49aa8f9ac71)) +- Restrict `WebView` to only http(s) URLs: ([634e7e11e3](https://github.com/facebook/react-native/commit/634e7e11e3ad39e0b13bf20cc7722c0cfd3c3e28), [23f8f7aecb](https://github.com/facebook/react-native/commit/23f8f7aecb1f21f4f5e44fb9e4a7456ea97935c9)) +- Node 8 is now the minimum required version ([c1e6f27823](https://github.com/facebook/react-native/commit/c1e6f278237e84c8ed26d3d2eb45035f250e2d40)) +- Upgrade React to v16.4.1, sync React Renderer to revision ae14317 ([c749d951ad](https://github.com/facebook/react-native/commit/c749d951ada829c6f6fb76f35e68142e61054433)) +- Update new project template's Flow config to fix `Cannot resolve module X` isse due to removal of `@providesModule` ([843a433e87](https://github.com/facebook/react-native/commit/843a433e87b0ccaa64ab70d07e22bffbabad8045)) +- Upgrade Flow to v0.75 ([3bed272a62](https://github.com/facebook/react-native/commit/3bed272a620ac806a6142327013265ea8138641a), [bc2f12c68c](https://github.com/facebook/react-native/commit/bc2f12c68cf8cfdf8c060354e84392fd9a3645d8), [6264b6932a](https://github.com/facebook/react-native/commit/6264b6932a08e1cefd83c4536ff7839d91938730)) +- Upgrade Flow definitions ([f8b4850425](https://github.com/facebook/react-native/commit/f8b4850425f115c8a23dead7ec0716b61663aed6)) +- Upgrade Prettier to v1.13.6 ([29fb2a8e90](https://github.com/facebook/react-native/commit/29fb2a8e90fa3811f9485d4b89d9dbcfffea93a6), [bc2f12c68c](https://github.com/facebook/react-native/commit/bc2f12c68cf8cfdf8c060354e84392fd9a3645d8)) +- Upgrade Jest to v23.2.0 ([536c937269](https://github.com/facebook/react-native/commit/536c9372692712b12317e657fc3e4263ecc70164), [bc2f12c68c](https://github.com/facebook/react-native/commit/bc2f12c68cf8cfdf8c060354e84392fd9a3645d8)) +- Upgrade Metro to v0.38 ([d081f83a04](https://github.com/facebook/react-native/commit/d081f83a0487ffbc7d19f8edc7532611b359dfc6)) +- Modernized `YellowBox` ([d0219a0301](https://github.com/facebook/react-native/commit/d0219a0301e59e8b0ef75dbd786318d4b4619f4c)) +- Disallow requiring from invariant/warning ([521fb6d041](https://github.com/facebook/react-native/commit/521fb6d041167ec8a8d0e98ac606db1f27f0c5c8)) +- Remove native prop type validation ([8dc3ba0444](https://github.com/facebook/react-native/commit/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34)) +- Add `$FlowFixMe` to invalid prop accesses where Flow wasn't complaining before ([f19ee28e7d](https://github.com/facebook/react-native/commit/f19ee28e7d896aaacf26c6f850230019bdef0d3d)) +- Create Flow props for `Image` ([8bac869f5d](https://github.com/facebook/react-native/commit/8bac869f5d1f2ef42e707d0ec817afc6ac98b3b2)) +- Flow type for `SegmentedControlIOS` ([113f009698](https://github.com/facebook/react-native/commit/113f009698dbd8f1b4c1048d77ff1eb373021083)) +- Flow type for `ProgressViewIOS` ([c87701ba05](https://github.com/facebook/react-native/commit/c87701ba05a8524756e87c089eb92c8f3c81823e)) +- Flow type for `PickerIOS` ([1c66cdc7e8](https://github.com/facebook/react-native/commit/1c66cdc7e8ce8190dfbef76629601497446b2b0a)) +- Flow type for `Switch` ([06052a2330](https://github.com/facebook/react-native/commit/06052a2330fc9c1dd0d56c6bbe5a17703f80c6b9)) +- Flow type for `Slider` ([cbe045a95f](https://github.com/facebook/react-native/commit/cbe045a95f1ca53d99ae521742a93299a53d6136)) +- Flow type for `RefreshControl` ([891dfc3da4](https://github.com/facebook/react-native/commit/891dfc3da4b5825097aedf73ff04e8982c00aeff)) +- Flow type for `ListView` ([4b1ecb6204](https://github.com/facebook/react-native/commit/4b1ecb62045fbb78764d1f51030f2253be705c5c)) +- Flow type for `TextInput` ([c8bcda8150](https://github.com/facebook/react-native/commit/c8bcda8150278fde07331ca6958976b2b3395688)) +- Flow type for `TouchableBounce` ([8454a36b0b](https://github.com/facebook/react-native/commit/8454a36b0bc54cb1e267bc264657cc693607da71)) +- Flow type for `TouchableOpacity` ([44743c07ad](https://github.com/facebook/react-native/commit/44743c07ad672e39668f92a801578906ec92996a)) +- Flow type for `TouchableHighlight` ([f0c18dc820](https://github.com/facebook/react-native/commit/f0c18dc820537892dcc33d5aebbf4f52cf299b95)) +- Flow type for `TouchableWithoutFeedback` ([0b79d1faa2](https://github.com/facebook/react-native/commit/0b79d1faa21eb3c29aeeba08ee0fb2ed62e6cc54)) +- Flow type for `ScrollView` ([b127662279](https://github.com/facebook/react-native/commit/b1276622791d5dbe4199bb075f473908c3e62b31)) +- Flow type for `DatePickerIOS` ([97e572ea6d](https://github.com/facebook/react-native/commit/97e572ea6d7b1fd829ca20f5d5c8ff970d88e68b)) +- Flow type for `KeyboardAvoidingView` ([188b118b60](https://github.com/facebook/react-native/commit/188b118b6075be1614c553596b85d430767f2dbc)) +- Flow type for `ActivityIndicator` ([0b71d1ddb0](https://github.com/facebook/react-native/commit/0b71d1ddb03c036ed118574c105b0af505da19fc)) +- Remove `$FlowFixMe` in `TouchableBounce` ([ffda017850](https://github.com/facebook/react-native/commit/ffda0178509ed92396f15db37a41d3d668ade4e6)) +- Remove `$FlowFixMe` in `ScrollView` ([af6e2eb02d](https://github.com/facebook/react-native/commit/af6e2eb02d3651f869b5436e68e61ef3ab3405a0)) +- Remove `$FlowFixMe` in `ListView` ([af6e2eb02d](https://github.com/facebook/react-native/commit/af6e2eb02d3651f869b5436e68e61ef3ab3405a0)) +- Remove `$FlowFixMe` in `Text` ([6042592cf4](https://github.com/facebook/react-native/commit/6042592cf46787f089e76b661376705380607207)) +- Remove `$FlowFixMe` in `RTLExample` ([206ef54aa4](https://github.com/facebook/react-native/commit/206ef54aa415e3e2bb0d48111104dfc372b97e0f)) +- Remove `$FlowFixMe` in `AppContainer` ([a956551af7](https://github.com/facebook/react-native/commit/a956551af73cf785ee4345e92e71fd5b17c5644e)) +- Remove `$FlowFixMe` in `Slider` ([1615f9d161](https://github.com/facebook/react-native/commit/1615f9d16149c7082ce0e1485aa04a6f2108f7ba)) +- `StyleSheet`: Support animated values for border dimensions ([3e3b10f404](https://github.com/facebook/react-native/commit/3e3b10f4044ada7b523d363afb614720468c217f)) +- Update `react-devtools-core` and `plist` to include security fixes reported by `npm audit` ([3a1d949906](https://github.com/facebook/react-native/commit/3a1d949906acb0c3b44d125d54d0c99305bbbb56)) +- Update `Switch` to ES6 Class ([970caa4552](https://github.com/facebook/react-native/commit/970caa4552d4ba87c1a954391535ff42b00832e7)) +- Update `Slider` to ES6 Class ([5259450c14](https://github.com/facebook/react-native/commit/5259450c143f71c65e157d6b7d3f0e1655eb7aa1)) +- Update `ActivityIndicator` to ES6 Class ([edd7acbb1e](https://github.com/facebook/react-native/commit/edd7acbb1e6fe185600a19cc1cbb38feb16c85ad)) +- Update `RefreshControl` to ES6 Class ([a35a238317](https://github.com/facebook/react-native/commit/a35a23831789030e17f766f72d307ae315be107d)) +- Update `KeyboardAvoidingView` to ES6 Class ([c017dcb0f2](https://github.com/facebook/react-native/commit/c017dcb0f2903b49b2f21cc150226aeb7f5026ee)) +- Update `DatePickerIOS` to ES6 Class ([f8c8231706](https://github.com/facebook/react-native/commit/f8c8231706492b588331354d45b833aa21434e13)) +- Update `Text` to ES6 Class ([ab92c00245](https://github.com/facebook/react-native/commit/ab92c00245c0ce717819ddb0ab8b9204d4c13c34)) +- Replace `context.isInAParentText` w/ `React.createContext` ([e1339bc183](https://github.com/facebook/react-native/commit/e1339bc18303ca5394cd0c9dc97cededb2261581)) +- Cleanup `Text` implementation ([06c05e744d](https://github.com/facebook/react-native/commit/06c05e744d8af9582bde348210f254d76dae48b9)) +- Switch `Text` to `React.forwardRef` ([e708010d18](https://github.com/facebook/react-native/commit/e708010d18f938e2d6b6424cfc9485d8e5dd2800)) +- Switch `View` to `React.forwardRef` ([3e534b9aab](https://github.com/facebook/react-native/commit/3e534b9aab5156adac67762877b2457408fe8934)) +- Update uses of `genMockFunction` and `genMockFn` to `fn` in tests ([390ded871c](https://github.com/facebook/react-native/commit/390ded871cb905d149e9c1f4a082e67a7ec7addb)) +- Make `ViewProps` exact ([65c336f38f](https://github.com/facebook/react-native/commit/65c336f38f4afd43c8b5f81745abf38bd9b8ddbf)) +- Spread `TVViewProps` into `ViewProps` instead of intersection ([bc658d3c44](https://github.com/facebook/react-native/commit/bc658d3c4405676643d952a126295dbc7fc26217)) +- Allow trailing commas ([1e2de71290](https://github.com/facebook/react-native/commit/1e2de712907e5fe0d17648f0ff5c81d4384ca85b)) +- Use `let`/`const` ([8f5ebe5952](https://github.com/facebook/react-native/commit/8f5ebe5952d0675b463137103a82f3fb0c26ae0d)) +- Refactor `MockNativeMethods` in Jest ([5d4c542c58](https://github.com/facebook/react-native/commit/5d4c542c58d84bbe05f76bf01d9efdd9d438572c)) +- Use app name from `app.json` after ejecting ([57774a4a98](https://github.com/facebook/react-native/commit/57774a4a981e2f12cfe9b029447e34f203221b18)) +- Suggest `git apply --reject` for failed upgrades ([4fbd244b9a](https://github.com/facebook/react-native/commit/4fbd244b9a6b62e0efe1b4b5a7ec3de468f020f6)) +- Moved `TouchHistoryMath` from React to React Native ([06085d3836](https://github.com/facebook/react-native/commit/06085d38366373f3135074dc14e2c9871ca4fe29)) +- Refactor `RCTInputAccessoryView` ([c136c54ff0](https://github.com/facebook/react-native/commit/c136c54ff0211e2bf149fab600cd6e295f9d19dd)) +- Don't wrap `ListEmptyComponent` in an extra view ([db061ea8c7](https://github.com/facebook/react-native/commit/db061ea8c7b78d7e9df4a450c9e7a24d9b2382b4)) +- Move `Text` PropTypes to its own file ([cd8128b2ec](https://github.com/facebook/react-native/commit/cd8128b2eccf6898cdf798a1e1be1f7a5762a0d4)) +- Mock `ReactNative.NativeComponent` native methods in Jest ([3e9a371ace](https://github.com/facebook/react-native/commit/3e9a371ace5f25b2eb7a0d30177251f8a0c10ed9)) +- Tightening types for `View` and `VirtualizedList` ([5035af80ec](https://github.com/facebook/react-native/commit/5035af80ecddb44e2a8444780f25f336b760bf32)) +- Make values optional in `ViewPropTypes` ([f1316cab6c](https://github.com/facebook/react-native/commit/f1316cab6c351852ef1da9939d4c8f0244fb8a6f)) +- propTypes are optional for native components ([dbdf43b428](https://github.com/facebook/react-native/commit/dbdf43b428da19a9eba012753904bcf33339ea9a)) +- Rename `Style` to `DangerouslyImpreciseStyle` ([4895c645ea](https://github.com/facebook/react-native/commit/4895c645ea17ff939811f3d5ec6218cd4e31c5fb)) +- _[BREAKING]_ `requireNativeComponent`'s signature has been simplified to only take extraOptions ([820673e707](https://github.com/facebook/react-native/commit/820673e7076b5906ba50e09e40fb9a32cf500c1b), [b549e364e0](https://github.com/facebook/react-native/commit/b549e364e0025e0e1b4005f04a9de2d767006da1), [28d37781c6](https://github.com/facebook/react-native/commit/28d37781c6589574de1113bd12077f6d54053ffb), [1c90a2b47b](https://github.com/facebook/react-native/commit/1c90a2b47b420a4b6aa16a55a344cc08f0eacbe3), and [1ab7d49c2d](https://github.com/facebook/react-native/commit/1ab7d49c2df5673dd214eb8a9b7fd3defb0ff857) by [@yungsters](https://github.com/yungsters)) + +#### Breaking Changes + +- Public methods of Text (`blur`, `focus`, `measure`, `measureInWindow`, `measureLayout`, `setNativeProps`) are no longer bound to the text component instance. It is therefore unsafe to pass these methods by reference (i.e: as callbacks) to functions. So, things like `setTimeout(this._txtRef.focus, 1000)` will no longer work. Please instead do: `setTimeout(() => this._txtRef.focus(), 1000)`. + +### iOS specific changes + +- _[BREAKING]_ WebViews now can only use https; do not use it for `file://` ([634e7e11e3](https://github.com/facebook/react-native/commit/634e7e11e3ad39e0b13bf20cc7722c0cfd3c3e28) by [@mmmulani](https://github.com/mmmulani)) +- iOS 9 is now the minimum required version ([f50df4f5ec](https://github.com/facebook/react-native/commit/f50df4f5eca4b4324ff18a49dcf8be3694482b51)) +- Update podspecs to target iOS 9 ([092103e752](https://github.com/facebook/react-native/commit/092103e7525e58e04346e0a1a16a67ca4f31c2e9)) +- Xcode 9.4 is now used to run tests ([c55bcd6ea7](https://github.com/facebook/react-native/commit/c55bcd6ea729cdf57fc14a5478b7c2e3f6b2a94d)) +- Prevent console logging on iOS 11.3+ within WebSocket ([8125be942b](https://github.com/facebook/react-native/commit/8125be942bd5fd8fe851bad04ae6b9bcb0af4727)) +- Expose `RCTFont` size overrides ([6611fefef7](https://github.com/facebook/react-native/commit/6611fefef7559c4cd3d1824235d263bff210d5e2)) + +### Android specific changes + +- Projects are now compiled using Android SDK 26 ([065c5b6590](https://github.com/facebook/react-native/commit/065c5b6590de18281a8c592a04240751c655c03c)) +- Use Google Maven repo in new Android projects ([6d56a234e3](https://github.com/facebook/react-native/commit/6d56a234e3cf5984335ff2713236260fac977f5f)) +- Upgrade Buck to v2018.03.26.01 ([1324e7b558](https://github.com/facebook/react-native/commit/1324e7b5580db815471172cf6dd140124bd2f11a)) +- Upgrade gradle-plugin to 2.3.3, gradle to 3.5.1, gradle-download-task to 3.4.3 ([699e5eebe8](https://github.com/facebook/react-native/commit/699e5eebe807d1ced660d2d2f39b5679d26925da)) +- Bump NDK APP_PLATFORM to android-16 ([b5dc45420a](https://github.com/facebook/react-native/commit/b5dc45420a0d3aa54d2d2075d7f14ff1835df78a)) +- Bump glog to 0.3.5 (added libc++ support) ([b5fca80605](https://github.com/facebook/react-native/commit/b5fca806059e628edb504cb1bacf62e89ee6f102)) +- `ReactFragmentActivity` deprecated as it's not necessary when targeting API level 14 and above ([77a02c0d83](https://github.com/facebook/react-native/commit/77a02c0d83dbfcd9a5397cf63e1ab2e6c94cfdde)) +- Touchables now play a sound on press ([722f88ca90](https://github.com/facebook/react-native/commit/722f88ca9058c5d902c416b826a7a7ab347326b8)) +- Default `underlineColorAndroid` to transparent ([a3a98eb1c7](https://github.com/facebook/react-native/commit/a3a98eb1c7fa0054a236d45421393874ce8ce558)) +- Disable `WebView` geolocation by default ([23d61b35fb](https://github.com/facebook/react-native/commit/23d61b35fb6fdbfb84f77b6d99ff155a0ff868e6)) +- Ensure cookies with illegal characters are not sent to okhttp ([04028bf216](https://github.com/facebook/react-native/commit/04028bf2169b01f79bd86ecd6b0d8aa5f99599f1)) +- Update app icons to match recent Android releases ([94393f8652](https://github.com/facebook/react-native/commit/94393f8652c414806fc861c214ad36e9ac1b6114)) +- Better error messages for `ReadableNativeMap` ([30d06b4286](https://github.com/facebook/react-native/commit/30d06b42862fc5e8704e109db652d62f86f8eabc)) +- Update Fresco to v1.9.0, okhttp3 to v3.10.0 ([6b07602915](https://github.com/facebook/react-native/commit/6b07602915157f54c39adbf0f9746ac056ad2d13)) +- Add tint color to inline icons ([e8e2a6e410](https://github.com/facebook/react-native/commit/e8e2a6e4102c1ba0ee3d068769e47fa61c160524)) +- Fix antialiasing rounded background ([e4f88c66e3](https://github.com/facebook/react-native/commit/e4f88c66e300505d3c86329dacd84d84e8109837)) +- `react-native link` will now replace '/' by '\_' when linking projects. If you previously linked scoped packages, they will get linked again. ([dbd47592a1](https://github.com/facebook/react-native/commit/dbd47592a18ed09ee6e94c79bed16d63be625af6)) +- New project template now uses project-wide properties ([0a3055d98a](https://github.com/facebook/react-native/commit/0a3055d98a36e49746144e883edc7e20afec4fcb)) + +--- + +### Fixed: bugs that have been resolved + +- `VirtualizedList` now accounts for `ListHeaderComponent` length when calculating offset ([604bcfa4a8](https://github.com/facebook/react-native/commit/604bcfa4a83396c402ba8beaa13f40d05d6e9f5c)) +- Prevent showing a hidden status bar when opening modals ([076b1cea35](https://github.com/facebook/react-native/commit/076b1cea3563cae30e11d63cc100ceaed9082692)) +- Fix crash when reloading while Perf Monitor is enabled ([4fcd9970bd](https://github.com/facebook/react-native/commit/4fcd9970bd2dfb24890bc87e9c82e16dab71ec09)) +- Fixed concurrency issue in remote debugger ([578b0b2a51](https://github.com/facebook/react-native/commit/578b0b2a51fc0c2aba5d27cdd5335396d5351463)) +- Fix `Modal` + `FlatList` scrolling ([45b0907f61](https://github.com/facebook/react-native/commit/45b0907f619f455825f459838615a5a7cc59a204)) +- Fix bug in `RCTNetworking` where not all tasks/handlers were being cleared during invalidation ([b805172034](https://github.com/facebook/react-native/commit/b8051720344f3716e964eaf7cfdd2a91dc703602)) +- Fix keyboard handling with `keyboardShouldPersistTaps: never` ([ffe6c110f7](https://github.com/facebook/react-native/commit/ffe6c110f7ce33460fe0399ccbda16a6adbe90ca)) +- Fix Responder Logic in `Text` ([e2ce22b823](https://github.com/facebook/react-native/commit/e2ce22b823661a7dcf6b70a825921a2910383bd1)) +- Fix `VirtualizedSectionList` lint warnings ([26a1eba1ce](https://github.com/facebook/react-native/commit/26a1eba1cef853b0dab7aad5731699c06d36b781)) +- Fix `VirtualizedSectionList:ItemWithSeparators` ([488a4c7e1c](https://github.com/facebook/react-native/commit/488a4c7e1c86ac5900ff9194106511fbf5a8e3cb)) +- Fix `TextInput`'s initial layout measurements ([c6b4f9f2ce](https://github.com/facebook/react-native/commit/c6b4f9f2ce59bc757d9e211f46294faa03df55c6)) +- Fix `requireNativeComponent` check ([1c90a2b47b](https://github.com/facebook/react-native/commit/1c90a2b47b420a4b6aa16a55a344cc08f0eacbe3)) +- Fix `TextInput` autocapitalization bug ([ff70ecf868](https://github.com/facebook/react-native/commit/ff70ecf868cf12fc66b45dc1496391d0a1e9011f)) +- Add missing events to `ViewPropTypes` ([41a940392c](https://github.com/facebook/react-native/commit/41a940392cea497bc5eb627b24083d0211d1eb89)) +- Add missing Jest mock in `StatusBarManager` ([4a2c560768](https://github.com/facebook/react-native/commit/4a2c560768abb2d8407900fdb2fbe4971ae00a1c)) +- Add Flow declaration for Metro module ([1853e15190](https://github.com/facebook/react-native/commit/1853e1519030caaeeb7f31017d98823aa5696daf)) +- Fix type for `ReactNative.NativeComponent` (1/2) ([de11ba2a5e](https://github.com/facebook/react-native/commit/de11ba2a5ee90929dbc67d914de59bdd2ebc29ca)) +- Fix type for `ReactNative.NativeComponent` (2/2) ([752863629d](https://github.com/facebook/react-native/commit/752863629d63bca6d96a101bfeccc4e7ad3e953e)) +- Move Image PropTypes to new file ([67656991b3](https://github.com/facebook/react-native/commit/67656991b32075e8b4a99c6409b0a131206c6941)) +- Tests: Fix JUnit report location when running Jest ([85fc98d437](https://github.com/facebook/react-native/commit/85fc98d437c08cdec883a73161e120478737ba72)) +- Tests: Fix ReactImagePropertyTest SoLoader failures (#19607) ([a52d84d7e1](https://github.com/facebook/react-native/commit/a52d84d7e1cdb287f2877c4d85f2e9866c248d43)) +- Tests: Fix jest snapshot testing on Windows ([216bce3163](https://github.com/facebook/react-native/commit/216bce31632480ce70cc03b1b2a57ec12440afd7)) +- Fixes "Cannot resolve module" errors in new `react-native init` projects ([843a433e87](https://github.com/facebook/react-native/commit/843a433e87b0ccaa64ab70d07e22bffbabad8045)) +- Haste hotfix for `react-native-windows` ([54942746d4](https://github.com/facebook/react-native/commit/54942746d4037e1153e14fcfc95e4edc772d296a)) + +#### iOS specific fixes + +- Fix undefined_arch error in Xcode 10 beta - e131fff +- Make `react-native run-ios` command play nicely with multiple Xcode versions ([a130239257](https://github.com/facebook/react-native/commit/a1302392577789faab79dad0cb39b147464e0e42)) +- Correct fishhook import ([75a0273de2](https://github.com/facebook/react-native/commit/75a0273de21948b0b959263100f09111f738ec35)) +- Fix bug where a Backspace event was emitted when entering characters after clearing a text in `TextInput` by an empty string ([1ffb2b63be](https://github.com/facebook/react-native/commit/1ffb2b63be4c4af331fece0b4286e5c92b1e575d)) +- Expose `InputAccessoryView` so it can be imported ([80fc415cf1](https://github.com/facebook/react-native/commit/80fc415cf179ffe26d020bc8d6e4451352da94fd)) +- Fix `InputAccessoryView` safe area conformance ([490f22ae72](https://github.com/facebook/react-native/commit/490f22ae72ba43fa9364ce0f6c238744c07ac830)) +- Fix use of C++ syntax in header file ([bfcfe7961d](https://github.com/facebook/react-native/commit/bfcfe7961db0970e2575eafe2f3c9c668bd8940d)) +- Fix install step when running `run-ios` ([0934c1778f](https://github.com/facebook/react-native/commit/0934c1778f0e3c0b691e1a3ca2df1d486eb905dd)) +- Fix `run-ios` not turning on Simulator ([9736ddc061](https://github.com/facebook/react-native/commit/9736ddc061e9c4291df8a3185c7f9d6f73e435c7)) +- Use correct library reference for Fishhook. This fixes the build for the new Xcode build system, on both Xcode 9 and Xcode 10 ([a8b74576da](https://github.com/facebook/react-native/commit/a8b74576da6f1a42fde4e39f97e88c8f45a3a51d)) +- Add missing `onChange` event definition to `DatePickerIOS` ([3b53091869](https://github.com/facebook/react-native/commit/3b53091869b673ea33a4af34242e2227ca944768)) +- Fix crash during Archive phase on Xcode 9.3 ([344c205070](https://github.com/facebook/react-native/commit/344c205070d5ad670c97984dd86ec9ac13c73f81)) +- `RNTesterPods`: Add missing folly include ([128c9343c4](https://github.com/facebook/react-native/commit/128c9343c464f3e7898d6e245f135f8bdf6caa6a)) +- `RNTesterPods`: folly::Optional's `has_value()` to `hasValue()` until folly is upgraded ([128c9343c4](https://github.com/facebook/react-native/commit/128c9343c464f3e7898d6e245f135f8bdf6caa6a)) +- `RNTesterPods`: Fix import for `RCTTestAttributes.h` ([128c9343c4](https://github.com/facebook/react-native/commit/128c9343c464f3e7898d6e245f135f8bdf6caa6a)) +- `RNTesterPods`: Fix `conversions.h` to use namespaced includes ([128c9343c4](https://github.com/facebook/react-native/commit/128c9343c464f3e7898d6e245f135f8bdf6caa6a)) +- Fix or mark enum conversions surfaced by `-Wenum-conversion` ([b8f30db0ae](https://github.com/facebook/react-native/commit/b8f30db0ae21d5f96547702abbf50aefa93b1094)) +- Fix CocoaPods integration without DevSupport subspec ([c09d509c2b](https://github.com/facebook/react-native/commit/c09d509c2b8a5a02701829e1f0ace8081ce64277)) +- Update Yoga to handle being in a Xcode framework project ([cf036dbc7a](https://github.com/facebook/react-native/commit/cf036dbc7af16a8453c115372694dc51e8086fcf)) +- Fix Blob memory leak ([122b3791ed](https://github.com/facebook/react-native/commit/122b3791ede095345f44666691aa9ce5aa7f725a)) +- Avoid double reload event when reloading JS ([7b9b1559a7](https://github.com/facebook/react-native/commit/7b9b1559a7f6719c3c9ad8e894fcdd99ed109afe)) +- Suppress spurious warning about RCTCxxModule ([569061dd83](https://github.com/facebook/react-native/commit/569061dd8384a86cd27719b8b068360d8379f4c3)) + +#### Android specific fixes + +- Fix extreme `TextInput` slowness on Android ([5017b86b52](https://github.com/facebook/react-native/commit/5017b86b525e3ef6023f0f8a88e6fd1cf98024e0)) +- Correct draw path dimensions while doing even border, fixes blurred borders ([c5ca26a0e5](https://github.com/facebook/react-native/commit/c5ca26a0e5c0660196300ee34d6007c63879611f)) +- Don't pass additional arguments to `requireNativeComponent` in `.android.js` files ([a51e8b19cc](https://github.com/facebook/react-native/commit/a51e8b19cc4dc36dee42ac95278b883c06b2e40f)) +- Prevent `RefreshControl` from getting stuck when a parent is scrolled horizontally ([33ffa79a51](https://github.com/facebook/react-native/commit/33ffa79a51d4db9ba69148861f2da304646175cd)) +- Prevent crash due to unsupported ellipsize mode ([85e33aaf90](https://github.com/facebook/react-native/commit/85e33aaf908996e99220bff4a2bdbbdf7c0d12b0)) +- Fix okhttp3 response handling in `DevServerHelper` ([56d48bd9ec](https://github.com/facebook/react-native/commit/56d48bd9ecd2d0f08625259121312531064a09f2)) +- Fix `ReactInstanceManager` unmountApplication to support `ReactRootView` recycling ([4a9b2a7302](https://github.com/facebook/react-native/commit/4a9b2a73021fb547febe1fa193c3effb7ff8da4e)) +- Fix `NullPointerException` when emitting event using `UIManagerModule` ([291c01f4ff](https://github.com/facebook/react-native/commit/291c01f4ffe614760852e36b05d78b42cb4271df)) +- Fix link to Android build guide ([57e7556b8d](https://github.com/facebook/react-native/commit/57e7556b8db61e5fcc3ccea56c1b163b82a091a6)) +- Fix Android open source test failures ([3e0ebc7663](https://github.com/facebook/react-native/commit/3e0ebc76632238f21c60caa92c7a2b5ee8102b71)) +- Fix view indices with LayoutAnimation ([05b75b9ebf](https://github.com/facebook/react-native/commit/05b75b9ebfa3ce6d67b2a3aee446ff0cd515311b)) +- Fix originalNode memory leak ([8102e35271](https://github.com/facebook/react-native/commit/8102e35271ab68e0525a9c60d86a855bbeef9c1a)) +- Fix `ScrollView` with a `TextInput` ([2f1421dec7](https://github.com/facebook/react-native/commit/2f1421dec7cd3a35779caceac108e872033c7d72)) +- Disable onKeyPRess logic when handler not defined ([41975f75d9](https://github.com/facebook/react-native/commit/41975f75d96ef4b606b4618461bf24d5db063b77)) +- fix permission requests on pre-M android ([4e1abdd74d](https://github.com/facebook/react-native/commit/4e1abdd74dc4127a86d62e7750d01d39bb781c08)) + +--- + +### Removed: features that have been removed; these are breaking + +- Deprecate `focusTextInput` and `blurTextInput` ([ce3b7b8204](https://github.com/facebook/react-native/commit/ce3b7b8204dad0fd62a76a0ce66472eca4b25bc8)) +- _[BREAKING]_ `ImageResizeMode` on `Image` is no longer exposed; check your usage of `resizeMode`; the same resize modes exist, but pass them as strings instead ([870775ee73](https://github.com/facebook/react-native/commit/870775ee738e9405c6545500f9a637df9b513a02) by [@TheSavior](https://github.com/TheSavior)) + +#### Android specific removals + +- Remove native extensions ([7c5845a5a2](https://github.com/facebook/react-native/commit/7c5845a5a26592598c9380df078766a680a23f06)) +- Remove Fresco ProGuard rules ([07df36557c](https://github.com/facebook/react-native/commit/07df36557c8cbbaee5e870460162aa725a606ff4)) + +#### iOS specific removals + +- Disallow nesting of `` within `` (e.g. ``) ([6a1b41643a](https://github.com/facebook/react-native/commit/6a1b41643a5f5035c61a96263220d11d3462e8f2) +- Removed deprecated `UIActionSheetDelegate` methods ([5863b564f8](https://github.com/facebook/react-native/commit/5863b564f84b9fe97b256f8cde0f7f2e1db9b641)) + +--- + +### Known issues + +During the RC testing of this version, a few issues that have been opened don't have yet a finalized solution ( [19827](https://github.com/facebook/react-native/issues/19827), [19763](https://github.com/facebook/react-native/issues/19763), [19859](https://github.com/facebook/react-native/issues/19859), [19955](https://github.com/facebook/react-native/issues/19955) ). We are aware of them and we hope that by releasing 0.56.0 the surface of developers interacting to find solutions to them will allow for faster resolution and an even better 0.56.1 release. So please check the already opened issues before submitting new ones. + +If you are using Windows to develop React Native apps, we suggest you keep an eye on [this issue in particular](https://github.com/facebook/react-native/issues/19953) since there have been many reports of issues related to Win 10 and RN 0.56. + +## v0.55.0 + +Welcome to the March 2018 release of React Native ! Over 81 contributors made 247 commits since February. Thanks for another exciting release. + +Here are a few highlights: + +- React Native is now using the MIT license +- Android TV device support + +[![RNAndroidTVDemo](http://img.youtube.com/vi/EzIQErHhY20/0.jpg)](http://www.youtube.com/watch?v=EzIQErHhY20) + +- Animated tracking with native driver - check out the [silky smooth framerate](https://t.co/dE1KST1i3g) +- Lots of Flow improvements +- Bugfixes + +### Added: new features + +- Added support for animated tracking to native driver. Now you can use `useNativeDriver` flag with animations that track other `Animated.Values` ([b48f7e5605](https://github.com/facebook/react-native/commit/b48f7e560545d53db7c906ced51a91c4cce6ee94) by [@kmagiera](https://github.com/kmagiera)) +- There's a new UTFSequence module in the library for common Unicode sequences (Emoji!) ([54870e0c6c](https://github.com/facebook/react-native/commit/54870e0c6ca8611fed775e5ba12a0d6d9b1cdbd7) and [4761d5a83e](https://github.com/facebook/react-native/commit/4761d5a83e707e0ed651f02a9e02fc5d66b1869a) by [@sahrens](https://github.com/sahrens)) +- Added `contextMenuHidden` property for **TextInput** ([2dd2529b3a](https://github.com/facebook/react-native/commit/2dd2529b3ab3ace39136a6e24c09f80ae421a17e) by [@amhinson](https://github.com/amhinson)) +- Add `testOnly_pressed` to **TouchableHighlight** for snapshot tests ([3756d41de1](https://github.com/facebook/react-native/commit/3756d41de1feb167482f01b26f9a5f2563ef8bff) by [@sahrens](https://github.com/sahrens)) + +#### Android specific additions + +- Added support for Android TV devices ([b7bb2e5745](https://github.com/facebook/react-native/commit/b7bb2e5745f2bdbfeeccef8d97d469730942e01c) by [@krzysztofciombor](https://github.com/krzysztofciombor)) +- Implemented style `letterSpacing` for **Text** and **TextInput** ([5898817fc1](https://github.com/facebook/react-native/commit/5898817fc1a66bd317d65ce96520159df2f96045) by [@motiz88](https://github.com/motiz88)) +- Bundle download progress is now shown [d06e143420](https://github.com/facebook/react-native/commit/d06e143420462344ea6fc21c0446db972f747404) by [@janicduplessis](https://github.com/janicduplessis)) +- **AndroidInfoModule** now also returns Android ID ([216c8ec04b](https://github.com/facebook/react-native/commit/216c8ec04b22704f722ecaac4718157af4434a0c) by [@L33tcodex0r](https://github.com/L33tcodex0r)) + +#### iOS specific additions + +- Introducing **InputAccessoryView**, "a component which enables customization of the keyboard input accessory view" ([38197c8230](https://github.com/facebook/react-native/commit/38197c8230657d567170cdaf8ff4bbb4aee732b8), [84ef7bc372](https://github.com/facebook/react-native/commit/84ef7bc372ad870127b3e1fb8c13399fe09ecd4d), and [6d9fe455dc](https://github.com/facebook/react-native/commit/6d9fe455dc815cdce86c00f81c71c9ca0c724964) by [@PeteTheHeat](https://github.com/PeteTheHeat)) +- `base-line` metric exposure for **Text** and **TextInput** ([51b3529f6c](https://github.com/facebook/react-native/commit/51b3529f6c2ca354800c0cf6ecb8eb3115eaa36e), [0dbe18375e](https://github.com/facebook/react-native/commit/0dbe18375ebb712be8bebd3b6592170f90f8b7bc), and [7630a614e4](https://github.com/facebook/react-native/commit/7630a614e4bd56c1a3ac728e1dfafd114340f2b7) by [@shergin](https://github.com/shergin)) +- **DatePickerIOS** now has `initialDate` prop ([446ce49e9b](https://github.com/facebook/react-native/commit/446ce49e9b097d2a5e95b0f17aa23756733c27ec)) +- Expose version via `RCTVersion.h`'s `RCTGetReactNativeVersion()` ([30469ed001](https://github.com/facebook/react-native/commit/30469ed00170a74743d2ba5aadce61aae742715c) by [@LeoNatan](https://github.com/LeoNatan)) +- Allow running multiple simulators simultaneously with `react-native run-ios --simulator ...` ([2ad34075f1](https://github.com/facebook/react-native/commit/2ad34075f1d048bebb08ef30799ac0d081073150) by [@koenpunt](https://github.com/koenpunt)) +- Introduced **RCTSurfaceHostingProxyRootView** for migration to **RCTSurfaceHostingView** ([34b8876ac6](https://github.com/facebook/react-native/commit/34b8876ac6510398e03a03c94f4ffb9aaa7519d3) by [@fkgozali](https://github.com/fkgozali)) +- New UIManager API allowing intercept/delay mounting process ([402ae2f01f](https://github.com/facebook/react-native/commit/402ae2f01fd91051be5b717b0578e18b863854af) and [b90c1cf6c3](https://github.com/facebook/react-native/commit/b90c1cf6c30454859579278be18ac650c66f516b) by [@shergin](https://github.com/shergin)) + +### Changes: existing functionality that is now different + +- React Native has now adopted the MIT license ([1490ab12ef](https://github.com/facebook/react-native/commit/1490ab12ef156bf3201882eeabfcac18a1210352) and [26684cf3ad](https://github.com/facebook/react-native/commit/26684cf3adf4094eb6c405d345a75bf8c7c0bf88) by [@sophiebits](https://github.com/sophiebits)) +- The HelloWorld template now exclude `*.jsbundle` files from Git ([21231084db](https://github.com/facebook/react-native/commit/21231084dbccc8abe7823d4444a7e772c08e3e72) by [@aneophyte](https://github.com/aneophyte)) +- `react-native-git-upgrade` now shows files merged with conflicts in red ([e53a8f7097](https://github.com/facebook/react-native/commit/e53a8f7097965f38d87eade1407661bc63adc68e) by [@alvinthen](https://github.com/alvinthen)) +- `ResolvedAssetSource` type to have all read-only members ([4d0ee37293](https://github.com/facebook/react-native/commit/4d0ee37293b5e21fc3c7a8c6edd72c9ff899df7d) by [@sahrens](https://github.com/sahrens)) +- Flow types improvements ([b6c7e551a9](https://github.com/facebook/react-native/commit/b6c7e551a91c406884cbbe8ee37c0038a1b7f0be), [b98bf1e097](https://github.com/facebook/react-native/commit/b98bf1e09739860d82e37225f1635bba3bc817b3), [80c18395e2](https://github.com/facebook/react-native/commit/80c18395e24760cd12b69592a10037f071255437), [70a3ececc3](https://github.com/facebook/react-native/commit/70a3ececc368a8d0fe4b57b13ac956ad99a637c7), [f7343576fc](https://github.com/facebook/react-native/commit/f7343576fc2ca941b03145d9e97208bcbc8c345b), [a817c64043](https://github.com/facebook/react-native/commit/a817c6404338b7b15aaeac5693ae3635a0a3dde0), [3fd82d3c89](https://github.com/facebook/react-native/commit/3fd82d3c89f2d7e5103b024b54250f2ded970d88), [cd8128b2ec](https://github.com/facebook/react-native/commit/cd8128b2eccf6898cdf798a1e1be1f7a5762a0d4), [5035af80ec](https://github.com/facebook/react-native/commit/5035af80ecddb44e2a8444780f25f336b760bf32), [26734a8473](https://github.com/facebook/react-native/commit/26734a8473ac2f5715f2b7a016f0cc8a15c6f073), [321ba067a8](https://github.com/facebook/react-native/commit/321ba067a8323c80262e51c94a931199d5ff5cd7), [b6b80f6a70](https://github.com/facebook/react-native/commit/b6b80f6a70c6d790c52b58453fefc2cea6cd06fe), [f1316cab6c](https://github.com/facebook/react-native/commit/f1316cab6c351852ef1da9939d4c8f0244fb8a6f), [2520c645f8](https://github.com/facebook/react-native/commit/2520c645f863c299e8dccb844bac3dc6a9d553e0), [214da52fe7](https://github.com/facebook/react-native/commit/214da52fe76c1688d0c1a402b3e6c4d0fc19d882), [dbdf43b428](https://github.com/facebook/react-native/commit/dbdf43b428da19a9eba012753904bcf33339ea9a), [49396aa78d](https://github.com/facebook/react-native/commit/49396aa78d218625c1933fa864acd70853faa9f9), [4895c645ea](https://github.com/facebook/react-native/commit/4895c645ea17ff939811f3d5ec6218cd4e31c5fb), [a3c07c95ef](https://github.com/facebook/react-native/commit/a3c07c95effd891c2bd5f3257efe5b24d85862be), [49ffc9fada](https://github.com/facebook/react-native/commit/49ffc9fada4266c3ba9751c5e8e4c475174c7e6c), and [c129457d3a](https://github.com/facebook/react-native/commit/c129457d3a6622d7c28e8b27829ffc2b0a03c5eb) by [@TheSavior](https://github.com/TheSavior), [@yungsters](https://github.com/yungsters), and [@alex288ms](https://github.com/alex288ms)) +- Better enable cross-platform support of WebSocket.js ([b9be28915c](https://github.com/facebook/react-native/commit/b9be28915cf323eb36f1d7c77821cdf994954074) by [@rozele](https://github.com/rozele)) +- Better error handling in the CLI around making directories ([d2817f48a1](https://github.com/facebook/react-native/commit/d2817f48a1146b469d544ee78015251551d358c3) by [@BridgeAR](https://github.com/BridgeAR)) +- Verify that the component passed to createAnimatedComponent is not functional ([10b642a7af](https://github.com/facebook/react-native/commit/10b642a7af097bd508dab7b5d4723ccb4339d35f) by [@janicduplessis](https://github.com/janicduplessis)) +- Don't truncate in the middle of an emoji ([9c8c597000](https://github.com/facebook/react-native/commit/9c8c5970002d048e8b18088f7c63b39431def50b) by [@Vince0613](https://github.com/Vince0613)) +- Loosen Platform check to allow better code sharing for out-of-tree platforms ([84affbd6a3](https://github.com/facebook/react-native/commit/84affbd6a371dd865a3550b1fde1ebabee921341)) +- In CLI, fix issue with `isInstalled` check for Android and references to unregister ([ec884890b1](https://github.com/facebook/react-native/commit/ec884890b1f40da42e84202e082b4cef2506bbfc) by [@rozele](https://github.com/rozele)) + +#### iOS specific changes + +- tvOS `onPress` magnification animation now works via the `tvParallaxProperties` prop object taking `pressMagnification`, `pressDuration`, and `pressDelay` ([6c353fd7e9](https://github.com/facebook/react-native/commit/6c353fd7e9fd324717951ad62754d817537d7339) by [@JulienKode](https://github.com/JulienKode)) + +### Fixed: bugs that have been resolved + +- In **TouchableOpacity**, trigger animation on `opacity` upon change in `disabled` prop ([9366ce416f](https://github.com/facebook/react-native/commit/9366ce416fbf015e4795987d39a65199b1b335c2) by [@maxkomarychev](https://github.com/maxkomarychev)) +- Fixed an issue encountered when using `react-native-vector-icons` ([a759a44358](https://github.com/facebook/react-native/commit/a759a44358711180b37cf4ad25f28af47e3de298) and [54dc11a5fb](https://github.com/facebook/react-native/commit/54dc11a5fbafaccc9c0a781f1151225909717597) by [@jeanlauliac](https://github.com/jeanlauliac) and [@t4deu](https://github.com/t4deu))) +- Add missing mock for Jest for `removeEventListener` method ([59c7b2cfac](https://github.com/facebook/react-native/commit/59c7b2cfac534a79ff2461af5fd2034b280812a3) by [@MoOx](https://github.com/MoOx)) +- Fix main size calculation from the aspect ratio ([f751c3460e](https://github.com/facebook/react-native/commit/f751c3460e5dc48c1f1a2d72a56173285899de21)) +- Fix crash in Subscribable due to uglify-es ([b57a78c3de](https://github.com/facebook/react-native/commit/b57a78c3def50eda11e57542be0e5233a62d173b) by [@iMagdy](https://github.com/iMagdy)) +- Update `node-notifier` dependency to fix memory leak ([860fcd458a](https://github.com/facebook/react-native/commit/860fcd458a1873ebcf977be01670be5912ae7104) by [@rickhanlonii](https://github.com/rickhanlonii)) +- Fix issues with pollParams and link ([ca8ce83cc3](https://github.com/facebook/react-native/commit/ca8ce83cc3c38751604afce5a3e2f0473d9cba91) by [@grabbou](https://github.com/grabbou)) + +#### iOS specific fixes + +- DevLoadingView now supports the iPhone X screen shape ([47b36d3ff0](https://github.com/facebook/react-native/commit/47b36d3ff0dbb99fd3fc98f6e981a38084dd4d2c) by [@mrtnrst](https://github.com/mrtnrst)) +- Added bounds check to prevent ScrollView from scrolling to an offset which is out of bounds of the ScrollView ([16c9e5b715](https://github.com/facebook/react-native/commit/16c9e5b71500135a631480035af6cd2de3dafdc9) by [@siddhantsoni](https://github.com/siddhantsoni)) +- **NetInfo** `isConnected` works again ([dbafc29e60](https://github.com/facebook/react-native/commit/dbafc29e60aba1d5b24c2b0d321834c40e0b9bca) by [@alburdette619](https://github.com/alburdette619)) +- In **AlertIOS**, fix duplicate var name declaration ([6893a26bfb](https://github.com/facebook/react-native/commit/6893a26bfb06a2d8ad9d23a572f4d9143305d905)) +- Permit `react-native run-ios --device [id]` by passing port when running on device ([f8fee0a631](https://github.com/facebook/react-native/commit/f8fee0a631d77313d7cb5e65a3dd04a5a8ba3d03) by [@jozan](https://github.com/jozan)) +- Fixed issue with `run-ios` where `Entry, ":CFBundleIdentifier", Does Not Exist` was being received ([5447ca6707](https://github.com/facebook/react-native/commit/5447ca67076a110e2b0df03b014f53d1df4646ab) by [@blackneck](https://github.com/blackneck)) +- Fixed problem in Text measurement on iOS ([a534672e13](https://github.com/facebook/react-native/commit/a534672e132136e7bbd17c94a7f4e67149bcc67a) by [@shergin](https://github.com/shergin)) +- Fix crash when reloading in tvOS ([3a3d884df2](https://github.com/facebook/react-native/commit/3a3d884df253dbc1c02ffef33e99c4a91ea8751b) by [@dlowder-salesforce](https://github.com/dlowder-salesforce)) +- Fixed a bug with positioning of nested views inside **Text** ([7d20de412b](https://github.com/facebook/react-native/commit/7d20de412b37a35951e615d98509573dc1a24bcb) by [@shergin](https://github.com/shergin)) +- Fix blob response parsing for empty body ([f5207ba9c7](https://github.com/facebook/react-native/commit/f5207ba9c764f33ef83fa897f6014d67193be0e2) by [@janicduplessis](https://github.com/janicduplessis)) +- Fix tvOS react-native init release build ([3002c4eb98](https://github.com/facebook/react-native/commit/3002c4eb981d439f0ea304556d8dbd4ffd62a80b) by [@dlowder-salesforce](https://github.com/dlowder-salesforce) +- Fix RedBox from bridge reload due is not re-registering its root view ([2e51fa5f5d](https://github.com/facebook/react-native/commit/2e51fa5f5d4f229329ae457ab1a77ba5bcea0448) by [@fkgozali](https://github.com/fkgozali)) + +#### Android specific fixes + +- Fix: incorrect line-height calculation ([74e54cbcc4](https://github.com/facebook/react-native/commit/74e54cbcc408a8bbdd70f47cc8728d30cdc0d299) by [@strindhaug](https://github.com/strindhaug)) +- Fix crashes with TextInput introduced in 0.53 ([b60a727adb](https://github.com/facebook/react-native/commit/b60a727adbcfa785e3d1b13bf069b766216e60f8) by [@joshyhargreaves](https://github.com/joshyhargreaves)) +- Update ReactAndroid build script to support gradle 2.3.0 ([d8bb990abc](https://github.com/facebook/react-native/commit/d8bb990abc226e778e2f32c2de3c6661c0aa64e5)) +- Allow "unexpected URL" exception to be caught on Android when using fetch ([da84eba318](https://github.com/facebook/react-native/commit/da84eba318ae69fea28f40418178bdeb35c4a99b) by [@jcurtis](https://github.com/jcurtis)) +- Fix `onLayout` prop for **TextInput** ([8a073c1d8b](https://github.com/facebook/react-native/commit/8a073c1d8b89305a9a2561a7c33740919730f408) by [@rozele](https://github.com/rozele)) +- Fix ViewPager when using native navigation ([a1295e1707](https://github.com/facebook/react-native/commit/a1295e1707a856b9cd5c3129320d386aa9166310) by [@ruiaraujo](https://github.com/ruiaraujo)) +- Fix localization crash in **DevSettingsActivity** ([427e464bb9](https://github.com/facebook/react-native/commit/427e464bb95e4e0ecc7455e71b5d477014618200) by [@ayc1](https://github.com/ayc1)) +- Fix pinch crash in touch-responsive views ([67c3ad4e6a](https://github.com/facebook/react-native/commit/67c3ad4e6a1847cbac43115b01f72cc5c8932a61) by [@tobycox](https://github.com/tobycox)) +- Fix IllegalStateException thrown in looped timing native animation ([ef9d1fba23](https://github.com/facebook/react-native/commit/ef9d1fba237c08a158c8f32e823f229921e7c052) by [@kmagiera](https://github.com/kmagiera)) +- Workaround android-only js module resolution issue ([c20e0f94fe](https://github.com/facebook/react-native/commit/c20e0f94feb42a71633212114b42c62494fd4ff0) by [@fkgozali](https://github.com/fkgozali)) +- Fix ReadableNativeMap.toHashMap() for nested maps and arrays ([15fa2250fd](https://github.com/facebook/react-native/commit/15fa2250fdd0865ce1d0c6ac13b817e7b2c7757a) by [@esamelson](https://github.com/esamelson)) +- Fix Android Sanity Buck version check ([e0573225d5](https://github.com/facebook/react-native/commit/e0573225d5fe28e5ad61690eda3060289bdbf3a4) by [@hramos](https://github.com/hramos)) +- Fixes the connection to Firestore by following whatwg.org's XMLHttpRequest send() method ([d52569c4a1](https://github.com/facebook/react-native/commit/d52569c4a1b6bd19792e4bda23e3a8c3ac4ad8df) by [@samsafay](https://github.com/samsafay)) +- `invertStickyHeaders` can now be set from **SectionList** or **FlatList** ([dd479a9377](https://github.com/facebook/react-native/commit/dd479a93772c3a52561fc32ee84b25ce822a30fa) by [@dannycochran](https://github.com/dannycochran)) + +### Removed: features that have been removed; these are breaking + +- Removed various types ([b58e377961](https://github.com/facebook/react-native/commit/b58e377961ddd278bfa36df0e15953f976875de6), [ee26d9bcb0](https://github.com/facebook/react-native/commit/ee26d9bcb0719246efa51af404aa7805404675cc), [d89517d60a](https://github.com/facebook/react-native/commit/d89517d60a8a6cabc9013b603fa3f63a1face6a2), [852084ad45](https://github.com/facebook/react-native/commit/852084ad454565bb856e85f09e098f1a4a0771a6) by [@TheSavior](https://github.com/TheSavior)) +- Deleted `Systrace.swizzleJSON()` ([3e141cb6c9](https://github.com/facebook/react-native/commit/3e141cb6c957143e998bf2926b8fe1aabccbce2d) by [@yungsters](https://github.com/yungsters)) + +#### Android specific removals + +- `ReactInstanceManager#registerAdditionalPackages` has been removed; Create UIManager interface and extract common classes in uimanager/common ([6b45fb2cb1](https://github.com/facebook/react-native/commit/6b45fb2cb1ca44fa7375bc7696bf90a68a85df3c) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific removals + +- Remove callFunctionSync experimental APIs ([19a4a7d3cb](https://github.com/facebook/react-native/commit/19a4a7d3cb6d00780ccbbbd7b0062896f64ab24d) by [@danzimm](https://github.com/danzimm)) + +## v0.54.0 + +Welcome to the February 2018 release of React Native! This release includes work done by the React Native team and the community in January, and there are some big changes here after the holidays. Thanks for 270 commits from 87 contributors, you all are great! Here are a few highlights from the release: + +- Long awaited **Blob** changes: upload, download, fetch locally, and more +- Sticky headers now work on inverted Lists +- Update to the newest React, which deprecated some lifecycle methods and added new ones – expect Yellowbox until React Native is updated +- `Space-evenly` is now there (sorry for the confusion with 0.52's release notes) +- A lot of under-the-covers work on Yoga, iOS's **Text** and **TextInput**, and a ton of other areas +- Multiple crash fixes + +The changelog is arranged by the customary added, removed, changed, and fixed plus internal; the changes are also organized by platform. + +### Added + +- ✨ **Blob**s now can be: made from Strings, loaded by File using a FileReader API, uploaded and downloaded via `XMLHttpRequest#fetch`, and fetched on files to a local blob consistently ([be56a3efee](https://github.com/facebook/react-native/commit/be56a3efeefefa6dca816ca5149a3dabfa5164e2) and [854c2330eb](https://github.com/facebook/react-native/commit/854c2330ebe748eb0508bb788685232b6cff0022) by [@satya164](https://github.com/satya164) and [@fkgozali](https://github.com/fkgozali)) +- Dynamic node_module dependencies are now supported ([b5e19adc02](https://github.com/facebook/react-native/commit/b5e19adc02a3293cd3fdbe54cc45adc78f94d325) by [@jeanlauliac](https://github.com/jeanlauliac)) +- Support sticky headers for inverted Lists with `invertStickyHeaders` ([ecaca80d42](https://github.com/facebook/react-native/commit/ecaca80d42b686e4cf91aa4bb0c8fce69eba18bb) by [@janicduplessis](https://github.com/janicduplessis)) +- `space-evenly` is now supported (sorry for the confusion with 0.52 notes) ([b1cdb7d553](https://github.com/facebook/react-native/commit/b1cdb7d553146160f99319f9dbe4083b18db60e4) by [@gedeagas](https://github.com/gedeagas)) +- Platform plugins can participate in RNConfig, `link`, and `unlink` – keep an eye on [react-native-window's use of it](https://github.com/Microsoft/react-native-windows/pull/1601)! ([a40bfa730e](https://github.com/facebook/react-native/commit/a40bfa730e05c68da49e6f217ae0f161dcc7ba98) by [@rozele](https://github.com/rozele)) +- Add `minify` flag to react-native bundle command ([3f969cb1db](https://github.com/facebook/react-native/commit/3f969cb1db3a39dd8a4fd622abbb7e4270a84216) by [@tomduncalf](https://github.com/tomduncalf)) + +#### VR Specific Additions + +- Added **ScrollView** support ([6fa039dab0](https://github.com/facebook/react-native/commit/6fa039dab0b9f738a3cb464aeca378c6210a5747) by [@MartinSherburn](https://github.com/MartinSherburn)) + +#### Android Specific Additions + +- Bundle download progress is now shown like iOS ([d06e143420](https://github.com/facebook/react-native/commit/d06e143420462344ea6fc21c0446db972f747404) by [@janicduplessis](https://github.com/janicduplessis)) +- Add back ability to customise OkHttp client ([22efd95be1](https://github.com/facebook/react-native/commit/22efd95be1f0b236eeaaa8a8e6d01e89771c9543) by [@cdlewis](https://github.com/cdlewis)) + +#### iOS specific additions + +- **ScrollView** now supports smooth bi-directional content loading and takes new prop `maintainVisibleContentPosition` ([cae7179c94](https://github.com/facebook/react-native/commit/cae7179c9459f12b1cb5e1a1d998a9dc45f927dc) and [65184ec6b0](https://github.com/facebook/react-native/commit/65184ec6b0ef2d136c0db239d65e0624efac8a2d) by [@sahrens](https://github.com/sahrens)) +- Allow substituting a default font handler ([a9c684a0ff](https://github.com/facebook/react-native/commit/a9c684a0ff45852087310d5218062acfdab673f7) by [@mmmulani](https://github.com/mmmulani)) +- Add `accessibilityElementsHidden` prop ([31288161e1](https://github.com/facebook/react-native/commit/31288161e188723456fdb336c494f3c8a3f5b0a8) by [@aputinski](https://github.com/aputinski)) +- Add EXTRA_PACKAGER_ARGS extensibility point on `scripts/react-native-xcode.sh` (PR rev [0d4ff1b7ea](https://github.com/facebook/react-native/commit/0d4ff1b7ea768cceca0405c665e322c0d6b5ba20) by [@brunolemos](https://github.com/brunolemos) with landing assists [b8c86b8dec](https://github.com/facebook/react-native/commit/b8c86b8deced01027b609959576ffcf5d2d0f520) and [0d4ff1b7ea](https://github.com/facebook/react-native/commit/0d4ff1b7ea768cceca0405c665e322c0d6b5ba20)) + +### Removed + +- Remove internal `utf8` utility - use the **utf8** package now instead ([431670f908](https://github.com/facebook/react-native/commit/431670f90860936c24260d36fc73e0c5fbf4e02a) by [@mathiasbynens](https://github.com/mathiasbynens)) + +#### iOS specific removals + +- Removed outdated assertion in RCTShadowView related to breaking change in Yoga ([e3ff3cf6cb](https://github.com/facebook/react-native/commit/e3ff3cf6cbc137e315eff6ac8aed43954b3668eb) by [@shergin](https://github.com/shergin)) + +#### Android specific removals + +- Fix an issue when swapping to and from the `visible-password` or `phone-pad` keyboard types. ([164f6b6afd](https://github.com/facebook/react-native/commit/164f6b6afd7e0050d63134fcdc65ec6969ab03a0) by [@BrandonWilliamsCS](https://github.com/BrandonWilliamsCS)) +- Remove redundant config in AndroidManifest.xml ([d7a9ca2893](https://github.com/facebook/react-native/commit/d7a9ca2893fb240c25d1cd1e0778f6b93b1e3ded) by [@gengjiawen](https://github.com/gengjiawen)) + +#### iOS specific removals + +- Delete RCTBatchedBridge ([816d417189](https://github.com/facebook/react-native/commit/816d41718998868f276d83b0c21e17d11ad392a2) by [@mhorowitz](https://github.com/mhorowitz)) + +### Changed + +- Docs clarifications ([7abffc3f8c](https://github.com/facebook/react-native/commit/7abffc3f8ce69fab5bbb4147f9b8bcb85a7d2c38) by [@IgorGanapolsky](https://github.com/IgorGanapolsky)) + +#### iOS Specific Changes + +- ⚡️ **Text** and **TextInput** have been re-implemented from the ground up for performance, flexibility, and reduced technical debt ([2716f53220](https://github.com/facebook/react-native/commit/2716f53220f947c690d5f627286aad51313256a0), [74963eb945](https://github.com/facebook/react-native/commit/74963eb945438a6fd269b5764a6cb251c86deda8), [d7fa81f181](https://github.com/facebook/react-native/commit/d7fa81f18110f0dc0f310a5c066d9a30020ca830), [74963eb945](https://github.com/facebook/react-native/commit/74963eb945438a6fd269b5764a6cb251c86deda8), [6c4ef287ad](https://github.com/facebook/react-native/commit/6c4ef287ad95eb14475a9f512487e5d05949309a), [ebc98840e9](https://github.com/facebook/react-native/commit/ebc98840e93c336e8c9e4a93c78e6ca03591f0ec), [d7fa81f181](https://github.com/facebook/react-native/commit/d7fa81f18110f0dc0f310a5c066d9a30020ca830), [7d1ec7a3dc](https://github.com/facebook/react-native/commit/7d1ec7a3dc66654b13a8e9cb3ddf912e92506f55), [52648326e6](https://github.com/facebook/react-native/commit/52648326e6ac4470eeffc0a56d91bc487bc1eae4), [6bb8617f3a](https://github.com/facebook/react-native/commit/6bb8617f3a2f3f80f89eb00595a621aec35aca83), [5dbb3c586c](https://github.com/facebook/react-native/commit/5dbb3c586c9e8483aa7e6f1edd35ffb12bd4305d), [7e7d00aebe](https://github.com/facebook/react-native/commit/7e7d00aebefd2416f948066c65c739581c6e3f54), [46fd864348](https://github.com/facebook/react-native/commit/46fd8643485b21147c780d22ee8cf751b2dc8750), [9dfa2e7f3c](https://github.com/facebook/react-native/commit/9dfa2e7f3cfa5009f6c54382e90681d99a9c3cb8), [8a882fe6d6](https://github.com/facebook/react-native/commit/8a882fe6d6bb35776551eb8b0cd6892f41cab492), and [0f9fc4b295](https://github.com/facebook/react-native/commit/0f9fc4b2953d52fa1754e786dc5c74bfecbeaaca) by [@shergin](https://github.com/shergin) and [@hovox](https://github.com/hovox)) +- **Image**'s `resizeMode="center"` is now documented and has an example present ([be7037fd8e](https://github.com/facebook/react-native/commit/be7037fd8e1c4b92646caf7a70b9d6d28ef2c30a) by [@motiz88](https://github.com/motiz88)) +- Geolocation API no longer timeouts when `skipPermissionRequests: true` ([5c17db8352](https://github.com/facebook/react-native/commit/5c17db8352abfd94f094deb9b550284ec17f1fcd) by [@ngandhy](https://github.com/ngandhy)) +- Rounding pixels is now done with an algorithm from Yoga rather than React Native, reducing debt and improving performance ([ceb1d1ca5b](https://github.com/facebook/react-native/commit/ceb1d1ca5bc7c04b9d9ad16dcd9583f05b0ef498) and [114c258045](https://github.com/facebook/react-native/commit/114c258045ccca3a4433de206c7983b42d14c03b) by [@shergin](https://github.com/shergin)) + +#### Android specific changes + +- Numerous refactors around bundle handling and the `DevServerHelper` ([644123aa6f](https://github.com/facebook/react-native/commit/644123aa6fc6132125f56b485e5ab3b16f28f666), [e756251413](https://github.com/facebook/react-native/commit/e7562514130f614a9f138c0b855bfe4516150add), [6e44356c9b](https://github.com/facebook/react-native/commit/6e44356c9bb364195280aafc69aae48cdcb2ab84), [1019bda930](https://github.com/facebook/react-native/commit/1019bda930fa4c26fc0006efa023ee2c586705c6), [06d8f96a64](https://github.com/facebook/react-native/commit/06d8f96a64f00a003e34b0c1e93033893173ccc8), [f88c9d6382](https://github.com/facebook/react-native/commit/f88c9d63828e975a9792969e27accd851ead3e86), and [108f9664bf](https://github.com/facebook/react-native/commit/108f9664bffd1a4e0a7b2c2da3dc3810f1b29de2) by [@davidaurelio](https://github.com/davidaurelio)) + +### Fixed + +- Fix JS debugger issues related to CORS ([29f8354c19](https://github.com/facebook/react-native/commit/29f8354c1946a6325e9020b9ef5ee4ccdf0fa51f) by [@njbmartin](https://github.com/njbmartin)) +- Keep the `.gitignore`d files during the `react-native-git-upgrade` process ([7492860ffb](https://github.com/facebook/react-native/commit/7492860ffb3a010ff2273abf45c7414c098bdc37) by [@ncuillery](https://github.com/ncuillery)) +- Fix re-render case on SwipeableRow ([a580a44b0d](https://github.com/facebook/react-native/commit/a580a44b0d51ca7f33a4394b0a22d1c7d2234190)) +- Fix display of syntax error messages when HMR is enabled ([2b80cdf1bb](https://github.com/facebook/react-native/commit/2b80cdf1bba3b756915117139474440c203cbd8d) by [@ide](https://github.com/ide)) +- Add fixtures to metro blacklist in order to let build succeed ([54dc11a5fb](https://github.com/facebook/react-native/commit/54dc11a5fbafaccc9c0a781f1151225909717597) by [@t4deu](https://github.com/t4deu)) + +#### Android specific fixes + +- Don't crash when using decimal `Animated.modulo` values with `useNativeDriver: true` ([6c38972327](https://github.com/facebook/react-native/commit/6c389723274712bc52d6642cc6c1907b5523726d) by [@motiz88](https://github.com/motiz88)) +- Don't crash when receiving unknown websocket IDs ([1a790f8703](https://github.com/facebook/react-native/commit/1a790f8703d44c2322000dbf40a55678ca8a436a) by [@sunweiyang](https://github.com/sunweiyang)) +- Dont crash when `NativeModules.UIManager.showPopupMenu` method calls error callback ([0c18ec5b9c](https://github.com/facebook/react-native/commit/0c18ec5b9c64613dbdcd4be9f80e470e9532483d) by [@dryganets](https://github.com/dryganets)) +- Maintain cursor position when **TextInput**'s `secureTextEntry` changes ([09b43e479e](https://github.com/facebook/react-native/commit/09b43e479e97dfe31910503190b5d081c78e4ea2) by [@jainkuniya](https://github.com/jainkuniya)) +- Race condition fix in Dialogs module ([d5e3f081c6](https://github.com/facebook/react-native/commit/d5e3f081c6b41697533775d378969fcf554c7290) by [@dryganets](https://github.com/dryganets)) +- Fix NPE in Android Switch during measure ([7b1915e74d](https://github.com/facebook/react-native/commit/7b1915e74daa82d0a94e90ff266e9271bc43f4d8) by [@4ndroidev](https://github.com/4ndroidev)) +- Fix initialScrollIndex ([ef596dec49](https://github.com/facebook/react-native/commit/ef596dec49975dd4f8860ad8adcd29dd23e04c14) by [@olegbl](https://github.com/olegbl)) +- Fix redbox style ([f363dfe766](https://github.com/facebook/react-native/commit/f363dfe766244c8fc10eab3d2c4acdd8fc4b576b) by [@ayc1](https://github.com/ayc1)) +- Fix crash due to mishandling of UTF-8 in progressive download. ([9024f56bda](https://github.com/facebook/react-native/commit/9024f56bda4186fbade7bbd1e61f8e0252585c02) by [@dryganets](https://github.com/dryganets)) +- Fix crash because ClassCastException fix: getText() returns CharSequence not Spanned ([46cc4907e3](https://github.com/facebook/react-native/commit/46cc4907e3e49f5c7b1ac0a1088866f2958f43a1) by [@dryganets](https://github.com/dryganets)) +- Fix and re-enable "view flattening" optimizations ([877f1cde2e](https://github.com/facebook/react-native/commit/877f1cde2ebe8f304d6fd0855fc4a874d1d5ee27) by [@mdvacca](https://github.com/mdvacca)) + +#### iOS specific fixes + +- Fix Crash when **CameraRoll** is getting assets from iCloud and no filename is provided ([2ae24361c5](https://github.com/facebook/react-native/commit/2ae24361c5e0fc4aed9a321123bba8ca416a35ff) by [@pentarex](https://github.com/pentarex)) +- Fix Xcode Archive task failing if project path contains whitespace ([8aa568e867](https://github.com/facebook/react-native/commit/8aa568e867bbbe7e23ded3651f23581ff2753323) by [@jevakallio](https://github.com/jevakallio)) +- `react-native link` has been fixed to correctly link iOS and tvOS targets ([a63fd378a4](https://github.com/facebook/react-native/commit/a63fd378a47173cc9f750e9980f18dc12dd7ea51) by [@dlowder-salesforce](https://github.com/dlowder-salesforce)) +- `GLog` fix on case sensitive APFS macOS ([2fef1bafc8](https://github.com/facebook/react-native/commit/2fef1bafc8bee33432486212caf4fef5c659dd37) by [@hovox](https://github.com/hovox)) +- Fixed issue where you cannot launch tvOS app on Apple TV simulator ([afd988f85a](https://github.com/facebook/react-native/commit/afd988f85a8cf0980b5844cb88c1803e41502d03)) + +### Internal work + +- A **massive** amount of Yoga optimizations, cleanups, refactors, and test fixes ([62d01006a1](https://github.com/facebook/react-native/commit/62d01006a125517c8991fa93979aaec6ccc18823), [1475fc4856](https://github.com/facebook/react-native/commit/1475fc4856d366f8ec2027374971ed5aefcdeafa), [9daa17458a](https://github.com/facebook/react-native/commit/9daa17458a5f4ab8ead4d7c29de331f08b1a4a46), [d4517ddb9f](https://github.com/facebook/react-native/commit/d4517ddb9f2ad6d6175cbe6a8be2b819e4aa2c29), [ca91f0e3ac](https://github.com/facebook/react-native/commit/ca91f0e3ac55cb1e7a0fa2399d594a47de80a100), [34b7ec82b5](https://github.com/facebook/react-native/commit/34b7ec82b5d22efbdaa8b74b930d3c4da87414ec), [fda861a889](https://github.com/facebook/react-native/commit/fda861a88914a008b94c12078c9e579a99929643), [9f7cedbe14](https://github.com/facebook/react-native/commit/9f7cedbe14321d24b7aee1ba969b3d23d5c9d204), [ac1c8c265e](https://github.com/facebook/react-native/commit/ac1c8c265e6030c52434f99e882639c67c8c175d), [fcf2c7cf61](https://github.com/facebook/react-native/commit/fcf2c7cf61ca454f10d398d57b78b5b29ed05ae2), [2b27f1aa19](https://github.com/facebook/react-native/commit/2b27f1aa1964eba749876100be1f3ac4c085fa8f), [210ae5b95a](https://github.com/facebook/react-native/commit/210ae5b95a9c94194e95a21fdb93f88ddfdc5ce2), [82088580ab](https://github.com/facebook/react-native/commit/82088580ab17417a51386722f98b83d6cad0a6a0), [7f94bff89a](https://github.com/facebook/react-native/commit/7f94bff89a09547e76b50ae4c96ec59de73a153a), [bd7bf94af9](https://github.com/facebook/react-native/commit/bd7bf94af9ddfc9221ac3f6f62821b7e53e9b0ea), [2fe65b032e](https://github.com/facebook/react-native/commit/2fe65b032e9ec3faf3cef31290372b9face2d3f1), [9658d9f82b](https://github.com/facebook/react-native/commit/9658d9f82ba536c2f39937d61b3954e3dcc6a54e), [ee5c91c031](https://github.com/facebook/react-native/commit/ee5c91c0317b0defbb8da21f7e6d8d3ac8967381), [64d530ba07](https://github.com/facebook/react-native/commit/64d530ba0785af21555d48ddc9e7d561af37db4c), [400a29e151](https://github.com/facebook/react-native/commit/400a29e15134f5264cc55b239bd2a18a107911dd), [f75e21f1ca](https://github.com/facebook/react-native/commit/f75e21f1caf9117ae3eda31c23e286116ebf586c), [528bbacf6b](https://github.com/facebook/react-native/commit/528bbacf6b8a5a62faf4db5bfc8dfe063f0b82a3), [be8e7c6e65](https://github.com/facebook/react-native/commit/be8e7c6e65724d4915862098238506172dbe9657), [d0f7d4d107](https://github.com/facebook/react-native/commit/d0f7d4d107a90fdfbf795d842f4bd4a81290ec62), [4b4959a21c](https://github.com/facebook/react-native/commit/4b4959a21cb1e9e356eab51bfba0f16b76e8ec7f), [fdef3784f0](https://github.com/facebook/react-native/commit/fdef3784f00e8c3233a30aa2e35aaaadaa867489), [831a1bb4b1](https://github.com/facebook/react-native/commit/831a1bb4b1cc201b53685874a9dbdd6c3c1615ad), [2a22d998f8](https://github.com/facebook/react-native/commit/2a22d998f8a7f896db6c0708ba92ed9c9082ee7c), [9f57dedc17](https://github.com/facebook/react-native/commit/9f57dedc1712733ce4a490121138a97917fd3a52), and [ff2658c3de](https://github.com/facebook/react-native/commit/ff2658c3de111ef745d9582c6863ab0d6c90f960) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar), [@passy](https://github.com/passy), [@ryu2](https://github.com/ryu2), and others) +- 🚧 Lifecycle methods were renamed to be consistent with [React RFC6](https://github.com/reactjs/rfcs/blob/master/text/0006-static-lifecycle-methods.md) – note that there are Yellowbox warnings right now because of this, it's work-in-progress ([6f007e8957](https://github.com/facebook/react-native/commit/6f007e8957c9bf5652b0184cba65f385050a8236) by [@bvaughn](https://github.com/bvaughn)) +- Some autogenerated mystery string files were added ([c7846c4bfb](https://github.com/facebook/react-native/commit/c7846c4bfb5b944714d95382210f83c83da1ac52), [bb6fceac27](https://github.com/facebook/react-native/commit/bb6fceac274422102b347ec7aedb36efd9b701cd), [8bd00a2361](https://github.com/facebook/react-native/commit/8bd00a2361bb39f1bda58a260b7ffd278a05d79d), [faa9519021](https://github.com/facebook/react-native/commit/faa951902161201846f20a4dc55950e8f96cb0ff), [f49f7932d5](https://github.com/facebook/react-native/commit/f49f7932d581fe1f9569fb460196801528cfb591)) +- Improvements to the cli's implementation ([1673c570f9](https://github.com/facebook/react-native/commit/1673c570f984d86e88a3b6b44eb78f4848eb0515), [752427b7b8](https://github.com/facebook/react-native/commit/752427b7b8221bbb8304a158b2dad12b26afd7a5), and [619a8c9f29](https://github.com/facebook/react-native/commit/619a8c9f298356db68f8cd7e5d25e5bcf48bab05) by [@arcanis](https://github.com/arcanis), [@voideanvalue](https://github.com/voideanvalue), and [@rozele](https://github.com/rozele)) +- Measure touch events from nearest "root view" ([a70fdac5bd](https://github.com/facebook/react-native/commit/a70fdac5bdd4500b4ca3074dac26d414bd931fb9) by [@mmmulani](https://github.com/mmmulani)) +- Allow to attach the HMR server to an external http server ([8c6b816caa](https://github.com/facebook/react-native/commit/8c6b816caa908845471460f453f9d761bfba3f3d) by [@rafeca](https://github.com/rafeca)) +- Split folly/Memory out from headers-only targets in Buck ([b8e79a7e8b](https://github.com/facebook/react-native/commit/b8e79a7e8be1f3db1482a849352fda6e23c1c78a) by [@mzlee](https://github.com/mzlee)) +- Code cleanup of **ReactHorizontalScrollView** in Android ([71ec85f24c](https://github.com/facebook/react-native/commit/71ec85f24c3a1007a9e1f036a140cce43b38019f) by [@mdvacca](https://github.com/mdvacca)) +- Always create a debugger websocket connection when in iOS dev builds ([fa334ce464](https://github.com/facebook/react-native/commit/fa334ce464da39625f4e4fbfee259e9dcea31abc) by [@bnham](https://github.com/bnham)) +- Make the React Native HMR client extend from the generic metro HMR client ([9a19867798](https://github.com/facebook/react-native/commit/9a198677989930971912b98487ec68d162636411) by [@rafeca](https://github.com/rafeca)) +- Removed use of xip.io ([40a8434bde](https://github.com/facebook/react-native/commit/40a8434bde855ecae42408ec1240622152432de7) by [@jvranish](https://github.com/jvranish)) +- Fix Buck dependencies ([cec2e80fc2](https://github.com/facebook/react-native/commit/cec2e80fc251e4ea45ce1e446323716a3792390d), [4f6c157250](https://github.com/facebook/react-native/commit/4f6c157250676f07619af2a935bddd8301b50caa) by [@swolchok](https://github.com/swolchok)) +- Fix permissions on test script ([42c410ac84](https://github.com/facebook/react-native/commit/42c410ac84619a3d12a4619e59a0a526a3ebdca9) by [@mzlee](https://github.com/mzlee)) +- Better handling exception in loadScript() ([3fbf7856d9](https://github.com/facebook/react-native/commit/3fbf7856d9acb0909357d6b315388471a6b5a69c)) +- Fix ESLint upgrade "parsing error" ([9d214967d2](https://github.com/facebook/react-native/commit/9d214967d2c8184ce26addec150e392e3b519fcd) by [@zertosh](https://github.com/zertosh)) +- Fixing 🤡 in RCTSurfaceRootShadowView ([5fba82deff](https://github.com/facebook/react-native/commit/5fba82deffde731176e3e118193c212f5d2c2bca) by [@shergin](https://github.com/shergin)) +- Handle invalidation error in RCTObjcExecutor ([493f3e8da5](https://github.com/facebook/react-native/commit/493f3e8da5a112e1b33bfb3e9f51e7a2bd7edc7a) by [@fromcelticpark](https://github.com/fromcelticpark)) +- Check for nullptr when accessing isInspectable method ([70d23e82ad](https://github.com/facebook/react-native/commit/70d23e82ad21a4cfde1ce7c3b1c00fe7c7d5adbd) by [@fromcelticpark](https://github.com/fromcelticpark)) +- Introduce new Fabric API in RNAndroid ([2d35bde101](https://github.com/facebook/react-native/commit/2d35bde10130167018791c1b2fe4fece27cefddc) by [@mdvacca](https://github.com/mdvacca)) +- Fixing Prepack model for latest global.nativeExtensions changes. ([01a58d182a](https://github.com/facebook/react-native/commit/01a58d182abd19c9e089ec38b08ffd4b45e2076c) by [@NTillmann](https://github.com/NTillmann)) +- General code cleanup: unused code and configurations ([e233646d09](https://github.com/facebook/react-native/commit/e233646d095a272091b07c29fa87b206831ad6e3) and [e7010348d8](https://github.com/facebook/react-native/commit/e7010348d8b2f703fcc057c2914bd45ca6238f98) by [@bvaughn](https://github.com/bvaughn) and others) +- Add support for finding multiple views with NativeIds using a single listener to Android ([f5efc460ad](https://github.com/facebook/react-native/commit/f5efc460ad30cc60a62edd540c3b0f45c67bcda3) by [@axe-fb](https://github.com/axe-fb)) +- Add CountingOutputStream ([a5e135aed6](https://github.com/facebook/react-native/commit/a5e135aed6941772c663adffd67729f7a5026d08) by [@hramos](https://github.com/hramos)) +- Changes from Prettier ([b815eb59be](https://github.com/facebook/react-native/commit/b815eb59bef7bed9825027adc676b8d09db463c6), [e758cb7f39](https://github.com/facebook/react-native/commit/e758cb7f397b37b5621a4e0afcabc1c74443bc06), [bf9cabb03c](https://github.com/facebook/react-native/commit/bf9cabb03c7245930c270a19816545eae1b9007d), and [a5af841d25](https://github.com/facebook/react-native/commit/a5af841d259b6b29d95a9fb346a0ffce9c6efbfe) by [@shergin](https://github.com/shergin)) +- Typos in code ([8ffc16c6e7](https://github.com/facebook/react-native/commit/8ffc16c6e7d25dd434ca3fc7f9ffd6d5917f7bcd) by [@ss18](https://github.com/ss18)) +- Support for inherited events in view managers ([2afe7d4765](https://github.com/facebook/react-native/commit/2afe7d4765ffc0d0c71d233211edd1d21972040e) by [@shergin](https://github.com/shergin)) +- Flow types changes ([3fc33bb54f](https://github.com/facebook/react-native/commit/3fc33bb54fc5dcf7ef696fe245addc320f85a269), [e485cde187](https://github.com/facebook/react-native/commit/e485cde187e4cd92bc821e58047b149a789dd713), [83ed9d170b](https://github.com/facebook/react-native/commit/83ed9d170b8fd750a345fc608ec69db2fe3ca9b2), [52ffa5d13e](https://github.com/facebook/react-native/commit/52ffa5d13ef6fe2752bc8f838dc1c2dfe651bb64), [d37cdd97ae](https://github.com/facebook/react-native/commit/d37cdd97aee4c1bac864cb28b686f2d1a128128e), [6e7fb01c02](https://github.com/facebook/react-native/commit/6e7fb01c02f3e91777c8292389c09a15d24cf800), [d99ba70c49](https://github.com/facebook/react-native/commit/d99ba70c492d3cd15ef6aded3f8712976d251f88), [bcfbdf4fbe](https://github.com/facebook/react-native/commit/bcfbdf4fbec1a05da151a2255f44a87b651965d6), and [a1c479fb3b](https://github.com/facebook/react-native/commit/a1c479fb3be674511131b46f856bc9b197a38cda) by [@alexeylang](https://github.com/alexeylang), [@sahrens](https://github.com/sahrens), [@yungsters](https://github.com/yungsters), and [@zjj010104](https://github.com/zjj010104)) +- Give IInspector a virtual destructor for correct InspectorImpl destruction ([2a3c37f424](https://github.com/facebook/react-native/commit/2a3c37f424a4d1b9f4c5a2960a1cbe3517eac007) by [@toulouse](https://github.com/toulouse)) +- Migrated `SourceCode` and `DeviceInfoModule` out of Native Modules ([47fe52380a](https://github.com/facebook/react-native/commit/47fe52380a232a1c364e21f71e2644a5a3348366) and [429fcc8cab](https://github.com/facebook/react-native/commit/429fcc8cab3ca877275d7deb1040fdff17a414c7)) +- Jest config change as part of bringing back support for the `assetPlugin` option in Metro ([af6450c660](https://github.com/facebook/react-native/commit/af6450c660d3055d9c5c70d200471541a1ce7e12) by [@ide](https://github.com/ide)) +- Nested virtualized lists should receive recordInteration events ([ae2d5b1e68](https://github.com/facebook/react-native/commit/ae2d5b1e68a2207c27ef2f1b533f86c86d6d849b)) +- Upgrade connect dependency ([709ede799c](https://github.com/facebook/react-native/commit/709ede799cc9820acadaf22aa84f0fe6dd2be319) by [@rafeca](https://github.com/rafeca)) +- xplat/js: asyncRequire: redirect async modules to control modules ([5e11b8870a](https://github.com/facebook/react-native/commit/5e11b8870aa855a56cfafa6575aed5e33b272065) by [@jeanlauliac](https://github.com/jeanlauliac)) +- More progress towards split bundle support ([1a1a956831](https://github.com/facebook/react-native/commit/1a1a956831aec93a4fe2c6e2f63f558271fb466b) and [9e34cbda9d](https://github.com/facebook/react-native/commit/9e34cbda9de8f7350cfb02c884fbef2da18e0e3a) by [@fromcelticpark](https://github.com/fromcelticpark)) +- Implement bundle sync status ([88980f2ef7](https://github.com/facebook/react-native/commit/88980f2ef7331aa630ff19e54427cdc3b7510869)) +- Various improvements to RCTSurface and RCTShadowView ([7d9e902d72](https://github.com/facebook/react-native/commit/7d9e902d72e240f54ea01225cc3272698ff70014), [06ebaf2205](https://github.com/facebook/react-native/commit/06ebaf2205f979b6e6595ec7985447a07d25c4d4), [6882132421](https://github.com/facebook/react-native/commit/688213242130536c5d4db8b9aa17dc418372aadf), and [193a2bd4cd](https://github.com/facebook/react-native/commit/193a2bd4cdffbbc79b69c067b31420663dc9b03a) by [@shergin](https://github.com/shergin)) +- Progress towards experimental ReactFabric and FabricUIManager ([b1e5c01483](https://github.com/facebook/react-native/commit/b1e5c01483a69b181c75d242231077cb2f96e846), [fa0ac92b2c](https://github.com/facebook/react-native/commit/fa0ac92b2c9cfc302314ff18325a96354bb1f432), [94dac23583](https://github.com/facebook/react-native/commit/94dac23583dc6b693475769c196c4b51954e74f1) by [@fkgozali](https://github.com/fkgozali)) +- (almost) kill fbjsc ([702b7e877e](https://github.com/facebook/react-native/commit/702b7e877e09afede0dcdc7f8c680be63e942153) by [@michalgr](https://github.com/michalgr)) +- Refactored bridge ReadableNativeMap and ReadableNativeArray to add centralized accesses ([7891805d22](https://github.com/facebook/react-native/commit/7891805d22e3fdc821961ff0ccc5c450c3d625c8), [28be33ac34](https://github.com/facebook/react-native/commit/28be33ac34d9214ffd452f88a4d19468683a6a0d), and [5649aed6d3](https://github.com/facebook/react-native/commit/5649aed6d3223ec49c42416f242249eb0c4fd890)) +- Removed unused core from Image.android.js ([ce3146a6f3](https://github.com/facebook/react-native/commit/ce3146a6f3162141c7dc06d2c91ec291d3756a92) by [@shergin](https://github.com/shergin)) +- Capture StackOverflowExceptions triggered when drawing a ReactViewGroup or ReactRootView and log more debugging information for it ([1aac962378](https://github.com/facebook/react-native/commit/1aac9623789e3d2a428b51ae699d4c340b3afb99) and [4d3519cc6a](https://github.com/facebook/react-native/commit/4d3519cc6af5bb33c6f21d9392b82379780d79dc) by [@mdvacca](https://github.com/mdvacca)) +- `babel-preset-react-native`: only require plugins once ([df6c48cf36](https://github.com/facebook/react-native/commit/df6c48cf36d39a75a6196462d661ce75c6aef104) by [@davidaurelio](https://github.com/davidaurelio)) +- Report module id as string and as double, in case of invalid values are passed to nativeRequire ([8f358a2088](https://github.com/facebook/react-native/commit/8f358a20881b61cf3256fa1e404b86d5f104932d) by [@fromcelticpark](https://github.com/fromcelticpark)) +- More work moving build configurations to Skylark ([d3db764f38](https://github.com/facebook/react-native/commit/d3db764f383fc588a87e0d1e4267b310d6188bc8), [869866cc5c](https://github.com/facebook/react-native/commit/869866cc5c639d8c0257c776368381987a7f7159), [a8c95d2417](https://github.com/facebook/react-native/commit/a8c95d241757fefaa06ff49193975f7c103a6418), and [79a63d040f](https://github.com/facebook/react-native/commit/79a63d040f1346a0e320104fb35da405502aae19) by [@mzlee](https://github.com/mzlee), [@ttsugriy](https://github.com/ttsugriy), and others) +- `[RCTShadowView isHidden]` was removed ([c19bc79688](https://github.com/facebook/react-native/commit/c19bc7968855e85758df9e1a47dc2a52e69668ed) by [@shergin](https://github.com/shergin)) +- Remove unused `packagerInstance` option and rename it to `server` ([bbbc18c4ee](https://github.com/facebook/react-native/commit/bbbc18c4ee9b13a5aeca10edcb29694db3f15769)) +- The blog has moved to [react-native-website](https://github.com/facebook/react-native-website/tree/master/website/blog) ([e16d67340e](https://github.com/facebook/react-native/commit/e16d67340e0ad1724afeee78f9d820177abbd8b6) by [@hramos](https://github.com/hramos)) +- Remove SoLoaderShim, use SoLoader ([fc6dd78935](https://github.com/facebook/react-native/commit/fc6dd78935a41106aa6a44058c1abb7d0ba0fa24) by [@foghina](https://github.com/foghina)) +- Removed broken link for 'Getting Help' in the README ([b3a306a667](https://github.com/facebook/react-native/commit/b3a306a66709a0ab0ff29151a38eaa3f8f845c1f) by [@rickydam](https://github.com/rickydam)) +- Changed to use boost-for-react-native cocoapod, which speeds up `pod install` a ton; this was in 0.53 originally but had to be re-added ([d40db3a715](https://github.com/facebook/react-native/commit/d40db3a715afaf1cde4a5e231e96e46b2808bbef) by [@CFKevinRef](https://github.com/CFKevinRef)) +- Remove fbobjc's RN copy ([af0c863570](https://github.com/facebook/react-native/commit/af0c8635709b8014c68ce88ebb1e9e94ec56768a)) +- Measure time to create **ReactInstanceManager** ([6224ef5301](https://github.com/facebook/react-native/commit/6224ef5301d67266b28c77e5e46816f319122f38) by [@alexeylang](https://github.com/alexeylang)) +- Upgrade create-react-class to v15.6.3 ([74f386633d](https://github.com/facebook/react-native/commit/74f386633d5e123b2ea73b4773d0ee7d83832fb5) by [@bvaughn](https://github.com/bvaughn)) +- Upgrade react-devtools to v3.1.0 ([8235a49a33](https://github.com/facebook/react-native/commit/8235a49a33cc8e84cd4ba1cc15bc09eed6712b4c) by [@bvaughn](https://github.com/bvaughn)) +- Upgrade flow to v0.65.0 ([7aba456b04](https://github.com/facebook/react-native/commit/7aba456b04ff6a4e4721bcf1064f22a8a87f90c7) and [298f3bb69a](https://github.com/facebook/react-native/commit/298f3bb69abecdcd83adb64e043a2974bd52b1ab) by [@avikchaudhuri](https://github.com/avikchaudhuri) and [@mroch](https://github.com/mroch)) +- Upgrade Jest to v22.2.1 ([46f4d3e1bc](https://github.com/facebook/react-native/commit/46f4d3e1bc9340009c53f366ebd98600c485c993) and [24e521c063](https://github.com/facebook/react-native/commit/24e521c063035e470587bb279976a955ff03717a) by [@mjesun](https://github.com/mjesun)) +- Upgrade ESLint to v4.17.0 (plus update related deps) ([bba19e846e](https://github.com/facebook/react-native/commit/bba19e846e377241826475906f642264409a3990) by [@zertosh](https://github.com/zertosh)) +- Upgrade React to v16.3.0-alpha.1 ([03d7b2aa0e](https://github.com/facebook/react-native/commit/03d7b2aa0e7f239c78b6fe3a96c0ddf3de00a58b) and [5e80d95e03](https://github.com/facebook/react-native/commit/5e80d95e034259af8c41b50756a623756cc81a77) by [@grabbou](https://github.com/grabbou) and [@hramos](https://github.com/hramos)) +- Synced React and ReactFabric render ([c7ed03a95c](https://github.com/facebook/react-native/commit/c7ed03a95c8c372c7631c11e0778cf9753afdabc), [13829751b1](https://github.com/facebook/react-native/commit/13829751b11330f8e1400c5c70c59c49ac2f091f), and [d676746f14](https://github.com/facebook/react-native/commit/d676746f14fb6d714d2576871655b13c005480e7) by [@bvaughn](https://github.com/bvaughn)) +- Upgrade metro to v0.26.0 ([9e6f3b8aff](https://github.com/facebook/react-native/commit/9e6f3b8aff7572f5e9008a2641c70846da0817bb), [ce50f25d22](https://github.com/facebook/react-native/commit/ce50f25d22d56f24bdb7d80a3f9a279863d5dc2a), [e9b83e608e](https://github.com/facebook/react-native/commit/e9b83e608e8487ef8fcbfc956a52bfa7ee1d727f), [2fe7483c36](https://github.com/facebook/react-native/commit/2fe7483c36b10146f737f0a84799c2eb01aaba79), [0f96ebd93b](https://github.com/facebook/react-native/commit/0f96ebd93b634ec3fb0e6036a4960bb4af167e7b), [0de470ec19](https://github.com/facebook/react-native/commit/0de470ec19f2b9f3f4f3ab3dd4322c0f0ece2868), [e8893a021f](https://github.com/facebook/react-native/commit/e8893a021f60ffeea27443998b1716e9a1963d64), and [b1d8af48ae](https://github.com/facebook/react-native/commit/b1d8af48ae251f57bdcd55f89d8fc62aa9eca872) by [@rafeca](https://github.com/rafeca) and [@grabbou](https://github.com/grabbou)) +- Add Context to Redbox report api ([e3c27f585a](https://github.com/facebook/react-native/commit/e3c27f585aaeb685e86250f45fc790c06932af0d) by [@ayc1](https://github.com/ayc1)) +- GitHub bot commands have been disabled in the short term ([b973fe45bd](https://github.com/facebook/react-native/commit/b973fe45bdbc84e12fd0a3afbd6fdd327bcb9d02) by [@hramos](https://github.com/hramos)) +- Various CI configuration changes ([17bd6c8e84](https://github.com/facebook/react-native/commit/17bd6c8e84d9f5d42767a6f42a9a2cf812aa778b), [51b6749c07](https://github.com/facebook/react-native/commit/51b6749c075bb87a340096a0dc06cd6cf9a19907), [a2f3ba864e](https://github.com/facebook/react-native/commit/a2f3ba864ed17ca32e71f15724a8ebf2b1e640c1), [2ef9b7f2da](https://github.com/facebook/react-native/commit/2ef9b7f2da5b875ac1a4fee0ade3cc16ad96772a), [40b17926bb](https://github.com/facebook/react-native/commit/40b17926bb2c724f1580b2eb0c30a37f5d48030a), [613afbab7f](https://github.com/facebook/react-native/commit/613afbab7f30748ba767b055f23d0d294562805f), [da8bec9f8b](https://github.com/facebook/react-native/commit/da8bec9f8b62b46e58e0e98413aa915ece05b71b), [fa11faecb6](https://github.com/facebook/react-native/commit/fa11faecb69f385a5c0aba60f4039612e46b87f3), [f50af7f8a4](https://github.com/facebook/react-native/commit/f50af7f8a48e9cae2cb512962870d5692da5aaf2), [9227ba73ab](https://github.com/facebook/react-native/commit/9227ba73ab8c2b8b8ce4086b5f4667a8a55cdcfa), [365a4d4b43](https://github.com/facebook/react-native/commit/365a4d4b4315d4ca7a0e1236012b763d7e5bb1fd), [b58d848d9c](https://github.com/facebook/react-native/commit/b58d848d9cf78d755fe38392e26826ed481175cd), [c8e98bbaf5](https://github.com/facebook/react-native/commit/c8e98bbaf58b7a7f866e831982355b78dfa43b9d), [f5975a97ad](https://github.com/facebook/react-native/commit/f5975a97adcf3ae9c2988d7e267947a84ab60cee), and [605a6e4031](https://github.com/facebook/react-native/commit/605a6e4031fc9b63edbb9120ffacf7b045dc9db8) by [@hramos](https://github.com/hramos), [@grabbou](https://github.com/grabbou), and [@dryganets](https://github.com/dryganets)) +- Restore copyright header ([4f883bd0bc](https://github.com/facebook/react-native/commit/4f883bd0bcdc015e2cf70bcc29bbe05fd5b8a40b) by [@hramos](https://github.com/hramos)) +- Trim docs that are already present in the open source docs site ([28d60b68ad](https://github.com/facebook/react-native/commit/28d60b68ad7bc5b7ebda6b720981feacd3bde337) by [@hramos](https://github.com/hramos)) +- Fix obsolete instructions about editing docs ([2f46712074](https://github.com/facebook/react-native/commit/2f46712074d187f5456723499e6885bf0941cfbc) by [@ExplodingCabbage](https://github.com/ExplodingCabbage)) +- Fix links to beginner friendly issues ([c355a34de1](https://github.com/facebook/react-native/commit/c355a34de107befd26bc495272b91c11957f3fd0) by [@hotchemi](https://github.com/hotchemi)) +- Typos in comments and log messages ([d2c569795c](https://github.com/facebook/react-native/commit/d2c569795ca07b6b7c0227cfc6d0b3bf5dd23b99) by [@ss18](https://github.com/ss18)) +- Don't run the Danger CI tool through Flow ([1ea3065feb](https://github.com/facebook/react-native/commit/1ea3065feb265bef738bd53e835567d595266725) by [@hramos](https://github.com/hramos)) +- Namespace custom ESLint rules through eslint-plugin-lint ([488b6825c5](https://github.com/facebook/react-native/commit/488b6825c5fb4ec68a8b7315559c4d34e012de12) by [@zertosh](https://github.com/zertosh)) + +- ... and now we're at 0.54 🎉 ([67e67ec83c](https://github.com/facebook/react-native/commit/67e67ec83ce83d4a1a38bc29dd52bf5c28723752), [21dd3dd296](https://github.com/facebook/react-native/commit/21dd3dd296989f4de2d4e9b1ba0df88ea2d32413), [49e35bd939](https://github.com/facebook/react-native/commit/49e35bd9399716a2734e824bab14faf1683cdfdd), [829f675b8b](https://github.com/facebook/react-native/commit/829f675b8b4abae696151e404552af515a2da1ce), and [294d95a236](https://github.com/facebook/react-native/commit/294d95a23687b2e3155fe4ae1bc5e4a649e6b014) by [@grabbou](https://github.com/grabbou) and [@hramos](https://github.com/hramos)) + +## v0.53.0 + +Welcome to the January 2018 release of React Native. The CLI now supports `--port` for both platforms, a few components were made to support consistent props across both platforms, and various fixes were made. There was a lot of under-the-cover work done with more test improvements and dependency updates. 118 commits were made by 43 contributors 🎉. + +### Added + +- ✨ **Keyboard** events now include `easing` and `duration` ([4d33080f0f](https://github.com/facebook/react-native/commit/4d33080f0fa7b2eb7b0e9ff7bbd50c222f461786) by [@sahrens](https://github.com/sahrens)) + +#### iOS exclusive additions + +- `react-native run-ios` now supports the `--port` argument for metro ([33d710e8c5](https://github.com/facebook/react-native/commit/33d710e8c58ef1dc69816a59ac1cf390894e7cb9)) + +#### Android exclusive additions + +- On Android, **ScrollView** now takes `snapToInterval` like iOS ([ddd65f1ba9](https://github.com/facebook/react-native/commit/ddd65f1ba9cca945313d116c1dcf75f3a0556099) and [b2848a54b0](https://github.com/facebook/react-native/commit/b2848a54b05470b3e258c935dd33b8c11a31b3c3) ) +- On Android, **TextInput** now takes `onKeyPress` like iOS ([c9ff0bc212](https://github.com/facebook/react-native/commit/c9ff0bc212b680232f7379fba7b9332927075c3c) by [@joshyhargreaves](https://github.com/joshyhargreaves)) + +### Changed + +- ⬆️ Metro to v0.24.2 ([2e008bc464](https://github.com/facebook/react-native/commit/2e008bc464f94df013794d3da6e9d4e4722151a0) and [0b5e8b4852](https://github.com/facebook/react-native/commit/0b5e8b485229957086d416c307f07c75a4139ffa) by [@rafeca](https://github.com/rafeca)) +- ⬆️ Flow to v0.63 ([6b95c4fb14](https://github.com/facebook/react-native/commit/6b95c4fb142a7015b2afca50cc19eec0b8913d8c) by [@gabelevi](https://github.com/gabelevi)) +- ⬆️ Danger to v2.0 ([b750e3b21b](https://github.com/facebook/react-native/commit/b750e3b21bc5c135773e8de53c5663bdf6266951) by [@hramos](https://github.com/hramos)) +- ⬆️ Jest to v22.0.0 ([4803419dc8](https://github.com/facebook/react-native/commit/4803419dc8406b6892f20cdfb448a01c16ad4338) by [@mjesun](https://github.com/mjesun)) +- 💄 Bundler is now called Metro Bundler in the terminal ([654d7595fe](https://github.com/facebook/react-native/commit/654d7595fe5766667c015307129e75d8986482e1) by [@edcs](https://github.com/edcs)) +- 📝 Update getting started url on Android CLI ([6661633390](https://github.com/facebook/react-native/commit/6661633390276f707faa60509b2805a83929e747)) +- 🐳 Dockerfile uses newest Android SDK, Buck, and new Docker tags have been pushed ([4fbfbe6bb0](https://github.com/facebook/react-native/commit/4fbfbe6bb0e0eaaf12ec713888bf2c6a347f0f96) and [c547f783c4](https://github.com/facebook/react-native/commit/c547f783c440019a4a87ba55b668b3af5ff8fc91) by [@hramos](https://github.com/hramos)) +- 📝 Update repo docs to use HTTPS ([33a2e533b7](https://github.com/facebook/react-native/commit/33a2e533b76d35c1b9fb32e926f7c2c27cb616e9) by [@him2him2](https://github.com/him2him2)) +- 🎨 Make **ScrollResponder** follow code style ([45e6fcdba0](https://github.com/facebook/react-native/commit/45e6fcdba089900555faa63fe8e37b4bd4a7700a) by [@TheSavior](https://github.com/TheSavior)) +- **VirtualizedList** now requires a windowSize greater than 0 ([3559e42c55](https://github.com/facebook/react-native/commit/3559e42c55366bacd9bb5178ecab64f95e9a8ea7)) +- react-devtools works with emulator and real devices now without needing to tweak the devServer value ([fa574c6092](https://github.com/facebook/react-native/commit/fa574c60920588e29d7b642e547e240ac8655e66) by [@jhen0409](https://github.com/jhen0409)) +- 📝 Clarify use of Flow props types in react-native-cli's template project ([9b147a53d1](https://github.com/facebook/react-native/commit/9b147a53d1ab1e14d7ef5b436f1e140a28a5d6a3) by [@hramos](https://github.com/hramos)) +- 📝 Add docs for `isInspectable` ([59c7967627](https://github.com/facebook/react-native/commit/59c79676277abaaaf61388309429c77164c3de4b) by [@bnham](https://github.com/bnham)) +- ✅ More Flow improvements (**Text**, **SectionList**, and others) ([f71f4e7906](https://github.com/facebook/react-native/commit/f71f4e7906648766e1a5b630abbad8935daef955), [632f1202ab](https://github.com/facebook/react-native/commit/632f1202ab3f9dd300a53f096bc15325e0d8f6c1), and [a8391bde7d](https://github.com/facebook/react-native/commit/a8391bde7d757d01521a6d12170fb9090c17a6a0) by [@yungsters](https://github.com/yungsters), [@samwgoldman](https://github.com/samwgoldman), and others) +- Various code cleanup to satisfy linting errors and standards ([b0319f3293](https://github.com/facebook/react-native/commit/b0319f3293b553c105b813dd12bff7d55940e60b), [dd4611721d](https://github.com/facebook/react-native/commit/dd4611721d0ad49ceaf4514df1b47cf2753b9ae6), and [7f58189605](https://github.com/facebook/react-native/commit/7f5818960596a2a18b7d427fd23d46396c05bee5) by [@ayc1](https://github.com/ayc1), [@grabbou](https://github.com/grabbou), and [@ide](https://github.com/ide)) + +#### iOS exclusive changes + +- 🔥⚡️ iOS UI Manager cleanup and optimizations ([0ec1017660](https://github.com/facebook/react-native/commit/0ec1017660602d6b3ae84b4d7a444cbd49ba0d53), [0ae4c47daa](https://github.com/facebook/react-native/commit/0ae4c47daa6280d2931d8bbf89612b2f1cb106d4), [2679f3efb6](https://github.com/facebook/react-native/commit/2679f3efb69bc7b0db1840b4ea59ebe791a54dd2),and [d9e5b313bb](https://github.com/facebook/react-native/commit/d9e5b313bb63a1ec0d402a96539c6df29bc72c42) by [@shergin](https://github.com/shergin)) +- If the inspector tries to handle a wrapped event but there is no connection, log a warning rather than a Redbox ([30da2622e2](https://github.com/facebook/react-native/commit/30da2622e222c338421508ce6e5663155fc874ef) by [@bnham](https://github.com/bnham)) +- Various under-the-covers changes around the bridge, RCTShadowView, RCTSurface, and a few others ([c3139d798a](https://github.com/facebook/react-native/commit/c3139d798af633bb81bf0da6df05b3c0beb0ced4), [2789ba016b](https://github.com/facebook/react-native/commit/2789ba016bfddace1407473769e933795333cfab), [b8e60a3ca3](https://github.com/facebook/react-native/commit/b8e60a3ca3314d79e9c38ee8c7995df81a27624c), [099b28006b](https://github.com/facebook/react-native/commit/099b28006b59abb11eae1f27424566b280860b0d), [b263560c73](https://github.com/facebook/react-native/commit/b263560c73af5559fdc3bba411f16c588abbffef), [19a9c5e41d](https://github.com/facebook/react-native/commit/19a9c5e41da0aa6ee28a54772edcb92daa498561), [d3b41e0da3](https://github.com/facebook/react-native/commit/d3b41e0da37c08ab0637d9f70d612e50b6f5e63c), [b2a251948f](https://github.com/facebook/react-native/commit/b2a251948f3309d2b1d0d533fb2fa74d2f8a10b8), [870bc4807a](https://github.com/facebook/react-native/commit/870bc4807a8c3f90498cf4c2ed3c030cb7b43ef9), [176a578238](https://github.com/facebook/react-native/commit/176a578238566ad857c0911e127669f1ee82107d), [c491b22233](https://github.com/facebook/react-native/commit/c491b2223313676bd4900de7a8c70a10051fa9f0), [c75612219e](https://github.com/facebook/react-native/commit/c75612219ef0c99d1ddca0aadf354f20de27608c), and[c01a171ed8](https://github.com/facebook/react-native/commit/c01a171ed881fb91a972ed475011f85697a29341) by [@shergin](https://github.com/shergin)) +- Changed to use _boost-for-react-native_ cocoapod, which speeds up `pod install` a ton ([d40db3a715](https://github.com/facebook/react-native/commit/d40db3a715afaf1cde4a5e231e96e46b2808bbef) by [@CFKevinRef](https://github.com/CFKevinRef)) + +#### Android exclusive changes + +- Include scroll momentum info when there are scroll events from Android ([c49d249fd7](https://github.com/facebook/react-native/commit/c49d249fd7c274f02e6018892992bcd273d6a465) by [@wwalser](https://github.com/wwalser)) +- Yoga's mkfile for Android now uses wildcard instead of manual file addition ([d89901fa60](https://github.com/facebook/react-native/commit/d89901fa6002802dc9d744bfe3e5e712d6a411a1) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) + +### Removed + +- **TextInput** no longer has the `autoGrow` prop, since this is platform-default behavior now ([dabb78b127](https://github.com/facebook/react-native/commit/dabb78b1278d922e18b2a84059460689da12578b) by [@shergin](https://github.com/shergin)) + +#### iOS exclusive removals + +- Updates to the bridge in order to enable future rendering optimizations ([d2dc451407](https://github.com/facebook/react-native/commit/d2dc4514077ae868f85d45ccdcc7c69df7b7648b) by [@shergin](https://github.com/shergin)) + +### Fixed + +- Do not set `minify=true` when calculating the list of dependencies for the CLI ([4a1bb8fe8d](https://github.com/facebook/react-native/commit/4a1bb8fe8dfd36ea207c0683d683bb8b22a282a5) by [@rafeca](https://github.com/rafeca)) +- 👷 Update CODEOWNERS now that the docs are in a separate repository ([85ff264445](https://github.com/facebook/react-native/commit/85ff264445aa4b9cf0b91aaca5764bb56caba997) by [@hramos](https://github.com/hramos)) +- Fixed a broken link in react-native-git-upgrade's readme ([bbedf2da9a](https://github.com/facebook/react-native/commit/bbedf2da9a3a091eeb687d43029f7d2450cf2612) by [@Taym95](https://github.com/Taym95)) +- 🤡 Do not use Node 8.x specific Stream.final for FS mocks ([4216cdef13](https://github.com/facebook/react-native/commit/4216cdef13c9ed47b9c746b39a0ddfdaf846d495) by [@hramos](https://github.com/hramos)) +- Fix virtualized cell keys for list headers and footers ([a010a0cebd](https://github.com/facebook/react-native/commit/a010a0cebd4afc0d88336c2c265a5d9dbb19918f)) +- Fix warnings of casting and null pointer handling in Yoga ([a8d4666651](https://github.com/facebook/react-native/commit/a8d46666518944a178e85c179da8047234c2d8fb) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- Fix broken buck failures on master ([4e767013ed](https://github.com/facebook/react-native/commit/4e767013ed73fb89f69f2e59626d6dcf3bb77684) by [@hramos](https://github.com/hramos)) +- **RefreshControl** appears correctly when expected on initial render of a **FlatList** again ([ed5872e2cc](https://github.com/facebook/react-native/commit/ed5872e2cca955ee407e87e37e13c7fed182199a) by [@vonovak](https://github.com/vonovak)) +- Fixed JS debugger CORS issue ([29f8354c19](https://github.com/facebook/react-native/commit/29f8354c1946a6325e9020b9ef5ee4ccdf0fa51f) by [@njbmartin](https://github.com/njbmartin)) + +#### Android exclusive fixes + +- Fix position of dev loading view on Android API < 20 ([7ff6657985](https://github.com/facebook/react-native/commit/7ff6657985a09bd2572615d16403fba3af709859) by [@kmagiera](https://github.com/kmagiera)) +- Fix Modal not disappearing when navigating from inside a Modal to another activity ([e5c2a66897](https://github.com/facebook/react-native/commit/e5c2a66897b9c562c549e63adcf70783ea34c418) + +#### iOS exclusive fixes + +- Fix regression introduced where layout wouldn't occur in some situations ([46be5bf71c](https://github.com/facebook/react-native/commit/46be5bf71c78d33cda5cb496c475dcfb8e229346) by [@shergin](https://github.com/shergin)) +- Fixed double initial prop applying for newly created views ([0ec1017660](https://github.com/facebook/react-native/commit/0ec1017660602d6b3ae84b4d7a444cbd49ba0d53) by [@shergin](https://github.com/shergin)) +- tvOS build now works again ([3bd89867d6](https://github.com/facebook/react-native/commit/3bd89867d6f23547f07b9b3a569d5a62971004f6) by [@dlowder-salesforce](https://github.com/dlowder-salesforce)) + +### Other + +Below is a list of the remaining, low-level changes that made it into this release of React Native. + +- Remove "prepareReact" call from the bridge ([80f9e1f7de](https://github.com/facebook/react-native/commit/80f9e1f7de407ea417cecb04b3ba20b05696b478) and [56a42e57d0](https://github.com/facebook/react-native/commit/56a42e57d05ff609e8fce35dcb5e9db7938db801) by [@fromcelticpark](https://github.com/fromcelticpark)) +- Add explicit componentControllerClass to CKComponent for RCTSurface ([ab972708a8](https://github.com/facebook/react-native/commit/ab972708a8dcc9b37c19843f2fe134928a7c7a3f)) +- Changes to RCTShadowView to increase RCTSurface performance ([f96f9c5fd6](https://github.com/facebook/react-native/commit/f96f9c5fd692000f561e87cba68642ef7daf43e7) by [@shergin](https://github.com/shergin)) +- Designated methods to control dirty propagation ([af226ef949](https://github.com/facebook/react-native/commit/af226ef949f3a21ef68a6e6b9fbd4cc06fa05152) by [@shergin](https://github.com/shergin)) +- Add missing tvOS header ([49cbca7464](https://github.com/facebook/react-native/commit/49cbca7464e27c34105122459ae29cc3b1247513) by [@grabbou](https://github.com/grabbou)) +- On Android, seperate logic to initialize JS from starting the app ([4996b9aeb4](https://github.com/facebook/react-native/commit/4996b9aeb4127892b7579b45927dec14833b8b4d) by [@axe-fb](https://github.com/axe-fb)) +- ♻️ JS linting was cleaned up: removed unused libs, strengthened the rules, removed unneeded rules, prevent disabled tests, and more ([2815ada238](https://github.com/facebook/react-native/commit/2815ada23872fc28dc8dd5a9833962cb73f452eb), [183c316f4c](https://github.com/facebook/react-native/commit/183c316f4c869804b88cffe40614c84ac0a472d0), [9c67e749d8](https://github.com/facebook/react-native/commit/9c67e749d8f63cf14ece201ec19eee4676f96a85), [79902f99b8](https://github.com/facebook/react-native/commit/79902f99b81f538042b38a857182c2e5adbfd006), [9a36872f0c](https://github.com/facebook/react-native/commit/9a36872f0c7ba03a92fabf65e4d659d6861ea786), [67a3c42d1a](https://github.com/facebook/react-native/commit/67a3c42d1a29b6fa1375f7445d1c9b4429939bae), [b826596700](https://github.com/facebook/react-native/commit/b82659670041d0e472f68c0a14b3ef5b962db09b), [a1a0a69546](https://github.com/facebook/react-native/commit/a1a0a6954635141ce6c167816b67674aa5c31062), and [11a495cb32](https://github.com/facebook/react-native/commit/11a495cb3235ebbc2ad890e92ec612fd5316bffb) by [@TheSavior](https://github.com/TheSavior)) +- 👷 Separate JS lint and flow checks from tests ([5ea5683d01](https://github.com/facebook/react-native/commit/5ea5683d01487b49c814fca6e11a818b9a777239) by [@hramos](https://github.com/hramos)) +- 👷 Fix Buck in build config to enable CI ([796122d8f3](https://github.com/facebook/react-native/commit/796122d8f3b825c0bf0c138c662f3477f8bab123), [7c3a61f3b6](https://github.com/facebook/react-native/commit/7c3a61f3b610e219fd798eccd330deb9a2471253), [82b123e744](https://github.com/facebook/react-native/commit/82b123e744b87cc59c96b4e82af9ed03981b4f42) by [@grabbou](https://github.com/grabbou)) +- ♻️ Various refactoring within the YGNode implementation ([28968e2c0b](https://github.com/facebook/react-native/commit/28968e2c0ba23db9af12b47681f165d29d0f132d), [0a9e652bdd](https://github.com/facebook/react-native/commit/0a9e652bdd031d53d712e2e9610fb608bfa54ff1), [6627d7723c](https://github.com/facebook/react-native/commit/6627d7723c2df244ccc8a462bd98499cc11da2e2), and [d85da86dc7](https://github.com/facebook/react-native/commit/d85da86dc7c7833e71099c6a621547bc3cec8d4f), [a163f70f87](https://github.com/facebook/react-native/commit/a163f70f875dff4428eebd989bfaf28dda6551bf) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- Fix ReactLegacy and delete RCTViewControllerProtocol ([a0ff8c7706](https://github.com/facebook/react-native/commit/a0ff8c7706fc37bdce78c9ec51da320f78d16a24) by [@javache](https://github.com/javache)) +- Define internal FB macro for OSS builds; remove some unused definitions ([077c3ab349](https://github.com/facebook/react-native/commit/077c3ab34952f4b442abdd7a47ab54ca4bd0ba2e) and ([a6a66c5b39](https://github.com/facebook/react-native/commit/a6a66c5b3943443e4016f32407e4a4f8d707e387) by [@ttsugriy](https://github.com/ttsugriy)) +- RNTester: Relax Bridge Release Check ([e3c6f38773](https://github.com/facebook/react-native/commit/e3c6f38773d0b578794726033d4fabbfa48d1c7b) by [@yungsters](https://github.com/yungsters)) +- Remove embeddedBundleURL from the asset resolver ([489b98bf10](https://github.com/facebook/react-native/commit/489b98bf1006818ba985e93478a088c0e1e1aae7)) +- Do not set FB_ASSERTION_ENABLED ([4cdbb77c33](https://github.com/facebook/react-native/commit/4cdbb77c3363e120877ff66f39cdcf51d668df7d) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- JSBigString to MAP_PRIVATE not MAP_SHARED ([f9f40cd3e4](https://github.com/facebook/react-native/commit/f9f40cd3e486314cd75bda8722147f2f0f5b8fe1)) +- Fixed black ARTSurfaceView ([5c8481e836](https://github.com/facebook/react-native/commit/5c8481e83646b9cae482a803c878fb007f370035) by [@shergin](https://github.com/shergin)) +- Kill orphaned marker end in JSCExecutor ([6ad1f0957a](https://github.com/facebook/react-native/commit/6ad1f0957a020cb57b177ab015c17aa883e1f0ad) by [@michalgr](https://github.com/michalgr)) +- Make YGNode as c++ struct with properties exposed through accessors ([f1055bcac8](https://github.com/facebook/react-native/commit/f1055bcac8b580c40f9646687e7a950fb6864c74) by [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- 🔖 ...and now we're at 0.53.0-rc.0 🎁 ([0b996577e3](https://github.com/facebook/react-native/commit/0b996577e321d439aa6ede4c7400ea76efb7816a) by [@grabbou](https://github.com/grabbou)) + +## v0.52.0 + +> This changelog has been prepared by Ryan Turner (@turnrye) - thank you for +> your time and making such a detailed changelog 🔥🔥 + +This release had a lot of work around the bundler and packager, a ton of +bugfixes, and updates to many of React Native's dependencies. Lots of +under-the-hood work was done as well to improve the layout engine. Happy new +year! + +> If you would like to help us with the next release changelog, please contact +> @grabbou + +### Added + +- Prettier has a config and an npm script; try it out with `npm run prettier` + ([164591218f](https://github.com/facebook/react-native/commit/164591218f5fab7d386e057e0d51b9c1fe30b0a9) by + [@janicduplessis](https://github.com/janicduplessis)) +- **Debug JS in Nuclide** is now an option in the dev menu 🐜 + ([7c7108a1e8](https://github.com/facebook/react-native/commit/7c7108a1e8e9354d8aeb2f0ff712561d8aa19408) and + [de424cc291](https://github.com/facebook/react-native/commit/de424cc291523a8f4e3d33059b725d5b85f31611)) +- Introducing **PlatformOS** – it looks a lot like **Platform**, but with a + simplified API + ([5ee27ff755](https://github.com/facebook/react-native/commit/5ee27ff7552a5707a6e6bdb3f23e7378f978a2f7) by + [@brishin](https://github.com/brishin)) +- New experimental _RCTSurface_: measure and layout a UI in a thread-safe and + synchronous manner + ([be6976d6fa](https://github.com/facebook/react-native/commit/be6976d6faa333311405bd6184300bbd8da6cbca), + [7df58e23a3](https://github.com/facebook/react-native/commit/7df58e23a3a265b0df0edc753cc79a153fec90d8), + [e75bd87a76](https://github.com/facebook/react-native/commit/e75bd87a76726a9b075061ef76156705b3c1e872), + [aa83b5a0ca](https://github.com/facebook/react-native/commit/aa83b5a0ca30736b2800833bcc6149dcbe8436fa), + [081f7d14ad](https://github.com/facebook/react-native/commit/081f7d14aded077a7627404e5e2d48163a5707ad), + [da17b237e1](https://github.com/facebook/react-native/commit/da17b237e15e20adf20d6b917349d6389efb17fd), + [e9e0cd7ab8](https://github.com/facebook/react-native/commit/e9e0cd7ab86c98bcd3201e306e96532685d8de1d), + [43b2509320](https://github.com/facebook/react-native/commit/43b25093202472c5af07d4f393d831e4d1484b07), + [ba6075120a](https://github.com/facebook/react-native/commit/ba6075120af9c0086b449aafa7420913fa58f746), + [d71d28f094](https://github.com/facebook/react-native/commit/d71d28f09495a1e2802db169e2d0cd1ec5bd5973), + [4d37cf0fbc](https://github.com/facebook/react-native/commit/4d37cf0fbcc529ad75eb4a04a185036a887e42c2), and + [d021dd25da](https://github.com/facebook/react-native/commit/d021dd25da92d84c62c9a77049bb798e3b891447) by + [@maicki](https://github.com/maicki) and + [@shergin](https://github.com/shergin)) +- Experimental **SwipeableRow**'s datasource now has a `getLastRowID` method + ([d79e245d19](https://github.com/facebook/react-native/commit/d79e245d19f7f246322bc657b407198b15cb1b98)) +- [React Native monthly + #5](https://reactnative.dev/blog/2017/11/06/react-native-monthly-5.html) + was added ([3c5a55ddc2](https://github.com/facebook/react-native/commit/3c5a55ddc21197cfa013dc6222e398138759b5d3) + by [@tenodi](https://github.com/tenodi)) + +#### iOS Specific + +- **DatePickerIOS** now takes **locale** 🌍 + ([fd9c3618fc](https://github.com/facebook/react-native/commit/fd9c3618fcd3dc80f9abf3da779627704c7350e4) by + [@RobertPaul01](https://github.com/RobertPaul01)) +- **CameraRoll** can now **deletePhotos** 📸 + ([554e873f58](https://github.com/facebook/react-native/commit/554e873f585ea05ce1e9fe4ff71173c47b3c259c) by + [@fxfactorial](https://github.com/fxfactorial)) +- There's now an API to specify a different directory for iOS image assets + ([8f9b291224](https://github.com/facebook/react-native/commit/8f9b291224d1ca57a5f90200ec4687abb4706f4b)) +- Support for [custom accessibility + actions](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomaction) + on iOS ([36ad813899](https://github.com/facebook/react-native/commit/36ad8138997c195b8728906ceb51bd31338b6a24) by + [@ericdavmsft](https://github.com/ericdavmsft)) + +### Deprecated + +- Ignore YellowBox warnings with `YellowBox.ignoreWarnings([...])` rather than + `console.ignoredYellowBox = [...]` + ([26038f50bb](https://github.com/facebook/react-native/commit/26038f50bb003eec3770e2b66d428fbb739f1ce2) by + [@wli](https://github.com/wli)) + +### Changed + +- Metro-bundler is now metro, and it's v0.24.1; there were some performance + increases at the cost of a few breaking changes; improved tests of the bundler + too ([0bbd9f042a](https://github.com/facebook/react-native/commit/0bbd9f042a8ad7c7be094bd7636ca767c6f7b231), + [a2fd3fcef8](https://github.com/facebook/react-native/commit/a2fd3fcef84e916b36ef7753dff69b7c1b307890), + [503b4521a6](https://github.com/facebook/react-native/commit/503b4521a6ce6bb2282631df616440fa71416d25), + [654fed46f4](https://github.com/facebook/react-native/commit/654fed46f49b5002096ff55c2e8523af48b22c24), + [0091496891](https://github.com/facebook/react-native/commit/009149689119e180415f8138b2827366768fc1d3), + [aba148f733](https://github.com/facebook/react-native/commit/aba148f733e85a88d4be07b3b8ca37c43cf6a51e), + [3d5dc872a4](https://github.com/facebook/react-native/commit/3d5dc872a4eefa1557554b3b338227959d166370), + [48019a0c2a](https://github.com/facebook/react-native/commit/48019a0c2a9a45d51a4faab1d5bef52949f4b5c5), + [ecec4319c4](https://github.com/facebook/react-native/commit/ecec4319c4fda9bebc90216d5340442b2a5725df), + [f4d627c8fa](https://github.com/facebook/react-native/commit/f4d627c8faeb034eac8053fd253f17e42b85f2f2), + [f871d25eb4](https://github.com/facebook/react-native/commit/f871d25eb48dca224bb3796aa9cb5d714292662f), + [a7b231a327](https://github.com/facebook/react-native/commit/a7b231a3278e4fc2d7e4269ce106f22712f2e5a8), + [830b431453](https://github.com/facebook/react-native/commit/830b43145381e6e322569450affddba73f7dc2d1), + [29dafa1a86](https://github.com/facebook/react-native/commit/29dafa1a8644f7a537499074df334bab8da4ad00), + [7a5d5a4035](https://github.com/facebook/react-native/commit/7a5d5a40357bedfb24a01ff1160481656fda9554), + [4cd685a1e0](https://github.com/facebook/react-native/commit/4cd685a1e0a2ae07df02702dbf4702e407773df5), + [d326c86051](https://github.com/facebook/react-native/commit/d326c860519c5165c6e86fb4f3ce378ed055157c), + [231c7a0304](https://github.com/facebook/react-native/commit/231c7a03043b9fb3c4bf81251ad099bab0ba05c2), + [7d969a05de](https://github.com/facebook/react-native/commit/7d969a05de6a45543bc31a3b982828865bc57cdb), + [ae517307e7](https://github.com/facebook/react-native/commit/ae517307e76d977f813e5b880f3b7f42a20f461d), + [f587f8d51d](https://github.com/facebook/react-native/commit/f587f8d51dc57e6b9eb66edfbe58ee520a6cc568), + [fbf0aed3ac](https://github.com/facebook/react-native/commit/fbf0aed3acc056b5fd069af75fcae14246439a48), + [e9393f694d](https://github.com/facebook/react-native/commit/e9393f694d8f0d0190a3576fd65a65f747f8cce2), and + [968c88d141](https://github.com/facebook/react-native/commit/968c88d1410eac5b793345bacce6052f518fda8f) by + [@cpojer](https://github.com/cpojer), [@hramos](https://github.com/hramos), + [@jeanlauliac](https://github.com/jeanlauliac), and + [@rafeca](https://github.com/rafeca) + ) +- React is now v16.2.0, and it took react-test-renderer along with it; [now with + more + fragments!](https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html) + 🎉 ([c7f37074ac](https://github.com/facebook/react-native/commit/c7f37074ac89f7e568ca26a6bad3bdb02812c39f) and + [cd938d731c](https://github.com/facebook/react-native/commit/cd938d731c7531a683c050cd829a543d145e3dc1) by + [@bvaughn](https://github.com/bvaughn)) +- Jest is now v21.3.0-beta.13 + ([16bbd908e7](https://github.com/facebook/react-native/commit/16bbd908e72577e7d109397916323a0eeffce8d4) and + [ec2ea58e57](https://github.com/facebook/react-native/commit/ec2ea58e57872bfa077d9c9a5e1e8b253c6b37b3) by + [@mjesun](https://github.com/mjesun)) +- Flow is now v0.61.0, and there were a ton of Flow fixes/coverage improvements + made ([914ae93336](https://github.com/facebook/react-native/commit/914ae9333678df4888e3c72898991c8430625cce), + [eb0d6470e5](https://github.com/facebook/react-native/commit/eb0d6470e54663538610a70ab0bae9847eb33673), + [c8e72bb8b8](https://github.com/facebook/react-native/commit/c8e72bb8b8317bcdcb4fe2ff85978c7db70f4461), + [2d4bedba0f](https://github.com/facebook/react-native/commit/2d4bedba0f6a8f2cfe597a1044822eb635d5e243), + [e0202e459f](https://github.com/facebook/react-native/commit/e0202e459fd0181db551d0025ef562d7998186b0), + [2be3ae1ff2](https://github.com/facebook/react-native/commit/2be3ae1ff2441c0ee3f2b9255c23dc49ada852fe), + [22a1419900](https://github.com/facebook/react-native/commit/22a14199000ea994f24f6fe387ea26647af3c128), + [6ae0b344e5](https://github.com/facebook/react-native/commit/6ae0b344e5c221657287d1fc1511be520a6f6e58), + [76a2ca4c9c](https://github.com/facebook/react-native/commit/76a2ca4c9c09c9bdf922154c28040138a44ae672), + [3259353fce](https://github.com/facebook/react-native/commit/3259353fcec0dd9ea66de750a694c226f99f483d), + [e6c1fb7212](https://github.com/facebook/react-native/commit/e6c1fb72128fb13436028c2df9cdccf6ccfccb67), + [61d046be3c](https://github.com/facebook/react-native/commit/61d046be3c9b00f6a4d4f492d558a961a6d4210f), + [820cfa1f3b](https://github.com/facebook/react-native/commit/820cfa1f3b79406e47cb873773cadafefe0effb1), + [240039c6f2](https://github.com/facebook/react-native/commit/240039c6f2d8db700ebc15404b0acc2a49068249), + [343c5a97a0](https://github.com/facebook/react-native/commit/343c5a97a013669745cf3938728539001d3076e6), + [5f8d8e90c2](https://github.com/facebook/react-native/commit/5f8d8e90c2c43127b8a5d2fc5d18f16185c7a67e), and + [da047966e4](https://github.com/facebook/react-native/commit/da047966e4c2064a48e02ff74830c99808d8194b) by + [@Ashoat](https://github.com/Ashoat), + [@calebmer](https://github.com/calebmer), + [@cdlewis](https://github.com/cdlewis), + [@deecewan](https://github.com/deecewan), + [@grabbou](https://github.com/grabbou), + [@jamesisaac](https://github.com/jamesisaac), + [@mroch](https://github.com/mroch), [@nmn](https://github.com/nmn), + [@nmote](https://github.com/nmote), [@sahrens](https://github.com/sahrens), + [@samwgoldman](https://github.com/samwgoldman), + [@TheSavior](https://github.com/TheSavior), and others) +- react-devtools-core is now v3.0.0 + ([a7d46ea970](https://github.com/facebook/react-native/commit/a7d46ea97012bdcc644e3397bbf60bd3cb37e9eb) by + [@rsnara](https://github.com/rsnara)) +- Split out docs to [their own + repo](https://github.com/facebook/react-native-website/tree/master/docs) (and + a few formatting fixes along the journey) 👋 + ([2d86618e7e](https://github.com/facebook/react-native/commit/2d86618e7ef477cdfc2ed510c7bc05d41dbfe972), + [64d80b13db](https://github.com/facebook/react-native/commit/64d80b13db3dd28bb5d93cbedf511ae8f91e2127), + [3362da421c](https://github.com/facebook/react-native/commit/3362da421ce919fc6f4f1bda29b59e2e3bfe02de), + [75123c614b](https://github.com/facebook/react-native/commit/75123c614bb5a61c383cdc247230b3a76c76e14d), and + [79e24ede40](https://github.com/facebook/react-native/commit/79e24ede40b2508aaa77b8ff3876d3dbf4cfe6d8) by + [@hramos](https://github.com/hramos)). +- **TouchableHighlight** now has a default delayPressOut value of 100; it was + also refactored a bit for style + ([9a31fa5fd6](https://github.com/facebook/react-native/commit/9a31fa5fd62fa101b2a76c69b56248d7f5ba9876) by + [@sahrens](https://github.com/sahrens)) +- When in a dev build, more robustly validate arguments for native methods + ([ea2e2c54cb](https://github.com/facebook/react-native/commit/ea2e2c54cb4d1a99b41aaa98eaf51696d34770dd) by + [@mhorowitz](https://github.com/mhorowitz)) +- On integration tests, report _all_ errors + ([3bcb912786](https://github.com/facebook/react-native/commit/3bcb9127866ef60b3697553e98a3ae279d02290a) by + [@sahrens](https://github.com/sahrens)) +- Yoga has less technical debt, thanks to replacing _YGNodeList_ with vectors + ([b08a912f11](https://github.com/facebook/react-native/commit/b08a912f11c729f3fe76700c6614f9e6165ae1a1) by + [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- Yoga is now cpp, compiled as _c++1y_ + ([d7ab9496bc](https://github.com/facebook/react-native/commit/d7ab9496bc95f7b720fd6db1ed503af1c461e84d) by + [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar)) +- Bundle segments are handled better and used more + ([681278947e](https://github.com/facebook/react-native/commit/681278947eb4039a1d7a65f1edfeef25ae055a4f), + [a47431ed74](https://github.com/facebook/react-native/commit/a47431ed74f0b7b2a03ca48e84f2243d08ef3bdd), + [963c61d4d5](https://github.com/facebook/react-native/commit/963c61d4d546c94b689281ca1f5105ad050e10ff), + [b9f21dc2be](https://github.com/facebook/react-native/commit/b9f21dc2be14cd51543e6b2d1e63a861e5f433d1), + [f1258181ee](https://github.com/facebook/react-native/commit/f1258181eec84f73651d2fabd0d23764b8990ff8), and + [1988ba1d79](https://github.com/facebook/react-native/commit/1988ba1d7967dca04376e7e631e8910e5e79a6a7) by + [@fromcelticpark](https://github.com/fromcelticpark) and + [@jeanlauliac](https://github.com/jeanlauliac)) +- _packager-worker-for-buck_ has better tests + ([7fd5aa84a1](https://github.com/facebook/react-native/commit/7fd5aa84a1ef1744d01e7e877183b1f004216d00) by + [@jeanlauliac](https://github.com/jeanlauliac)) +- _RCTUIManager_ has less technical debt + ([46be5bf71c](https://github.com/facebook/react-native/commit/46be5bf71c78d33cda5cb496c475dcfb8e229346), + [60dc9bed00](https://github.com/facebook/react-native/commit/60dc9bed00cc13652752bf84f83c920ce66d5e39), and + [21714fe197](https://github.com/facebook/react-native/commit/21714fe1979ccbd62d665f383625f4ece8cf888e) by + [@shergin](https://github.com/shergin)) +- Numerous bridge changes, especially around URL resolution + ([e7bd0f056b](https://github.com/facebook/react-native/commit/e7bd0f056bf4edca1f0529d6eed03bbaaaca586a), + [260e6d2355](https://github.com/facebook/react-native/commit/260e6d23554a8e7f1743263894c9ca9a0cfbf01e), + [4894ac430d](https://github.com/facebook/react-native/commit/4894ac430d6df1118ce48f644fd8cf5bfce6344f), + [b983de9c54](https://github.com/facebook/react-native/commit/b983de9c5460e24c95a9a67f02695cd1c5f31bc5), + [b0193b098c](https://github.com/facebook/react-native/commit/b0193b098cdbd915bba90e1ab0b695ba44346f44), + [ae5ef653cb](https://github.com/facebook/react-native/commit/ae5ef653cbc4c03fe5edb5d4b0002e38cbb6f458), and + [1d6ce2311f](https://github.com/facebook/react-native/commit/1d6ce2311f6a51821b33c5473414d70c8bd34425) by + [@fromcelticpark](https://github.com/fromcelticpark) and others) +- Various cleanup and refactoring + ([053776338e](https://github.com/facebook/react-native/commit/053776338ea44c31f3671cb4502853da0c88e55a), + [0984f29a32](https://github.com/facebook/react-native/commit/0984f29a320ce7e40e8bc2a6c78b080908fa1384), + [6c70975689](https://github.com/facebook/react-native/commit/6c70975689d0f0839e6c2db9a9a25c3023f5be7b), + [d950dc6a21](https://github.com/facebook/react-native/commit/d950dc6a21c5cc1e736993b2ecc16abae086389e), + [70c359000a](https://github.com/facebook/react-native/commit/70c359000a2df091c3939f4c19db6024af992d43), + [cfa2bbf2f6](https://github.com/facebook/react-native/commit/cfa2bbf2f692d0bc5600d7e369a9a91272930ca6), and + [850efa8650](https://github.com/facebook/react-native/commit/850efa86508b19d800ff8cbdc725402c006db1a2) by + [@bnham](https://github.com/bnham), + [@priteshrnandgaonkar](https://github.com/priteshrnandgaonkar), and others) +- Jest preprocessing now uses the AST from metro + ([2ae255a6ea](https://github.com/facebook/react-native/commit/2ae255a6eaf820992bdf19799bb4403f3bbdcd5b) and + [d5b59517c2](https://github.com/facebook/react-native/commit/d5b59517c274874d7ce21e5c26d28b42ae389723) by + [@rafeca](https://github.com/rafeca)) +- `renderApplication()` now supports async initial render + ([1b22d49ae8](https://github.com/facebook/react-native/commit/1b22d49ae8945680dee4fd01e3fbb78b1e443e01) by + [@bvaughn](https://github.com/bvaughn)) +- Welcome [@lwinkyawmyat](https://github.com/lwinkyawmyat) to the React Native + GitHub Issue Task Force + ([4ebe76d559](https://github.com/facebook/react-native/commit/4ebe76d5598621160ffcf3ea8bc87c3ad1c1a2f8) by + [@lwinkyawmyat](https://github.com/lwinkyawmyat)) + +#### Android exclusive changes + +- Native components on Android register lazily rather than via ViewManager + ([1b71e03932](https://github.com/facebook/react-native/commit/1b71e03932f44e212b297b2c1e02100b6de74b93)) +- Android debug overlays (like **RedBox**, dev menu, loading) are no longer are + system overlays; they're now part of the _currentActivity_ + ([d19afc73f5](https://github.com/facebook/react-native/commit/d19afc73f5048f81656d0b4424232ce6d69a6368) by + [@kmagiera](https://github.com/kmagiera)) + +#### iOS exclusive changes + +- Improve iOS's _accessibilityLabel_ performance by up to 20% 📈 + ([19b0a65c5e](https://github.com/facebook/react-native/commit/19b0a65c5ecc4f41fea98a1e752785d6dbb6ea05) by + [@chendo](https://github.com/chendo)) + +### Fixed + +- Fix `backgroundColor` on **TouchableHighlight** + ([5a1171ebfa](https://github.com/facebook/react-native/commit/5a1171ebfaaedd9c7d5f1bfcf306049c3671a733) by + [@sahrens](https://github.com/sahrens)) +- Various corrections in messages, comments, and docblocks + ([58c3bc4901](https://github.com/facebook/react-native/commit/58c3bc490143b8d7831a00289e2565f49f5389ef), + [354e1cb508](https://github.com/facebook/react-native/commit/354e1cb5088a43fd4116504a34a65ca53c4de71b), + [58edf024a1](https://github.com/facebook/react-native/commit/58edf024a1ed3a71ef04f124546ee97496b6502f), + [b9e7006cc6](https://github.com/facebook/react-native/commit/b9e7006cc6dc2b0801ea0c776ba00cdea2204151), + [d2f0abdf4e](https://github.com/facebook/react-native/commit/d2f0abdf4ea94fbb3e2a5c7fb53ff5d1cf6abede), + [94cd9f5591](https://github.com/facebook/react-native/commit/94cd9f55915973355cdb63276b71f90df10281db), + [8547b7e111](https://github.com/facebook/react-native/commit/8547b7e11163d545b7b99d4bdd063ef71129d62c), + [44c16499fd](https://github.com/facebook/react-native/commit/44c16499fdc4665298f6c88b9ffee626fa1fc969), + [c91d87213e](https://github.com/facebook/react-native/commit/c91d87213e6862019b9ef7df7c38551bd6d659fd), + [85503a0612](https://github.com/facebook/react-native/commit/85503a0612b0c74b4d204e8748e9ed7010d838e4), and + [5b83dbe25a](https://github.com/facebook/react-native/commit/5b83dbe25af151d183009006b1fe323b2658d025) by + [@behrends](https://github.com/behrends), + [@bvaughn](https://github.com/bvaughn), + [@charpeni](https://github.com/charpeni), + [@dsandmark](https://github.com/dsandmark), + [@gusgard](https://github.com/gusgard), + [@nkabrown](https://github.com/nkabrown), + [@petterh](https://github.com/petterh), [@solon](https://github.com/solon), + [@swashcap](https://github.com/swashcap), and others) +- Various dev doc and project doc fixes for correctness and completeness + ([92c0980540](https://github.com/facebook/react-native/commit/92c0980540dde0053bad05fae6414cf8275a71b1), + [3c9092acf3](https://github.com/facebook/react-native/commit/3c9092acf39ecdb7c137a3cb0d4282694e95cbf5), + [e906525e84](https://github.com/facebook/react-native/commit/e906525e84f69a98de4d06ed1ec4c43d8589e350), + [60828566a7](https://github.com/facebook/react-native/commit/60828566a759dc579dbae1d76a8426e1e479166e), + [c49b97c4ef](https://github.com/facebook/react-native/commit/c49b97c4ef65a6351af437ef28033cb31ea0446f), + [45ed142596](https://github.com/facebook/react-native/commit/45ed14259677cff4cbd133e705ec4f0ec84bc216), + [cb6ec7c321](https://github.com/facebook/react-native/commit/cb6ec7c32141ef5bdde837d7f9d71b7adb83b751), + [9ec9567390](https://github.com/facebook/react-native/commit/9ec95673909beac7798f589e0e9821b4225f8fa9), + [e5a4ea97d9](https://github.com/facebook/react-native/commit/e5a4ea97d9e1b13509a3f36d0b469a6a88a90dc4), + [c544c0d2dc](https://github.com/facebook/react-native/commit/c544c0d2dca1d0e9f0b2a5565e03676ad71a36f5), + [33d5e5bd5a](https://github.com/facebook/react-native/commit/33d5e5bd5a5365ab712a2b9d33f33cbec305e128), + [95dac8db60](https://github.com/facebook/react-native/commit/95dac8db601ba48fe03da52e1adbdef0cac23546), + [6e1db1f1ee](https://github.com/facebook/react-native/commit/6e1db1f1ee263c3a8b68c3e1584e79ae86d5be86), + [e11d496e9d](https://github.com/facebook/react-native/commit/e11d496e9d907abb5bf58a8300c5a8f85aa03bbb), + [6da897945f](https://github.com/facebook/react-native/commit/6da897945f823728dbc82dd9f01c672354b1e76d), + [0ff576081b](https://github.com/facebook/react-native/commit/0ff576081b156ea26c4e7886f7266f3e4d8e3d5e), + [1ee64ccb8a](https://github.com/facebook/react-native/commit/1ee64ccb8a257210be3a74fb9b0adc83f2a8bb2b), + [3aa38564f7](https://github.com/facebook/react-native/commit/3aa38564f7b91c8588c8484140bc4221d50d55e0), + [6b26971a56](https://github.com/facebook/react-native/commit/6b26971a56fdd919d11cc338893d0b7a3f7a45ba), and + [de3976a486](https://github.com/facebook/react-native/commit/de3976a48655a248a2417fcf2d3a511be02e1996) by + [@adrianomelo](https://github.com/adrianomelo), + [@blargity](https://github.com/blargity), + [@charpeni](https://github.com/charpeni), + [@garlic-rice-with-butter](https://github.com/garlic-rice-with-butter), + [@gwmccull](https://github.com/gwmccull), + [@harikrishnanp](https://github.com/harikrishnanp), + [@hramos](https://github.com/hramos), + [@johnthewilson](https://github.com/johnthewilson), + [@jsdario](https://github.com/jsdario), [@kelset](https://github.com/kelset), + [@patrickkempff](https://github.com/patrickkempff), + [@ryanml](https://github.com/ryanml), + [@tiagomoraismorgado88](https://github.com/tiagomoraismorgado88), + [@timwangdev](https://github.com/timwangdev), and others) +- Stop `RCTRefreshControl` from jumping around + ([2e1707d0e6](https://github.com/facebook/react-native/commit/2e1707d0e600a30057511390dd87c18c00f19a59) by + [@sophiebits](https://github.com/sophiebits)) +- Fix a race condition in the animation module + ([515eb0e801](https://github.com/facebook/react-native/commit/515eb0e8012a7a8f085a8e410c6c694011fd8c1d) by + [@mhorowitz](https://github.com/mhorowitz)) +- Fix Windows local-cli's to not wrongfully identify as globally installed + ([ca106043fc](https://github.com/facebook/react-native/commit/ca106043fc655a1c51332aedf9b001a512269550) by + [@sballew](https://github.com/sballew)) +- Fix Jest mocks for **NetInfo**, **Dimensions**, and **ScrollView** modules + ([7fb3a9229d](https://github.com/facebook/react-native/commit/7fb3a9229df52bd45076470d059f245a8147cd2a), + [11a2a35c63](https://github.com/facebook/react-native/commit/11a2a35c63ae68de46482f5cd25271f8b0fb5ad4), and + [0c8a3e4f79](https://github.com/facebook/react-native/commit/0c8a3e4f797563c99e988ec2f42ec2a618a8b196) by + [@alvaromb](https://github.com/alvaromb), + [@timwangdev](https://github.com/timwangdev), and + [@uk-ar](https://github.com/uk-ar)) +- packager-worker-for-buck: `transformCommand`: add missing test + ([73a01be9bc](https://github.com/facebook/react-native/commit/73a01be9bcd9059f3172987fd30d8b6dc0125759) by + [@jeanlauliac](https://github.com/jeanlauliac)) +- Fixed issue where CLI wasn't following the config value for postMinifyProcess + when its running with `dev=false` + ([6d92046c56](https://github.com/facebook/react-native/commit/6d92046c56794a6a62bc07598545a23a7b53cdc0) by + [@rafeca](https://github.com/rafeca)) +- Fix asset resolver url handling + ([28d5d6baf1](https://github.com/facebook/react-native/commit/28d5d6baf1e6ac52e8672a653f56c3898e4e11d2) by + [@fkgozali](https://github.com/fkgozali)) +- Fix crash when destroying catalyst + ([f1015664e9](https://github.com/facebook/react-native/commit/f1015664e92f02c33417a591a2438db7c0cd3811)) +- You can now `justifyContent` while you're `minWidth`ing and `marginLeft`ing; + before the justification wasn't honored + ([f5becebc07](https://github.com/facebook/react-native/commit/f5becebc0710d5bb875bb9c0a2d3809a00f62605) by + [@woehrl01](https://github.com/woehrl01)) +- `marginLeft: auto` and `alignItem: stretch` now play nicely together; before + the width and height ended up incorrect + ([5f99b1a55f](https://github.com/facebook/react-native/commit/5f99b1a55f4002c105a7005cabf720aad422b628) by + [@woehrl01](https://github.com/woehrl01)) +- Fix assertion preventing YGNodeLayoutGet\* with YGEdgeEnd + ([a383b8ca05](https://github.com/facebook/react-native/commit/a383b8ca0545ba3704a51a78972107119f5683c0) by + [@justjake](https://github.com/justjake)) +- Fix shrinking in non-strech alignments + ([1d62848535](https://github.com/facebook/react-native/commit/1d6284853514be4da2b68d45732386eb81cc4253) by + [@woehrl01](https://github.com/woehrl01)) +- Correctly calculate min/max percentage constraints + ([4fdaf2de98](https://github.com/facebook/react-native/commit/4fdaf2de989c039a62681cc1f7a8407ec32b593e) by + [@woehrl01](https://github.com/woehrl01)) +- When running `react-native-git-upgrade`, don't execute git's hooks + ([0182086350](https://github.com/facebook/react-native/commit/018208635069311c1a7c7776c6f359f7ded45362) by + [@adrienthiery](https://github.com/adrienthiery)) +- When running `react-native-git-upgrade` and failing with a signal, return that + to the terminal + ([b9a5862f67](https://github.com/facebook/react-native/commit/b9a5862f670f52d48f1d3789c3f08ec139368da4) by + [@mateusz-](https://github.com/mateusz-)) +- In **KeyboardAvoidingView**, don't mistakenly try to layout when a hardware + keyboard changes + ([ad4450ac13](https://github.com/facebook/react-native/commit/ad4450ac1364710f052a927ceda7ae353440f682) by + [@koenpunt](https://github.com/koenpunt)) +- Don't endlessly collect websockets when not connected to the packager (dev + memory leak) + ([1e1e491246](https://github.com/facebook/react-native/commit/1e1e49124678f447d980bb22891d25db60fa83b3) by + [@mmmulani](https://github.com/mmmulani)) +- Fixed a bug in the sample project random `selection` prop that made it + not-so-random + ([766f020e68](https://github.com/facebook/react-native/commit/766f020e68abfc121ea6a9f92e0640368d69dae7) by + [@rozele](https://github.com/rozele)) + +#### Android exclusive fixes + +- Explicitly `#define isnan __builtin_isnan` for Android _clang-5_ to mimic + **gcc**'s default behavior + ([f8fe6b0c70](https://github.com/facebook/react-native/commit/f8fe6b0c70d1b7b626d05d9675c16b2f89339e8c)) +- Correctly update **NetInfo** on Android even if connection types change while + the app is in the background + ([e6f542d620](https://github.com/facebook/react-native/commit/e6f542d62037e9830c0ae5749a32874c44cf2334) by + [@berickson1](https://github.com/berickson1)) +- Direction-aware borders now work with Android APIs >= 17 + ([7170543e80](https://github.com/facebook/react-native/commit/7170543e8012250b7643a960b54cce7fd6d3a1e9) by + [@rsnara](https://github.com/rsnara)) +- Don't throw _BadTokenException_ and _IllegalArgmentException_ when showing or + dismissing Modal on Android + ([e57a43b97a](https://github.com/facebook/react-native/commit/e57a43b97ad24dc5b993753a45aa575b2a757b4f)) +- Fix Android crash when blurRadius is between 0 and 1 + ([dc01eff72d](https://github.com/facebook/react-native/commit/dc01eff72d23e1dd3f7ecf30859992ee3bf7c664) by + [@jamesreggio](https://github.com/jamesreggio)) +- Fix `borderRadius` with Android API level < 18 + ([5aa1fb3ff3](https://github.com/facebook/react-native/commit/5aa1fb3ff326a429e33a443576da866f2a63c20c) and + [ca7fe72c31](https://github.com/facebook/react-native/commit/ca7fe72c31fd7c7cbe4734118019f5808235560e) by + [@rsnara](https://github.com/rsnara)) +- Make Android `lineHeight` behavior match iOS's 📏 + ([3f1b021506](https://github.com/facebook/react-native/commit/3f1b0215060e4c27c286359cc90f3b2189956c4e)) +- Fixed autoscroll to cursor on Android **TextInput** + ([0bef872f3f](https://github.com/facebook/react-native/commit/0bef872f3fc8b1cd78c574d03eacc886bef4e239) by + [@shergin](https://github.com/shergin)) +- Fix logging unpacking time on Android when it happens concurrently with eager + unpacking ([028b64bcd3](https://github.com/facebook/react-native/commit/028b64bcd36c1c8dd76c0de95eeff80cf660aa23) + by [@alexeylang](https://github.com/alexeylang)) +- Prevent an Android crash when **TextInput** has `selectionColor` defined but + there is no drawable cursor + ([1e18d907bf](https://github.com/facebook/react-native/commit/1e18d907bfb8cc5f4f2e1a1ede0dd98aec40ab11) by + [@gpeal](https://github.com/gpeal)) + +#### iOS exclusive fixes + +- Don't have Xcode warnings for _YGDefaultLog_ in newly created projects + ([72e762d4bc](https://github.com/facebook/react-native/commit/72e762d4bca8d00cc2c73c390a654ae6143731bd) by + [@woehrl01](https://github.com/woehrl01)) +- iOS _RCTEventEmitter_ uses a `double` for count, not _NSInteger_ + ([eaa84997ce](https://github.com/facebook/react-native/commit/eaa84997cedc8dc4d46308e2217d2b094a51ed02)) +- Fix `isNuclideDebuggingAvailable` on iOS + ([59c3e33f63](https://github.com/facebook/react-native/commit/59c3e33f637d11e33204e8a912e98459ffad7fab)) +- iOS ScrollView is now rendered correctly with RefreshControl + ([75d62bf0a8](https://github.com/facebook/react-native/commit/75d62bf0a802b91a979d03ef497e84c3179e7767) by + [@vonovak](https://github.com/vonovak)) +- Fix a crash when keyboard is visible and bridge reload happens on iOS + ([d9c658566a](https://github.com/facebook/react-native/commit/d9c658566a14ce8767d87435264997aa18dd08e4) by + [@fromcelticpark](https://github.com/fromcelticpark)) +- **RedBox** now appears beneath the status bar on iOS + ([33cefc1760](https://github.com/facebook/react-native/commit/33cefc176096e03a4b3c3130a70abfabe9d40f38) by + [@adamjernst](https://github.com/adamjernst)) +- Fractional border widths on iOS are now the right size, honoring insets + ([15179f1798](https://github.com/facebook/react-native/commit/15179f1798b277c1836441fcf7f3b7f0bd5a4636) by + [@Nikita2k](https://github.com/Nikita2k)) +- Implement `requiresMainQueueSetup` in _RCTTVNavigationEventEmitter_ to satisfy + Xcode warning + ([ee3532b5c2](https://github.com/facebook/react-native/commit/ee3532b5c266d5ee7fb12920cb611a41b1daf750) by + [@charpeni](https://github.com/charpeni)) +- Support the iPhone X in the sample project's header + ([ad4b124aa1](https://github.com/facebook/react-native/commit/ad4b124aa117483b4a0ec9dfa145b8e9a17f06c6) by + [@vincentriemer](https://github.com/vincentriemer)) +- `testID` works on **TabBarItem** on iOS + ([e19d9dec9b](https://github.com/facebook/react-native/commit/e19d9dec9b3b257b5db3dc77ed8b95b93570f1e3)) +- On iOS, don't error on the first live-reload of large codebases because of too + little wait time + ([b6f1a6085f](https://github.com/facebook/react-native/commit/b6f1a6085f7470c16ae8850e7da8f4f9ae5c23ee) by + [@lelandrichardson](https://github.com/lelandrichardson)) +- Prevent iOS crash on receiving bad unicode in _XMLHTTPRequest_ + ([1c04ceeb4b](https://github.com/facebook/react-native/commit/1c04ceeb4ba954eee7ab34fc5b6c660d9772d9f6) by + [@cdlewis](https://github.com/cdlewis)) +- Define `pod_target_xcconfig` for PrivateDatabase + ([38b96cd7bb](https://github.com/facebook/react-native/commit/38b96cd7bb391f64066a6c91daa4173db1f33445) by + [@ide](https://github.com/ide)) +- Fixed podspec include/excludes around tvOS + ([ba1d7e92e4](https://github.com/facebook/react-native/commit/ba1d7e92e4f251b90a96be192214b5015cf6244e) by + [@yygene](https://github.com/yygene)) +- Don't spam the logs for iOS when receiving `ECONNREFUSED` on connecting to + packager ([b1701ccaef](https://github.com/facebook/react-native/commit/b1701ccaefa0c8cbb6d820b2ad07e0d911027d7c) + and [ff3dc2ed19](https://github.com/facebook/react-native/commit/ff3dc2ed19cdd4137ae8092599b16c09d4e2c711) by + [@adamjernst](https://github.com/adamjernst)) +- Don't crash Systrace when debugging JS remotely on iOS + ([e8eec24706](https://github.com/facebook/react-native/commit/e8eec24706e792314ee574bbf7f7c0066c4f3a7a) by + [@alexeylang](https://github.com/alexeylang)) + +### Removed + +- Removing `reactBridgeDidFinishTransaction` from _RCTScrollView_ + ([a255204e3e](https://github.com/facebook/react-native/commit/a255204e3e7fddefd2d7b0de224101768757ca7a) by + [@shergin](https://github.com/shergin)) +- Removing inherited background color optimization from _RCTText_ to reduce code + complexity – please give feedback if you find performance differences! + ([8c8944c10f](https://github.com/facebook/react-native/commit/8c8944c10fb7dc30ea99657225f25ea438cf6e14) by + [@shergin](https://github.com/shergin)) + +### Other + +Below is a list of the remaining, low-level changes that made it into this +release of React Native. + +- Foundational work for a new justifyContent value **space-evenly** + ([1050e0b476](https://github.com/facebook/react-native/commit/1050e0b47611602b758f73d99f51a1dd5ceabade) by + [@woehrl01](https://github.com/woehrl01)) +- Add Systrace-based telemetry to Hermes GC + ([05e862d48d](https://github.com/facebook/react-native/commit/05e862d48d363a8af765b2f0283569419dbd2e5c)) +- Unify Systrace native hook argument passing + ([52e3ae9063](https://github.com/facebook/react-native/commit/52e3ae9063705bac53bad99ffe23976c29c8f1b2) by + [@amnn](https://github.com/amnn)) +- Use different symbols for SystraceSection depending on `WITH_FBYSTRACE` + ([03956c4ecf](https://github.com/facebook/react-native/commit/03956c4ecfda381396336f725ea1c12d913df17d)) +- Don't set global.performance to undefined if it was initialized already + ([dfebcb70a5](https://github.com/facebook/react-native/commit/dfebcb70a5c948db94d1cd580bbcaa0aaa702349) by + [@alexeylang](https://github.com/alexeylang)) +- Autofixes for migrating to Buck's source-only ABI feature + ([801cbdb047](https://github.com/facebook/react-native/commit/801cbdb04788403cee022dec688136540da36fc5) by + [@jkeljo](https://github.com/jkeljo)) +- Add remote API to uninstall the global error handler in RN + ([1d16923063](https://github.com/facebook/react-native/commit/1d16923063940606dda89de94a83cbdf5f98e1f1)) +- Add _RCTLibraryPathForURL_ in _RCTUtil_ + ([2fecbf6171](https://github.com/facebook/react-native/commit/2fecbf61711f610124fc2453a79120932024f613)) +- Fix sections that come from React Fiber + ([1f40c95076](https://github.com/facebook/react-native/commit/1f40c95076297258a4194fd9c1b5af7002187c99) by + [@alexeylang](https://github.com/alexeylang)) +- Fix boolean conversion in sync RN method calls. + ([dd888d3346](https://github.com/facebook/react-native/commit/dd888d3346ef9477eae2cd2d29cef867467cb503)) +- Fix `embeddedBundleURL` update situation + ([d1fc8ef3a3](https://github.com/facebook/react-native/commit/d1fc8ef3a3cb3590b9cff4d1b3cc5d440b52ec8c)) +- Remove `android_react_native_perf.use_separate_ui_bg_thread` experiment. + ([4f886a29a1](https://github.com/facebook/react-native/commit/4f886a29a1234c967deae2354bbc5092e0e6595e)) +- ScrollView related files were moved to dedicated folder + ([098a63a1ce](https://github.com/facebook/react-native/commit/098a63a1cee1196a2f3eb5135eeb8fe59e7e8272) by + [@shergin](https://github.com/shergin)) +- move page registration logic in to jsinspector + ([bef7967f9a](https://github.com/facebook/react-native/commit/bef7967f9a485dc136d2cb32f552b2199ae3e2b8) by + [@bnham](https://github.com/bnham)) +- Type global hooks as function pointers + ([eca51eb46a](https://github.com/facebook/react-native/commit/eca51eb46a47112c8933d0a3b932f59008cadc78) by + [@johnislarry](https://github.com/johnislarry)) +- `std::string` to `const char*` + ([b952365ba6](https://github.com/facebook/react-native/commit/b952365ba6bd86f0e80a24aedec1f447cb3ec566) by + [@johnislarry](https://github.com/johnislarry)) +- Allow extending props supported by native animations + ([71751e9cc7](https://github.com/facebook/react-native/commit/71751e9cc7c67306ca038c5b254e6e81fe0aff1b) by + [@andrewimm](https://github.com/andrewimm)) +- Meyers singleton jsc error extractor + ([434f432d5d](https://github.com/facebook/react-native/commit/434f432d5d5ea2756c1adac8b1c36e82e60a2b13) by + [@johnislarry](https://github.com/johnislarry)) +- Do not overwrite the same text in **TextInput** + ([29f3f55298](https://github.com/facebook/react-native/commit/29f3f5529827579101f0d8bd6afe72f1cb0caeca)) +- Renaming _uiManagerWillFlushUIBlocks_ -> _uiManagerWillPerformMounting_ + ([0a8721c340](https://github.com/facebook/react-native/commit/0a8721c340480a972bb597cacdbddd9eb2015716) by + [@shergin](https://github.com/shergin)) +- Skylarkify flags macros. + ([ed2bfcb35a](https://github.com/facebook/react-native/commit/ed2bfcb35a2756eb700882ab8e21b6b273efa80a) by + [@ttsugriy](https://github.com/ttsugriy)) +- Skylarkify `config_utils_defs` macros. + ([88f6f69152](https://github.com/facebook/react-native/commit/88f6f69152e4b68609f28e80ee70705969529af8) by + [@ttsugriy](https://github.com/ttsugriy)) +- Round size geometry for Button and RichText components. + ([4034febb7e](https://github.com/facebook/react-native/commit/4034febb7ef9d9daa894a75b038226af74026163) by + [@iaroslav-pavlov](https://github.com/iaroslav-pavlov) +- Temporarily patched Map/Set non-extensible check into RN dev renderer + ([a99f0d6100](https://github.com/facebook/react-native/commit/a99f0d6100c9779f5f6df6008af54c06113355f6) by + [@bvaughn](https://github.com/bvaughn)) +- Run buildifier over all BUCK files + ([d674d48a7b](https://github.com/facebook/react-native/commit/d674d48a7b9b71169af59ceb886529371c26a2e5) by + [@zertosh](https://github.com/zertosh)) +- Pass `scriptURL` to _RCTTestRunner_ + ([266ab7a006](https://github.com/facebook/react-native/commit/266ab7a0061c11c4da7ccde9e0d461c0d7331563)) +- Make _RCTNativeModule::invokeInner_ explicitely return `folly::none` in case + of error ([0ac5a5230c](https://github.com/facebook/react-native/commit/0ac5a5230c4b5dd44db6a8dd7bb7752aff64d71c) + by [@fromcelticpark](https://github.com/fromcelticpark)) +- Make _RCTPackagerConnection_ a singleton + ([9180d4eb82](https://github.com/facebook/react-native/commit/9180d4eb82fb70a0fd396b15660c2ac6770183c9) by + [@adamjernst](https://github.com/adamjernst)) +- Register split segment paths with _RAMBundleRegistry_ + ([cff0d8e0e5](https://github.com/facebook/react-native/commit/cff0d8e0e599d1ab21b36779b41fbb26512874aa) by + [@fromcelticpark](https://github.com/fromcelticpark)) +- check if listener is still in the set before calling `onHostResume` + ([ad89ea7b50](https://github.com/facebook/react-native/commit/ad89ea7b5046c2cf9ca1cba88c387eb1db8dc042)) +- export _SeparatorsObj_ type for re-use in **ListItem**s etc. + ([c6fe101cdc](https://github.com/facebook/react-native/commit/c6fe101cdcc0b8d640a86108d8a76f7292b5f799) by + [@sahrens](https://github.com/sahrens)) +- Do not mark node as dirty if, new and old values are undefined + ([41da6e3128](https://github.com/facebook/react-native/commit/41da6e31284d46bb1dd2053c3c3100c075ace019) by + [@woehrl01](https://github.com/woehrl01)) +- Remove _RAMBundleRegistry_ subclasses + ([6ecae73fe5](https://github.com/facebook/react-native/commit/6ecae73fe5915863c27ac7e407f5b151fd0c5fc3) by + [@fromcelticpark](https://github.com/fromcelticpark)) +- Fix `minimumViewTime` in _ViewabilityHelper_ + ([d19d137cc1](https://github.com/facebook/react-native/commit/d19d137cc18f10957b5ac64ac727d15fde57f018)) + +[0.56]: https://github.com/facebook/react-native/compare/0.55-stable...0.56-stable +[0.55]: https://github.com/facebook/react-native/compare/0.54-stable...0.55-stable +[0.54]: https://github.com/facebook/react-native/compare/0.53-stable...0.54-stable +[0.53]: https://github.com/facebook/react-native/compare/0.52-stable...0.53-stable +[0.52.0]: https://github.com/facebook/react-native/compare/0.51-stable...0.52-stable diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 03c23667dc6a..0cf6f7273ee0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,7 +42,8 @@ The main repository, , contains the Re There are a few other repositories you might want to familiarize yourself with: * **React Native website** which contains the source code for the website, including the documentation, located at -* **Releases** are coordinated through the repository. This includes important documents such as the Changelog. +* **Releases** Conversations for new releases are happening [in this discussion repo](https://github.com/reactwg/react-native-releases/discussions). +* **Changelog** The changelog can be found [here](https://github.com/facebook/react-native/blob/main/CHANGELOG.md). * **Discussions** about the future of React Native take place in the repository. * **High-quality plugins** for React Native can be found throughout the [React Native Community GitHub Organization](http://github.com/react-native-community/). diff --git a/Gemfile.lock b/Gemfile.lock index de5f3d29a1b7..c324675a9bc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,9 +1,9 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.4) + CFPropertyList (3.0.5) rexml - activesupport (6.1.4.1) + activesupport (6.1.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -15,11 +15,11 @@ GEM httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) - claide (1.0.3) - cocoapods (1.11.2) + claide (1.1.0) + cocoapods (1.11.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.11.2) + cocoapods-core (= 1.11.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -34,7 +34,7 @@ GEM nap (~> 1.0) ruby-macho (>= 1.0, < 3.0) xcodeproj (>= 1.21.0, < 2.0) - cocoapods-core (1.11.2) + cocoapods-core (1.11.3) activesupport (>= 5.0, < 7) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -45,7 +45,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.5.1) + cocoapods-downloader (1.6.3) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -54,38 +54,38 @@ GEM netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.9) + concurrent-ruby (1.1.10) escape (0.0.4) - ethon (0.14.0) + ethon (0.15.0) ffi (>= 1.15.0) - ffi (1.15.4) + ffi (1.15.5) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) - i18n (1.8.10) + i18n (1.12.0) concurrent-ruby (~> 1.0) - json (2.5.1) - minitest (5.14.4) + json (2.6.2) + minitest (5.16.2) molinillo (0.8.0) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) - public_suffix (4.0.6) + public_suffix (4.0.7) rexml (3.2.5) ruby-macho (2.5.1) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (2.0.4) + tzinfo (2.0.5) concurrent-ruby (~> 1.0) - xcodeproj (1.21.0) + xcodeproj (1.22.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - zeitwerk (2.4.2) + zeitwerk (2.6.0) PLATFORMS ruby @@ -97,4 +97,4 @@ RUBY VERSION ruby 2.7.4p191 BUNDLED WITH - 2.2.28 + 2.2.27 diff --git a/IntegrationTests/AccessibilityManagerTest.js b/IntegrationTests/AccessibilityManagerTest.js index a6f4c0d93bb6..f23972f25da1 100644 --- a/IntegrationTests/AccessibilityManagerTest.js +++ b/IntegrationTests/AccessibilityManagerTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/AppEventsTest.js b/IntegrationTests/AppEventsTest.js index 650203ed233a..5ff829b20c5a 100644 --- a/IntegrationTests/AppEventsTest.js +++ b/IntegrationTests/AppEventsTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -38,6 +38,7 @@ class AppEventsTest extends React.Component<{...}, State> { NativeAppEventEmitter.addListener('testEvent', this.receiveEvent); const event = {data: TEST_PAYLOAD, ts: Date.now()}; TestModule.sendAppEvent('testEvent', event); + // eslint-disable-next-line react/no-did-mount-set-state this.setState({sent: event}); } diff --git a/IntegrationTests/AsyncStorageTest.js b/IntegrationTests/AsyncStorageTest.js index 51ce374556e9..63697aedfece 100644 --- a/IntegrationTests/AsyncStorageTest.js +++ b/IntegrationTests/AsyncStorageTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -218,11 +218,13 @@ class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> { return ( - {/* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_ - * native_oss) This comment suppresses an error found when Flow v0.54 - * was deployed. To see the error delete this comment and run Flow. - */ - this.constructor.displayName + ': '} + { + /* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_ + * native_oss) This comment suppresses an error found when Flow v0.54 + * was deployed. To see the error delete this comment and run Flow. + */ + this.constructor.displayName + ': ' + } {this.state.done ? 'Done' : 'Testing...'} {'\n\n' + this.state.messages} diff --git a/IntegrationTests/GlobalEvalWithSourceUrlTest.js b/IntegrationTests/GlobalEvalWithSourceUrlTest.js index a69ee3728c48..dd3206f3c9a3 100644 --- a/IntegrationTests/GlobalEvalWithSourceUrlTest.js +++ b/IntegrationTests/GlobalEvalWithSourceUrlTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/ImageCachePolicyTest.js b/IntegrationTests/ImageCachePolicyTest.js index 00d65fb736d1..808da56ce8e9 100644 --- a/IntegrationTests/ImageCachePolicyTest.js +++ b/IntegrationTests/ImageCachePolicyTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/ImageSnapshotTest.js b/IntegrationTests/ImageSnapshotTest.js index cff8a5adb597..0d6aa3bb67f6 100644 --- a/IntegrationTests/ImageSnapshotTest.js +++ b/IntegrationTests/ImageSnapshotTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/IntegrationTestHarnessTest.js b/IntegrationTests/IntegrationTestHarnessTest.js index 256bcd210e75..3d76dc7c0681 100644 --- a/IntegrationTests/IntegrationTestHarnessTest.js +++ b/IntegrationTests/IntegrationTestHarnessTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -56,11 +56,13 @@ class IntegrationTestHarnessTest extends React.Component { return ( - {/* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_ - * native_oss) This comment suppresses an error found when Flow v0.54 - * was deployed. To see the error delete this comment and run Flow. - */ - this.constructor.displayName + ': '} + { + /* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_ + * native_oss) This comment suppresses an error found when Flow v0.54 + * was deployed. To see the error delete this comment and run Flow. + */ + this.constructor.displayName + ': ' + } {this.state.done ? 'Done' : 'Testing...'} diff --git a/IntegrationTests/IntegrationTestsApp.js b/IntegrationTests/IntegrationTestsApp.js index af41da151c47..bb8efcbcd497 100644 --- a/IntegrationTests/IntegrationTestsApp.js +++ b/IntegrationTests/IntegrationTestsApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,14 +13,8 @@ require('react-native/Libraries/Core/InitializeCore'); const React = require('react'); const ReactNative = require('react-native'); -const { - AppRegistry, - ScrollView, - StyleSheet, - Text, - TouchableOpacity, - View, -} = ReactNative; +const {AppRegistry, ScrollView, StyleSheet, Text, TouchableOpacity, View} = + ReactNative; // Keep this list in sync with RNTesterIntegrationTests.m const TESTS = [ diff --git a/IntegrationTests/LayoutEventsTest.js b/IntegrationTests/LayoutEventsTest.js index 8c24abf36622..609d786fc810 100644 --- a/IntegrationTests/LayoutEventsTest.js +++ b/IntegrationTests/LayoutEventsTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/LoggingTestModule.js b/IntegrationTests/LoggingTestModule.js index dc1dfb8ac033..c18cd8b42543 100644 --- a/IntegrationTests/LoggingTestModule.js +++ b/IntegrationTests/LoggingTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,24 +14,24 @@ const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridg const invariant = require('invariant'); const LoggingTestModule = { - logToConsole: function(str) { + logToConsole: function (str) { console.log(str); }, - logToConsoleAfterWait: function(str, timeout_ms) { - setTimeout(function() { + logToConsoleAfterWait: function (str, timeout_ms) { + setTimeout(function () { console.log(str); }, timeout_ms); }, - warning: function(str) { + warning: function (str) { console.warn(str); }, - invariant: function(str) { + invariant: function (str) { invariant(false, str); }, - logErrorToConsole: function(str) { + logErrorToConsole: function (str) { console.error(str); }, - throwError: function(str) { + throwError: function (str) { throw new Error(str); }, }; diff --git a/IntegrationTests/PromiseTest.js b/IntegrationTests/PromiseTest.js index 809f6eb873db..39b7c49d47ca 100644 --- a/IntegrationTests/PromiseTest.js +++ b/IntegrationTests/PromiseTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/PropertiesUpdateTest.js b/IntegrationTests/PropertiesUpdateTest.js index 8c61685bf884..5c1355ac0513 100644 --- a/IntegrationTests/PropertiesUpdateTest.js +++ b/IntegrationTests/PropertiesUpdateTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/RCTRootViewIntegrationTestApp.js b/IntegrationTests/RCTRootViewIntegrationTestApp.js index 2466b6378586..5fd9e57d932f 100644 --- a/IntegrationTests/RCTRootViewIntegrationTestApp.js +++ b/IntegrationTests/RCTRootViewIntegrationTestApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,14 +12,8 @@ const React = require('react'); const ReactNative = require('react-native'); -const { - AppRegistry, - ScrollView, - StyleSheet, - Text, - TouchableOpacity, - View, -} = ReactNative; +const {AppRegistry, ScrollView, StyleSheet, Text, TouchableOpacity, View} = + ReactNative; /* Keep this list in sync with RCTRootViewIntegrationTests.m */ const TESTS = [ diff --git a/IntegrationTests/ReactContentSizeUpdateTest.js b/IntegrationTests/ReactContentSizeUpdateTest.js index 9c826d9f4f53..ea00f975c375 100644 --- a/IntegrationTests/ReactContentSizeUpdateTest.js +++ b/IntegrationTests/ReactContentSizeUpdateTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/SimpleSnapshotTest.js b/IntegrationTests/SimpleSnapshotTest.js index e7d91aa4b702..27e5d2c12d54 100644 --- a/IntegrationTests/SimpleSnapshotTest.js +++ b/IntegrationTests/SimpleSnapshotTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/SizeFlexibilityUpdateTest.js b/IntegrationTests/SizeFlexibilityUpdateTest.js index 3577a5363b53..79635eaffe52 100644 --- a/IntegrationTests/SizeFlexibilityUpdateTest.js +++ b/IntegrationTests/SizeFlexibilityUpdateTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/SyncMethodTest.js b/IntegrationTests/SyncMethodTest.js index 077884256d2f..febe02154375 100644 --- a/IntegrationTests/SyncMethodTest.js +++ b/IntegrationTests/SyncMethodTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/TimersTest.js b/IntegrationTests/TimersTest.js index 30473e3b8e75..64b3f1233b6a 100644 --- a/IntegrationTests/TimersTest.js +++ b/IntegrationTests/TimersTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/WebSocketTest.js b/IntegrationTests/WebSocketTest.js index 3435feabb11d..6fbcbfb6cd8f 100644 --- a/IntegrationTests/WebSocketTest.js +++ b/IntegrationTests/WebSocketTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -45,7 +45,7 @@ class WebSocketTest extends React.Component<{...}, State> { _waitFor = (condition: any, timeout: any, callback: any) => { let remaining = timeout; - const timeoutFunction = function() { + const timeoutFunction = function () { if (condition()) { callback(true); return; diff --git a/IntegrationTests/launchWebSocketServer.command b/IntegrationTests/launchWebSocketServer.command index 1ce2cf5317c0..31bb3496df33 100755 --- a/IntegrationTests/launchWebSocketServer.command +++ b/IntegrationTests/launchWebSocketServer.command @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/IntegrationTests/websocket_integration_test_server.js b/IntegrationTests/websocket_integration_test_server.js index 36c73bed65ec..0f0b597b63a7 100755 --- a/IntegrationTests/websocket_integration_test_server.js +++ b/IntegrationTests/websocket_integration_test_server.js @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/LICENSE b/LICENSE index b96dcb0480a0..b93be90515cc 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) Facebook, Inc. and its affiliates. +Copyright (c) Meta Platforms, Inc. and affiliates. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Libraries/ActionSheetIOS/ActionSheetIOS.js b/Libraries/ActionSheetIOS/ActionSheetIOS.js index 889832df1b77..30ecf4a3d019 100644 --- a/Libraries/ActionSheetIOS/ActionSheetIOS.js +++ b/Libraries/ActionSheetIOS/ActionSheetIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,7 @@ import type {ProcessedColorValue} from '../StyleSheet/processColor'; /** * Display action sheets and share sheets on iOS. * - * See https://reactnative.dev/docs/actionsheetios.html + * See https://reactnative.dev/docs/actionsheetios */ const ActionSheetIOS = { /** @@ -36,7 +36,7 @@ const ActionSheetIOS = { * The 'callback' function takes one parameter, the zero-based index * of the selected item. * - * See https://reactnative.dev/docs/actionsheetios.html#showactionsheetwithoptions + * See https://reactnative.dev/docs/actionsheetios#showactionsheetwithoptions */ showActionSheetWithOptions( options: {| @@ -117,7 +117,7 @@ const ActionSheetIOS = { * - a boolean value signifying success or failure * - a string that, in the case of success, indicates the method of sharing * - * See https://reactnative.dev/docs/actionsheetios.html#showshareactionsheetwithoptions + * See https://reactnative.dev/docs/actionsheetios#showshareactionsheetwithoptions */ showShareActionSheetWithOptions( options: Object, diff --git a/Libraries/ActionSheetIOS/NativeActionSheetManager.js b/Libraries/ActionSheetIOS/NativeActionSheetManager.js index 56429c658ac0..fb0a92ddb5d2 100644 --- a/Libraries/ActionSheetIOS/NativeActionSheetManager.js +++ b/Libraries/ActionSheetIOS/NativeActionSheetManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec index f080a2b2ffb2..e81353c8b6a9 100644 --- a/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec +++ b/Libraries/ActionSheetIOS/React-RCTActionSheet.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/Libraries/Alert/Alert.js b/Libraries/Alert/Alert.js index 02a7a312e5b2..9bd5484d8c3e 100644 --- a/Libraries/Alert/Alert.js +++ b/Libraries/Alert/Alert.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -34,7 +34,7 @@ type Options = { /** * Launches an alert dialog with the specified title and message. * - * See https://reactnative.dev/docs/alert.html + * See https://reactnative.dev/docs/alert */ class Alert { static alert( @@ -46,8 +46,8 @@ class Alert { if (Platform.OS === 'ios') { Alert.prompt(title, message, buttons, 'default'); } else if (Platform.OS === 'android') { - const NativeDialogManagerAndroid = require('../NativeModules/specs/NativeDialogManagerAndroid') - .default; + const NativeDialogManagerAndroid = + require('../NativeModules/specs/NativeDialogManagerAndroid').default; if (!NativeDialogManagerAndroid) { return; } diff --git a/Libraries/Alert/NativeAlertManager.js b/Libraries/Alert/NativeAlertManager.js index ec01b4a916e9..899455bda948 100644 --- a/Libraries/Alert/NativeAlertManager.js +++ b/Libraries/Alert/NativeAlertManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Alert/RCTAlertManager.android.js b/Libraries/Alert/RCTAlertManager.android.js index 366692bd906d..3a15b76ac57c 100644 --- a/Libraries/Alert/RCTAlertManager.android.js +++ b/Libraries/Alert/RCTAlertManager.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ import NativeDialogManagerAndroid from '../NativeModules/specs/NativeDialogManag function emptyCallback() {} module.exports = { - alertWithArgs: function(args, callback) { + alertWithArgs: function (args, callback) { // TODO(5998984): Polyfill it correctly with DialogManagerAndroid if (!NativeDialogManagerAndroid) { return; diff --git a/Libraries/Alert/RCTAlertManager.ios.js b/Libraries/Alert/RCTAlertManager.ios.js index a5dbdac5daf7..01f055da53d4 100644 --- a/Libraries/Alert/RCTAlertManager.ios.js +++ b/Libraries/Alert/RCTAlertManager.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/Animated.js b/Libraries/Animated/Animated.js index 2f6ee99ae6b0..70beabf56a98 100644 --- a/Libraries/Animated/Animated.js +++ b/Libraries/Animated/Animated.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/AnimatedEvent.js b/Libraries/Animated/AnimatedEvent.js index b9101f16d426..9aa49926152a 100644 --- a/Libraries/Animated/AnimatedEvent.js +++ b/Libraries/Animated/AnimatedEvent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,8 @@ const invariant = require('invariant'); const {shouldUseNativeDriver} = require('./NativeAnimatedHelper'); +import type {PlatformConfig} from './AnimatedPlatformConfig'; + export type Mapping = | {[key: string]: Mapping, ...} | AnimatedValue @@ -26,12 +28,14 @@ export type Mapping = export type EventConfig = { listener?: ?Function, useNativeDriver: boolean, + platformConfig?: PlatformConfig, }; function attachNativeEvent( viewRef: any, eventName: string, argMapping: $ReadOnlyArray, + platformConfig: ?PlatformConfig, ): {detach: () => void} { // Find animated values in `argMapping` and create an array representing their // key path inside the `nativeEvent` object. Ex.: ['contentOffset', 'x']. @@ -39,7 +43,7 @@ function attachNativeEvent( const traverse = (value, path) => { if (value instanceof AnimatedValue) { - value.__makeNative(); + value.__makeNative(platformConfig); eventMappings.push({ nativeEventPath: path, @@ -145,9 +149,9 @@ function validateMapping(argMapping, args) { class AnimatedEvent { _argMapping: $ReadOnlyArray; _listeners: Array = []; - _callListeners: Function; _attachedEvent: ?{detach: () => void, ...}; __isNative: boolean; + __platformConfig: ?PlatformConfig; constructor(argMapping: $ReadOnlyArray, config: EventConfig) { this._argMapping = argMapping; @@ -160,9 +164,9 @@ class AnimatedEvent { if (config.listener) { this.__addListener(config.listener); } - this._callListeners = this._callListeners.bind(this); this._attachedEvent = null; this.__isNative = shouldUseNativeDriver(config); + this.__platformConfig = config.platformConfig; } __addListener(callback: Function): void { @@ -183,6 +187,7 @@ class AnimatedEvent { viewRef, eventName, this._argMapping, + this.__platformConfig, ); } @@ -245,9 +250,9 @@ class AnimatedEvent { }; } - _callListeners(...args: any) { + _callListeners = (...args: any) => { this._listeners.forEach(listener => listener(...args)); - } + }; } module.exports = {AnimatedEvent, attachNativeEvent}; diff --git a/Libraries/Animated/AnimatedImplementation.js b/Libraries/Animated/AnimatedImplementation.js index 706b87ea01e9..e93c0dda4ccf 100644 --- a/Libraries/Animated/AnimatedImplementation.js +++ b/Libraries/Animated/AnimatedImplementation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,6 @@ const AnimatedInterpolation = require('./nodes/AnimatedInterpolation'); const AnimatedModulo = require('./nodes/AnimatedModulo'); const AnimatedMultiplication = require('./nodes/AnimatedMultiplication'); const AnimatedNode = require('./nodes/AnimatedNode'); -const AnimatedProps = require('./nodes/AnimatedProps'); const AnimatedSubtraction = require('./nodes/AnimatedSubtraction'); const AnimatedTracking = require('./nodes/AnimatedTracking'); const AnimatedValue = require('./nodes/AnimatedValue'); @@ -39,6 +38,8 @@ import type {DecayAnimationConfig} from './animations/DecayAnimation'; import type {SpringAnimationConfig} from './animations/SpringAnimation'; import type {Mapping, EventConfig} from './AnimatedEvent'; +import AnimatedColor from './nodes/AnimatedColor'; + export type CompositeAnimation = { start: (callback?: ?EndCallback) => void, stop: () => void, @@ -48,39 +49,39 @@ export type CompositeAnimation = { ... }; -const add = function( +const add = function ( a: AnimatedNode | number, b: AnimatedNode | number, ): AnimatedAddition { return new AnimatedAddition(a, b); }; -const subtract = function( +const subtract = function ( a: AnimatedNode | number, b: AnimatedNode | number, ): AnimatedSubtraction { return new AnimatedSubtraction(a, b); }; -const divide = function( +const divide = function ( a: AnimatedNode | number, b: AnimatedNode | number, ): AnimatedDivision { return new AnimatedDivision(a, b); }; -const multiply = function( +const multiply = function ( a: AnimatedNode | number, b: AnimatedNode | number, ): AnimatedMultiplication { return new AnimatedMultiplication(a, b); }; -const modulo = function(a: AnimatedNode, modulus: number): AnimatedModulo { +const modulo = function (a: AnimatedNode, modulus: number): AnimatedModulo { return new AnimatedModulo(a, modulus); }; -const diffClamp = function( +const diffClamp = function ( a: AnimatedNode, min: number, max: number, @@ -88,7 +89,7 @@ const diffClamp = function( return new AnimatedDiffClamp(a, min, max); }; -const _combineCallbacks = function( +const _combineCallbacks = function ( callback: ?EndCallback, config: {...AnimationConfig, ...}, ) { @@ -102,8 +103,8 @@ const _combineCallbacks = function( } }; -const maybeVectorAnim = function( - value: AnimatedValue | AnimatedValueXY, +const maybeVectorAnim = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: Object, anim: (value: AnimatedValue, config: Object) => CompositeAnimation, ): ?CompositeAnimation { @@ -122,16 +123,42 @@ const maybeVectorAnim = function( // We use `stopTogether: false` here because otherwise tracking will break // because the second animation will get stopped before it can update. return parallel([aX, aY], {stopTogether: false}); + } else if (value instanceof AnimatedColor) { + const configR = {...config}; + const configG = {...config}; + const configB = {...config}; + const configA = {...config}; + for (const key in config) { + const {r, g, b, a} = config[key]; + if ( + r !== undefined && + g !== undefined && + b !== undefined && + a !== undefined + ) { + configR[key] = r; + configG[key] = g; + configB[key] = b; + configA[key] = a; + } + } + const aR = anim((value: AnimatedColor).r, configR); + const aG = anim((value: AnimatedColor).g, configG); + const aB = anim((value: AnimatedColor).b, configB); + const aA = anim((value: AnimatedColor).a, configA); + // We use `stopTogether: false` here because otherwise tracking will break + // because the second animation will get stopped before it can update. + return parallel([aR, aG, aB, aA], {stopTogether: false}); } return null; }; -const spring = function( - value: AnimatedValue | AnimatedValueXY, +const spring = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: SpringAnimationConfig, ): CompositeAnimation { - const start = function( - animatedValue: AnimatedValue | AnimatedValueXY, + const start = function ( + animatedValue: AnimatedValue | AnimatedValueXY | AnimatedColor, configuration: SpringAnimationConfig, callback?: ?EndCallback, ): void { @@ -155,36 +182,36 @@ const spring = function( }; return ( maybeVectorAnim(value, config, spring) || { - start: function(callback?: ?EndCallback): void { + start: function (callback?: ?EndCallback): void { start(value, config, callback); }, - stop: function(): void { + stop: function (): void { value.stopAnimation(); }, - reset: function(): void { + reset: function (): void { value.resetAnimation(); }, - _startNativeLoop: function(iterations?: number): void { + _startNativeLoop: function (iterations?: number): void { const singleConfig = {...config, iterations}; start(value, singleConfig); }, - _isUsingNativeDriver: function(): boolean { + _isUsingNativeDriver: function (): boolean { return config.useNativeDriver || false; }, } ); }; -const timing = function( - value: AnimatedValue | AnimatedValueXY, +const timing = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: TimingAnimationConfig, ): CompositeAnimation { - const start = function( - animatedValue: AnimatedValue | AnimatedValueXY, + const start = function ( + animatedValue: AnimatedValue | AnimatedValueXY | AnimatedColor, configuration: TimingAnimationConfig, callback?: ?EndCallback, ): void { @@ -209,36 +236,36 @@ const timing = function( return ( maybeVectorAnim(value, config, timing) || { - start: function(callback?: ?EndCallback): void { + start: function (callback?: ?EndCallback): void { start(value, config, callback); }, - stop: function(): void { + stop: function (): void { value.stopAnimation(); }, - reset: function(): void { + reset: function (): void { value.resetAnimation(); }, - _startNativeLoop: function(iterations?: number): void { + _startNativeLoop: function (iterations?: number): void { const singleConfig = {...config, iterations}; start(value, singleConfig); }, - _isUsingNativeDriver: function(): boolean { + _isUsingNativeDriver: function (): boolean { return config.useNativeDriver || false; }, } ); }; -const decay = function( - value: AnimatedValue | AnimatedValueXY, +const decay = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: DecayAnimationConfig, ): CompositeAnimation { - const start = function( - animatedValue: AnimatedValue | AnimatedValueXY, + const start = function ( + animatedValue: AnimatedValue | AnimatedValueXY | AnimatedColor, configuration: DecayAnimationConfig, callback?: ?EndCallback, ): void { @@ -251,37 +278,37 @@ const decay = function( return ( maybeVectorAnim(value, config, decay) || { - start: function(callback?: ?EndCallback): void { + start: function (callback?: ?EndCallback): void { start(value, config, callback); }, - stop: function(): void { + stop: function (): void { value.stopAnimation(); }, - reset: function(): void { + reset: function (): void { value.resetAnimation(); }, - _startNativeLoop: function(iterations?: number): void { + _startNativeLoop: function (iterations?: number): void { const singleConfig = {...config, iterations}; start(value, singleConfig); }, - _isUsingNativeDriver: function(): boolean { + _isUsingNativeDriver: function (): boolean { return config.useNativeDriver || false; }, } ); }; -const sequence = function( +const sequence = function ( animations: Array, ): CompositeAnimation { let current = 0; return { - start: function(callback?: ?EndCallback) { - const onComplete = function(result) { + start: function (callback?: ?EndCallback) { + const onComplete = function (result) { if (!result.finished) { callback && callback(result); return; @@ -304,13 +331,13 @@ const sequence = function( } }, - stop: function() { + stop: function () { if (current < animations.length) { animations[current].stop(); } }, - reset: function() { + reset: function () { animations.forEach((animation, idx) => { if (idx <= current) { animation.reset(); @@ -319,13 +346,13 @@ const sequence = function( current = 0; }, - _startNativeLoop: function() { + _startNativeLoop: function () { throw new Error( 'Loops run using the native driver cannot contain Animated.sequence animations', ); }, - _isUsingNativeDriver: function(): boolean { + _isUsingNativeDriver: function (): boolean { return false; }, }; @@ -336,7 +363,7 @@ type ParallelConfig = { stopTogether?: boolean, ... }; -const parallel = function( +const parallel = function ( animations: Array, config?: ?ParallelConfig, ): CompositeAnimation { @@ -346,14 +373,14 @@ const parallel = function( const stopTogether = !(config && config.stopTogether === false); const result = { - start: function(callback?: ?EndCallback) { + start: function (callback?: ?EndCallback) { if (doneCount === animations.length) { callback && callback({finished: true}); return; } animations.forEach((animation, idx) => { - const cb = function(endResult) { + const cb = function (endResult) { hasEnded[idx] = true; doneCount++; if (doneCount === animations.length) { @@ -375,14 +402,14 @@ const parallel = function( }); }, - stop: function(): void { + stop: function (): void { animations.forEach((animation, idx) => { !hasEnded[idx] && animation.stop(); hasEnded[idx] = true; }); }, - reset: function(): void { + reset: function (): void { animations.forEach((animation, idx) => { animation.reset(); hasEnded[idx] = false; @@ -390,13 +417,13 @@ const parallel = function( }); }, - _startNativeLoop: function() { + _startNativeLoop: function () { throw new Error( 'Loops run using the native driver cannot contain Animated.parallel animations', ); }, - _isUsingNativeDriver: function(): boolean { + _isUsingNativeDriver: function (): boolean { return false; }, }; @@ -404,7 +431,7 @@ const parallel = function( return result; }; -const delay = function(time: number): CompositeAnimation { +const delay = function (time: number): CompositeAnimation { // Would be nice to make a specialized implementation return timing(new AnimatedValue(0), { toValue: 0, @@ -414,7 +441,7 @@ const delay = function(time: number): CompositeAnimation { }); }; -const stagger = function( +const stagger = function ( time: number, animations: Array, ): CompositeAnimation { @@ -431,15 +458,15 @@ type LoopAnimationConfig = { ... }; -const loop = function( +const loop = function ( animation: CompositeAnimation, {iterations = -1, resetBeforeIteration = true}: LoopAnimationConfig = {}, ): CompositeAnimation { let isFinished = false; let iterationsSoFar = 0; return { - start: function(callback?: ?EndCallback) { - const restart = function(result: EndResult = {finished: true}): void { + start: function (callback?: ?EndCallback) { + const restart = function (result: EndResult = {finished: true}): void { if ( isFinished || iterationsSoFar === iterations || @@ -463,24 +490,24 @@ const loop = function( } }, - stop: function(): void { + stop: function (): void { isFinished = true; animation.stop(); }, - reset: function(): void { + reset: function (): void { iterationsSoFar = 0; isFinished = false; animation.reset(); }, - _startNativeLoop: function() { + _startNativeLoop: function () { throw new Error( 'Loops run using the native driver cannot contain Animated.loop animations', ); }, - _isUsingNativeDriver: function(): boolean { + _isUsingNativeDriver: function (): boolean { return animation._isUsingNativeDriver(); }, }; @@ -512,7 +539,7 @@ function unforkEvent( } } -const event = function( +const event = function ( argMapping: $ReadOnlyArray, config: EventConfig, ): any { @@ -532,33 +559,37 @@ const event = function( * If additional transforms are added, be sure to include them in * AnimatedMock.js as well. * - * See https://reactnative.dev/docs/animated.html + * See https://reactnative.dev/docs/animated */ module.exports = { /** * Standard value class for driving animations. Typically initialized with * `new Animated.Value(0);` * - * See https://reactnative.dev/docs/animated.html#value + * See https://reactnative.dev/docs/animated#value */ Value: AnimatedValue, /** * 2D value class for driving 2D animations, such as pan gestures. * - * See https://reactnative.dev/docs/animatedvaluexy.html + * See https://reactnative.dev/docs/animatedvaluexy */ ValueXY: AnimatedValueXY, + /** + * Value class for driving color animations. + */ + Color: AnimatedColor, /** * Exported to use the Interpolation type in flow. * - * See https://reactnative.dev/docs/animated.html#interpolation + * See https://reactnative.dev/docs/animated#interpolation */ Interpolation: AnimatedInterpolation, /** * Exported for ease of type checking. All animated values derive from this * class. * - * See https://reactnative.dev/docs/animated.html#node + * See https://reactnative.dev/docs/animated#node */ Node: AnimatedNode, @@ -566,21 +597,21 @@ module.exports = { * Animates a value from an initial velocity to zero based on a decay * coefficient. * - * See https://reactnative.dev/docs/animated.html#decay + * See https://reactnative.dev/docs/animated#decay */ decay, /** * Animates a value along a timed easing curve. The Easing module has tons of * predefined curves, or you can use your own function. * - * See https://reactnative.dev/docs/animated.html#timing + * See https://reactnative.dev/docs/animated#timing */ timing, /** * Animates a value according to an analytical spring model based on * damped harmonic oscillation. * - * See https://reactnative.dev/docs/animated.html#spring + * See https://reactnative.dev/docs/animated#spring */ spring, @@ -588,7 +619,7 @@ module.exports = { * Creates a new Animated value composed from two Animated values added * together. * - * See https://reactnative.dev/docs/animated.html#add + * See https://reactnative.dev/docs/animated#add */ add, @@ -596,7 +627,7 @@ module.exports = { * Creates a new Animated value composed by subtracting the second Animated * value from the first Animated value. * - * See https://reactnative.dev/docs/animated.html#subtract + * See https://reactnative.dev/docs/animated#subtract */ subtract, @@ -604,7 +635,7 @@ module.exports = { * Creates a new Animated value composed by dividing the first Animated value * by the second Animated value. * - * See https://reactnative.dev/docs/animated.html#divide + * See https://reactnative.dev/docs/animated#divide */ divide, @@ -612,7 +643,7 @@ module.exports = { * Creates a new Animated value composed from two Animated values multiplied * together. * - * See https://reactnative.dev/docs/animated.html#multiply + * See https://reactnative.dev/docs/animated#multiply */ multiply, @@ -620,7 +651,7 @@ module.exports = { * Creates a new Animated value that is the (non-negative) modulo of the * provided Animated value. * - * See https://reactnative.dev/docs/animated.html#modulo + * See https://reactnative.dev/docs/animated#modulo */ modulo, @@ -629,14 +660,14 @@ module.exports = { * difference between the last value so even if the value is far from the * bounds it will start changing when the value starts getting closer again. * - * See https://reactnative.dev/docs/animated.html#diffclamp + * See https://reactnative.dev/docs/animated#diffclamp */ diffClamp, /** * Starts an animation after the given delay. * - * See https://reactnative.dev/docs/animated.html#delay + * See https://reactnative.dev/docs/animated#delay */ delay, /** @@ -644,7 +675,7 @@ module.exports = { * before starting the next. If the current running animation is stopped, no * following animations will be started. * - * See https://reactnative.dev/docs/animated.html#sequence + * See https://reactnative.dev/docs/animated#sequence */ sequence, /** @@ -652,21 +683,21 @@ module.exports = { * of the animations is stopped, they will all be stopped. You can override * this with the `stopTogether` flag. * - * See https://reactnative.dev/docs/animated.html#parallel + * See https://reactnative.dev/docs/animated#parallel */ parallel, /** * Array of animations may run in parallel (overlap), but are started in * sequence with successive delays. Nice for doing trailing effects. * - * See https://reactnative.dev/docs/animated.html#stagger + * See https://reactnative.dev/docs/animated#stagger */ stagger, /** * Loops a given animation continuously, so that each time it reaches the * end, it resets and begins again from the start. * - * See https://reactnative.dev/docs/animated.html#loop + * See https://reactnative.dev/docs/animated#loop */ loop, @@ -674,14 +705,14 @@ module.exports = { * Takes an array of mappings and extracts values from each arg accordingly, * then calls `setValue` on the mapped outputs. * - * See https://reactnative.dev/docs/animated.html#event + * See https://reactnative.dev/docs/animated#event */ event, /** * Make any React component Animatable. Used to create `Animated.View`, etc. * - * See https://reactnative.dev/docs/animated.html#createanimatedcomponent + * See https://reactnative.dev/docs/animated#createanimatedcomponent */ createAnimatedComponent, @@ -689,7 +720,7 @@ module.exports = { * Imperative API to attach an animated value to an event on a view. Prefer * using `Animated.event` with `useNativeDrive: true` if possible. * - * See https://reactnative.dev/docs/animated.html#attachnativeevent + * See https://reactnative.dev/docs/animated#attachnativeevent */ attachNativeEvent, @@ -697,7 +728,7 @@ module.exports = { * Advanced imperative API for snooping on animated events that are passed in * through props. Use values directly where possible. * - * See https://reactnative.dev/docs/animated.html#forkevent + * See https://reactnative.dev/docs/animated#forkevent */ forkEvent, unforkEvent, diff --git a/Libraries/Animated/AnimatedMock.js b/Libraries/Animated/AnimatedMock.js index 225669b1f640..f2ce29359c2a 100644 --- a/Libraries/Animated/AnimatedMock.js +++ b/Libraries/Animated/AnimatedMock.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,11 +24,43 @@ import type {TimingAnimationConfig} from './animations/TimingAnimation'; import type {DecayAnimationConfig} from './animations/DecayAnimation'; import type {SpringAnimationConfig} from './animations/SpringAnimation'; +import AnimatedColor from './nodes/AnimatedColor'; + /** * Animations are a source of flakiness in snapshot testing. This mock replaces * animation functions from AnimatedImplementation with empty animations for - * predictability in tests. + * predictability in tests. When possible the animation will run immediately + * to the final state. */ + +// Prevent any callback invocation from recursively triggering another +// callback, which may trigger another animation +let inAnimationCallback = false; +function mockAnimationStart( + start: (callback?: ?EndCallback) => void, +): (callback?: ?EndCallback) => void { + return callback => { + const guardedCallback = + callback == null + ? callback + : (...args) => { + if (inAnimationCallback) { + console.warn( + 'Ignoring recursive animation callback when running mock animations', + ); + return; + } + inAnimationCallback = true; + try { + callback(...args); + } finally { + inAnimationCallback = false; + } + }; + start(guardedCallback); + }; +} + export type CompositeAnimation = { start: (callback?: ?EndCallback) => void, stop: () => void, @@ -48,64 +80,74 @@ const emptyAnimation = { }, }; -const spring = function( - value: AnimatedValue | AnimatedValueXY, +const mockCompositeAnimation = ( + animations: Array, +): CompositeAnimation => ({ + ...emptyAnimation, + start: mockAnimationStart((callback?: ?EndCallback): void => { + animations.forEach(animation => animation.start()); + callback?.({finished: true}); + }), +}); + +const spring = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: SpringAnimationConfig, ): CompositeAnimation { const anyValue: any = value; return { ...emptyAnimation, - start: (callback?: ?EndCallback): void => { + start: mockAnimationStart((callback?: ?EndCallback): void => { anyValue.setValue(config.toValue); - callback && callback({finished: true}); - }, + callback?.({finished: true}); + }), }; }; -const timing = function( - value: AnimatedValue | AnimatedValueXY, +const timing = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: TimingAnimationConfig, ): CompositeAnimation { const anyValue: any = value; return { ...emptyAnimation, - start: (callback?: ?EndCallback): void => { + start: mockAnimationStart((callback?: ?EndCallback): void => { anyValue.setValue(config.toValue); - callback && callback({finished: true}); - }, + callback?.({finished: true}); + }), }; }; -const decay = function( - value: AnimatedValue | AnimatedValueXY, +const decay = function ( + value: AnimatedValue | AnimatedValueXY | AnimatedColor, config: DecayAnimationConfig, ): CompositeAnimation { return emptyAnimation; }; -const sequence = function( +const sequence = function ( animations: Array, ): CompositeAnimation { - return emptyAnimation; + return mockCompositeAnimation(animations); }; type ParallelConfig = {stopTogether?: boolean, ...}; -const parallel = function( +const parallel = function ( animations: Array, config?: ?ParallelConfig, ): CompositeAnimation { - return emptyAnimation; + return mockCompositeAnimation(animations); }; -const delay = function(time: number): CompositeAnimation { +const delay = function (time: number): CompositeAnimation { return emptyAnimation; }; -const stagger = function( +const stagger = function ( time: number, animations: Array, ): CompositeAnimation { - return emptyAnimation; + return mockCompositeAnimation(animations); }; type LoopAnimationConfig = { @@ -114,7 +156,7 @@ type LoopAnimationConfig = { ... }; -const loop = function( +const loop = function ( animation: CompositeAnimation, {iterations = -1}: LoopAnimationConfig = {}, ): CompositeAnimation { @@ -124,6 +166,7 @@ const loop = function( module.exports = { Value: AnimatedValue, ValueXY: AnimatedValueXY, + Color: AnimatedColor, Interpolation: AnimatedInterpolation, Node: AnimatedNode, decay, diff --git a/Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js b/Libraries/Animated/AnimatedPlatformConfig.js similarity index 63% rename from Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js rename to Libraries/Animated/AnimatedPlatformConfig.js index 234c178afddd..fb0b52f3f1c8 100644 --- a/Libraries/Components/Touchable/__mocks__/ensureComponentIsNative.js +++ b/Libraries/Animated/AnimatedPlatformConfig.js @@ -1,12 +1,13 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @flow * @format */ 'use strict'; -module.exports = () => true; +export type PlatformConfig = {}; diff --git a/Libraries/Animated/AnimatedWeb.js b/Libraries/Animated/AnimatedWeb.js index 513f322b709d..e1c016b75324 100644 --- a/Libraries/Animated/AnimatedWeb.js +++ b/Libraries/Animated/AnimatedWeb.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/Easing.js b/Libraries/Animated/Easing.js index 253a3e785aaa..f8b5bac2f304 100644 --- a/Libraries/Animated/Easing.js +++ b/Libraries/Animated/Easing.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -57,20 +57,20 @@ let ease; * - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical * - [`out`](docs/easing.html#out) runs an easing function backwards */ -class Easing { +const Easing = { /** * A stepping function, returns 1 for any positive value of `n`. */ - static step0(n: number): number { + step0(n: number): number { return n > 0 ? 1 : 0; - } + }, /** * A stepping function, returns 1 if `n` is greater than or equal to 1. */ - static step1(n: number): number { + step1(n: number): number { return n >= 1 ? 1 : 0; - } + }, /** * A linear function, `f(t) = t`. Position correlates to elapsed time one to @@ -78,9 +78,9 @@ class Easing { * * http://cubic-bezier.com/#0,0,1,1 */ - static linear(t: number): number { + linear(t: number): number { return t; - } + }, /** * A simple inertial interaction, similar to an object slowly accelerating to @@ -88,12 +88,12 @@ class Easing { * * http://cubic-bezier.com/#.42,0,1,1 */ - static ease(t: number): number { + ease(t: number): number { if (!ease) { ease = Easing.bezier(0.42, 0, 1, 1); } return ease(t); - } + }, /** * A quadratic function, `f(t) = t * t`. Position equals the square of elapsed @@ -101,9 +101,9 @@ class Easing { * * http://easings.net/#easeInQuad */ - static quad(t: number): number { + quad(t: number): number { return t * t; - } + }, /** * A cubic function, `f(t) = t * t * t`. Position equals the cube of elapsed @@ -111,9 +111,9 @@ class Easing { * * http://easings.net/#easeInCubic */ - static cubic(t: number): number { + cubic(t: number): number { return t * t * t; - } + }, /** * A power function. Position is equal to the Nth power of elapsed time. @@ -121,36 +121,36 @@ class Easing { * n = 4: http://easings.net/#easeInQuart * n = 5: http://easings.net/#easeInQuint */ - static poly(n: number): (t: number) => number { + poly(n: number): (t: number) => number { return (t: number) => Math.pow(t, n); - } + }, /** * A sinusoidal function. * * http://easings.net/#easeInSine */ - static sin(t: number): number { + sin(t: number): number { return 1 - Math.cos((t * Math.PI) / 2); - } + }, /** * A circular function. * * http://easings.net/#easeInCirc */ - static circle(t: number): number { + circle(t: number): number { return 1 - Math.sqrt(1 - t * t); - } + }, /** * An exponential function. * * http://easings.net/#easeInExpo */ - static exp(t: number): number { + exp(t: number): number { return Math.pow(2, 10 * (t - 1)); - } + }, /** * A simple elastic interaction, similar to a spring oscillating back and @@ -162,29 +162,27 @@ class Easing { * * http://easings.net/#easeInElastic */ - static elastic(bounciness: number = 1): (t: number) => number { + elastic(bounciness: number = 1): (t: number) => number { const p = bounciness * Math.PI; return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p); - } + }, /** * Use with `Animated.parallel()` to create a simple effect where the object * animates back slightly as the animation starts. * - * Wolfram Plot: - * - * - http://tiny.cc/back_default (s = 1.70158, default) + * https://easings.net/#easeInBack */ - static back(s: number = 1.70158): (t: number) => number { + back(s: number = 1.70158): (t: number) => number { return t => t * t * ((s + 1) * t - s); - } + }, /** * Provides a simple bouncing effect. * * http://easings.net/#easeInBounce */ - static bounce(t: number): number { + bounce(t: number): number { if (t < 1 / 2.75) { return 7.5625 * t * t; } @@ -201,7 +199,7 @@ class Easing { const t2 = t - 2.625 / 2.75; return 7.5625 * t2 * t2 + 0.984375; - } + }, /** * Provides a cubic bezier curve, equivalent to CSS Transitions' @@ -210,7 +208,7 @@ class Easing { * A useful tool to visualize cubic bezier curves can be found at * http://cubic-bezier.com/ */ - static bezier( + bezier( x1: number, y1: number, x2: number, @@ -218,35 +216,35 @@ class Easing { ): (t: number) => number { const _bezier = require('./bezier'); return _bezier(x1, y1, x2, y2); - } + }, /** * Runs an easing function forwards. */ - static in(easing: (t: number) => number): (t: number) => number { + in(easing: (t: number) => number): (t: number) => number { return easing; - } + }, /** * Runs an easing function backwards. */ - static out(easing: (t: number) => number): (t: number) => number { + out(easing: (t: number) => number): (t: number) => number { return t => 1 - easing(1 - t); - } + }, /** * Makes any easing function symmetrical. The easing function will run * forwards for half of the duration, then backwards for the rest of the * duration. */ - static inOut(easing: (t: number) => number): (t: number) => number { + inOut(easing: (t: number) => number): (t: number) => number { return t => { if (t < 0.5) { return easing(t * 2) / 2; } return 1 - easing((1 - t) * 2) / 2; }; - } -} + }, +}; module.exports = Easing; diff --git a/Libraries/Animated/NativeAnimatedHelper.js b/Libraries/Animated/NativeAnimatedHelper.js index 89fe7b5a8d2a..38853a32e9b2 100644 --- a/Libraries/Animated/NativeAnimatedHelper.js +++ b/Libraries/Animated/NativeAnimatedHelper.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -42,7 +42,7 @@ let queue: Array<() => void> = []; * the native module methods */ const API = { - getValue: function( + getValue: function ( tag: number, saveValueCallback: (value: number) => void, ): void { @@ -51,11 +51,11 @@ const API = { NativeAnimatedModule.getValue(tag, saveValueCallback); }); }, - setWaitingForIdentifier: function(id: string): void { + setWaitingForIdentifier: function (id: string): void { waitingForQueuedOperations.add(id); queueOperations = true; }, - unsetWaitingForIdentifier: function(id: string): void { + unsetWaitingForIdentifier: function (id: string): void { waitingForQueuedOperations.delete(id); if (waitingForQueuedOperations.size === 0) { @@ -63,7 +63,7 @@ const API = { API.disableQueue(); } }, - disableQueue: function(): void { + disableQueue: function (): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); if (Platform.OS === 'android') { @@ -84,37 +84,40 @@ const API = { fn(); } }, - createAnimatedNode: function(tag: number, config: AnimatedNodeConfig): void { + createAnimatedNode: function (tag: number, config: AnimatedNodeConfig): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.createAnimatedNode(tag, config), ); }, - startListeningToAnimatedNodeValue: function(tag: number) { + startListeningToAnimatedNodeValue: function (tag: number) { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.startListeningToAnimatedNodeValue(tag), ); }, - stopListeningToAnimatedNodeValue: function(tag: number) { + stopListeningToAnimatedNodeValue: function (tag: number) { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.stopListeningToAnimatedNodeValue(tag), ); }, - connectAnimatedNodes: function(parentTag: number, childTag: number): void { + connectAnimatedNodes: function (parentTag: number, childTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.connectAnimatedNodes(parentTag, childTag), ); }, - disconnectAnimatedNodes: function(parentTag: number, childTag: number): void { + disconnectAnimatedNodes: function ( + parentTag: number, + childTag: number, + ): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.disconnectAnimatedNodes(parentTag, childTag), ); }, - startAnimatingNode: function( + startAnimatingNode: function ( animationId: number, nodeTag: number, config: AnimatingNodeConfig, @@ -130,41 +133,41 @@ const API = { ), ); }, - stopAnimation: function(animationId: number) { + stopAnimation: function (animationId: number) { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.stopAnimation(animationId)); }, - setAnimatedNodeValue: function(nodeTag: number, value: number): void { + setAnimatedNodeValue: function (nodeTag: number, value: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.setAnimatedNodeValue(nodeTag, value), ); }, - setAnimatedNodeOffset: function(nodeTag: number, offset: number): void { + setAnimatedNodeOffset: function (nodeTag: number, offset: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.setAnimatedNodeOffset(nodeTag, offset), ); }, - flattenAnimatedNodeOffset: function(nodeTag: number): void { + flattenAnimatedNodeOffset: function (nodeTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.flattenAnimatedNodeOffset(nodeTag), ); }, - extractAnimatedNodeOffset: function(nodeTag: number): void { + extractAnimatedNodeOffset: function (nodeTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.extractAnimatedNodeOffset(nodeTag), ); }, - connectAnimatedNodeToView: function(nodeTag: number, viewTag: number): void { + connectAnimatedNodeToView: function (nodeTag: number, viewTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.connectAnimatedNodeToView(nodeTag, viewTag), ); }, - disconnectAnimatedNodeFromView: function( + disconnectAnimatedNodeFromView: function ( nodeTag: number, viewTag: number, ): void { @@ -173,7 +176,7 @@ const API = { NativeAnimatedModule.disconnectAnimatedNodeFromView(nodeTag, viewTag), ); }, - restoreDefaultValues: function(nodeTag: number): void { + restoreDefaultValues: function (nodeTag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); // Backwards compat with older native runtimes, can be removed later. if (NativeAnimatedModule.restoreDefaultValues != null) { @@ -182,11 +185,11 @@ const API = { ); } }, - dropAnimatedNode: function(tag: number): void { + dropAnimatedNode: function (tag: number): void { invariant(NativeAnimatedModule, 'Native animated module is not available'); API.queueOperation(() => NativeAnimatedModule.dropAnimatedNode(tag)); }, - addAnimatedEventToView: function( + addAnimatedEventToView: function ( viewTag: number, eventName: string, eventMapping: EventMapping, diff --git a/Libraries/Animated/NativeAnimatedModule.js b/Libraries/Animated/NativeAnimatedModule.js index d126bfdaff96..167ca596d894 100644 --- a/Libraries/Animated/NativeAnimatedModule.js +++ b/Libraries/Animated/NativeAnimatedModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/NativeAnimatedTurboModule.js b/Libraries/Animated/NativeAnimatedTurboModule.js index 03ff0f261165..b67fe15013a8 100644 --- a/Libraries/Animated/NativeAnimatedTurboModule.js +++ b/Libraries/Animated/NativeAnimatedTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/SpringConfig.js b/Libraries/Animated/SpringConfig.js index 5dd212ca1100..c687f6b97126 100644 --- a/Libraries/Animated/SpringConfig.js +++ b/Libraries/Animated/SpringConfig.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,11 +16,11 @@ type SpringConfigType = { ... }; -function stiffnessFromOrigamiValue(oValue) { +function stiffnessFromOrigamiValue(oValue: number) { return (oValue - 30) * 3.62 + 194; } -function dampingFromOrigamiValue(oValue) { +function dampingFromOrigamiValue(oValue: number) { return (oValue - 8) * 3 + 25; } @@ -38,31 +38,31 @@ function fromBouncinessAndSpeed( bounciness: number, speed: number, ): SpringConfigType { - function normalize(value, startValue, endValue) { + function normalize(value: number, startValue: number, endValue: number) { return (value - startValue) / (endValue - startValue); } - function projectNormal(n, start, end) { + function projectNormal(n: number, start: number, end: number) { return start + n * (end - start); } - function linearInterpolation(t, start, end) { + function linearInterpolation(t: number, start: number, end: number) { return t * end + (1 - t) * start; } - function quadraticOutInterpolation(t, start, end) { + function quadraticOutInterpolation(t: number, start: number, end: number) { return linearInterpolation(2 * t - t * t, start, end); } - function b3Friction1(x) { + function b3Friction1(x: number) { return 0.0007 * Math.pow(x, 3) - 0.031 * Math.pow(x, 2) + 0.64 * x + 1.28; } - function b3Friction2(x) { + function b3Friction2(x: number) { return 0.000044 * Math.pow(x, 3) - 0.006 * Math.pow(x, 2) + 0.36 * x + 2; } - function b3Friction3(x) { + function b3Friction3(x: number) { return ( 0.00000045 * Math.pow(x, 3) - 0.000332 * Math.pow(x, 2) + @@ -71,7 +71,7 @@ function fromBouncinessAndSpeed( ); } - function b3Nobounce(tension) { + function b3Nobounce(tension: number) { if (tension <= 18) { return b3Friction1(tension); } else if (tension > 18 && tension <= 44) { diff --git a/Libraries/Animated/__tests__/Animated-test.js b/Libraries/Animated/__tests__/Animated-test.js index d09684faadfa..8f62804c73b7 100644 --- a/Libraries/Animated/__tests__/Animated-test.js +++ b/Libraries/Animated/__tests__/Animated-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -140,21 +140,6 @@ describe('Animated tests', () => { expect(callback).toBeCalled(); }); - // This test is flaky and we are asking open source to fix it - // https://github.com/facebook/react-native/issues/21517 - it.skip('send toValue when an underdamped spring stops', () => { - const anim = new Animated.Value(0); - const listener = jest.fn(); - anim.addListener(listener); - Animated.spring(anim, {toValue: 15, useNativeDriver: false}).start(); - jest.runAllTimers(); - const lastValue = - listener.mock.calls[listener.mock.calls.length - 2][0].value; - expect(lastValue).not.toBe(15); - expect(lastValue).toBeCloseTo(15); - expect(anim.__getValue()).toBe(15); - }); - it('send toValue when a critically damped spring stops', () => { const anim = new Animated.Value(0); const listener = jest.fn(); @@ -797,6 +782,19 @@ describe('Animated tests', () => { value1.setValue(1492); expect(value2.__getValue()).toBe(7); }); + + it('should start tracking immediately on animation start', () => { + const value1 = new Animated.Value(42); + const value2 = new Animated.Value(0); + Animated.timing(value2, { + toValue: value1, + duration: 0, + useNativeDriver: false, + }).start(); + expect(value2.__getValue()).toBe(42); + value1.setValue(7); + expect(value2.__getValue()).toBe(7); + }); }); describe('Animated Vectors', () => { @@ -974,4 +972,115 @@ describe('Animated tests', () => { } }); }); + + describe('Animated Colors', () => { + it('should normalize colors', () => { + let color = new Animated.Color(); + expect(color.__getValue()).toEqual('rgba(0, 0, 0, 1)'); + + color = new Animated.Color({r: 11, g: 22, b: 33, a: 1.0}); + expect(color.__getValue()).toEqual('rgba(11, 22, 33, 1)'); + + color = new Animated.Color('rgba(255, 0, 0, 1.0)'); + expect(color.__getValue()).toEqual('rgba(255, 0, 0, 1)'); + + color = new Animated.Color('#ff0000ff'); + expect(color.__getValue()).toEqual('rgba(255, 0, 0, 1)'); + + color = new Animated.Color('red'); + expect(color.__getValue()).toEqual('rgba(255, 0, 0, 1)'); + + color = new Animated.Color({ + r: new Animated.Value(255), + g: new Animated.Value(0), + b: new Animated.Value(0), + a: new Animated.Value(1.0), + }); + expect(color.__getValue()).toEqual('rgba(255, 0, 0, 1)'); + + color = new Animated.Color('unknown'); + expect(color.__getValue()).toEqual('rgba(0, 0, 0, 1)'); + + color = new Animated.Color({key: 'value'}); + expect(color.__getValue()).toEqual('rgba(0, 0, 0, 1)'); + }); + + it('should animate colors', () => { + const color = new Animated.Color({r: 255, g: 0, b: 0, a: 1.0}); + const callback = jest.fn(); + const node = new AnimatedProps( + { + style: { + backgroundColor: color, + transform: [ + { + scale: color.a.interpolate({ + inputRange: [0, 1], + outputRange: [1, 2], + }), + }, + ], + }, + }, + callback, + ); + + expect(node.__getValue()).toEqual({ + style: { + backgroundColor: 'rgba(255, 0, 0, 1)', + transform: [{scale: 2}], + }, + }); + + node.__attach(); + expect(callback.mock.calls.length).toBe(0); + + color.setValue({r: 11, g: 22, b: 33, a: 0.5}); + expect(callback.mock.calls.length).toBe(4); + expect(node.__getValue()).toEqual({ + style: { + backgroundColor: 'rgba(11, 22, 33, 0.5)', + transform: [{scale: 1.5}], + }, + }); + + node.__detach(); + color.setValue({r: 255, g: 0, b: 0, a: 1.0}); + expect(callback.mock.calls.length).toBe(4); + }); + + it('should track colors', () => { + const color1 = new Animated.Color(); + const color2 = new Animated.Color(); + Animated.timing(color2, { + toValue: color1, + duration: 0, + useNativeDriver: false, + }).start(); + color1.setValue({r: 11, g: 22, b: 33, a: 0.5}); + expect(color2.__getValue()).toEqual('rgba(11, 22, 33, 0.5)'); + + // Make sure tracking keeps working (see stopTogether in ParallelConfig used + // by maybeVectorAnim). + color1.setValue({r: 255, g: 0, b: 0, a: 1.0}); + expect(color2.__getValue()).toEqual('rgba(255, 0, 0, 1)'); + }); + + it('should track with springs', () => { + const color1 = new Animated.Color(); + const color2 = new Animated.Color(); + Animated.spring(color2, { + toValue: color1, + tension: 3000, // faster spring for faster test + friction: 60, + useNativeDriver: false, + }).start(); + color1.setValue({r: 11, g: 22, b: 33, a: 0.5}); + jest.runAllTimers(); + expect(color2.__getValue()).toEqual('rgba(11, 22, 33, 0.5)'); + color1.setValue({r: 44, g: 55, b: 66, a: 0.0}); + jest.runAllTimers(); + expect(color2.__getValue()).toEqual('rgba(44, 55, 66, 0)'); + }); + }); }); diff --git a/Libraries/Animated/__tests__/AnimatedMock-test.js b/Libraries/Animated/__tests__/AnimatedMock-test.js index 8ba4e998b365..cc510feefefb 100644 --- a/Libraries/Animated/__tests__/AnimatedMock-test.js +++ b/Libraries/Animated/__tests__/AnimatedMock-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/__tests__/AnimatedNative-test.js b/Libraries/Animated/__tests__/AnimatedNative-test.js index a6655d83952c..677527e22c9d 100644 --- a/Libraries/Animated/__tests__/AnimatedNative-test.js +++ b/Libraries/Animated/__tests__/AnimatedNative-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -134,6 +134,28 @@ describe('Native Animated', () => { expect(opacity.__getValue()).toBe(1); }); + it('should deduct offset when saving value on unmount', () => { + NativeAnimatedModule.getValue = jest.fn((tag, saveCallback) => { + // Assume current raw value of value node is 0.5, the NativeAnimated + // getValue API returns the sum of raw value and offset, so return 1. + saveCallback(1); + }); + const opacity = new Animated.Value(0); + opacity.setOffset(0.5); + opacity.__makeNative(); + + const root = TestRenderer.create(); + const tag = opacity.__getNativeTag(); + + root.unmount(); + + expect(NativeAnimatedModule.getValue).toBeCalledWith( + tag, + expect.any(Function), + ); + expect(opacity.__getValue()).toBe(1); + }); + it('should extract offset', () => { const opacity = new Animated.Value(0); opacity.__makeNative(); @@ -382,15 +404,17 @@ describe('Native Animated', () => { expect.any(Number), {type: 'addition', input: expect.any(Array)}, ); - const additionCalls = NativeAnimatedModule.createAnimatedNode.mock.calls.filter( - call => call[1].type === 'addition', - ); + const additionCalls = + NativeAnimatedModule.createAnimatedNode.mock.calls.filter( + call => call[1].type === 'addition', + ); expect(additionCalls.length).toBe(1); const additionCall = additionCalls[0]; const additionNodeTag = additionCall[0]; - const additionConnectionCalls = NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( - call => call[1] === additionNodeTag, - ); + const additionConnectionCalls = + NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( + call => call[1] === additionNodeTag, + ); expect(additionConnectionCalls.length).toBe(2); expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith( additionCall[1].input[0], @@ -424,15 +448,17 @@ describe('Native Animated', () => { expect.any(Number), {type: 'subtraction', input: expect.any(Array)}, ); - const subtractionCalls = NativeAnimatedModule.createAnimatedNode.mock.calls.filter( - call => call[1].type === 'subtraction', - ); + const subtractionCalls = + NativeAnimatedModule.createAnimatedNode.mock.calls.filter( + call => call[1].type === 'subtraction', + ); expect(subtractionCalls.length).toBe(1); const subtractionCall = subtractionCalls[0]; const subtractionNodeTag = subtractionCall[0]; - const subtractionConnectionCalls = NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( - call => call[1] === subtractionNodeTag, - ); + const subtractionConnectionCalls = + NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( + call => call[1] === subtractionNodeTag, + ); expect(subtractionConnectionCalls.length).toBe(2); expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith( subtractionCall[1].input[0], @@ -466,15 +492,17 @@ describe('Native Animated', () => { expect.any(Number), {type: 'multiplication', input: expect.any(Array)}, ); - const multiplicationCalls = NativeAnimatedModule.createAnimatedNode.mock.calls.filter( - call => call[1].type === 'multiplication', - ); + const multiplicationCalls = + NativeAnimatedModule.createAnimatedNode.mock.calls.filter( + call => call[1].type === 'multiplication', + ); expect(multiplicationCalls.length).toBe(1); const multiplicationCall = multiplicationCalls[0]; const multiplicationNodeTag = multiplicationCall[0]; - const multiplicationConnectionCalls = NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( - call => call[1] === multiplicationNodeTag, - ); + const multiplicationConnectionCalls = + NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( + call => call[1] === multiplicationNodeTag, + ); expect(multiplicationConnectionCalls.length).toBe(2); expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith( multiplicationCall[1].input[0], @@ -508,15 +536,17 @@ describe('Native Animated', () => { expect.any(Number), {type: 'division', input: expect.any(Array)}, ); - const divisionCalls = NativeAnimatedModule.createAnimatedNode.mock.calls.filter( - call => call[1].type === 'division', - ); + const divisionCalls = + NativeAnimatedModule.createAnimatedNode.mock.calls.filter( + call => call[1].type === 'division', + ); expect(divisionCalls.length).toBe(1); const divisionCall = divisionCalls[0]; const divisionNodeTag = divisionCall[0]; - const divisionConnectionCalls = NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( - call => call[1] === divisionNodeTag, - ); + const divisionConnectionCalls = + NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( + call => call[1] === divisionNodeTag, + ); expect(divisionConnectionCalls.length).toBe(2); expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith( divisionCall[1].input[0], @@ -548,15 +578,17 @@ describe('Native Animated', () => { expect.any(Number), {type: 'modulus', modulus: 4, input: expect.any(Number)}, ); - const moduloCalls = NativeAnimatedModule.createAnimatedNode.mock.calls.filter( - call => call[1].type === 'modulus', - ); + const moduloCalls = + NativeAnimatedModule.createAnimatedNode.mock.calls.filter( + call => call[1].type === 'modulus', + ); expect(moduloCalls.length).toBe(1); const moduloCall = moduloCalls[0]; const moduloNodeTag = moduloCall[0]; - const moduloConnectionCalls = NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( - call => call[1] === moduloNodeTag, - ); + const moduloConnectionCalls = + NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( + call => call[1] === moduloNodeTag, + ); expect(moduloConnectionCalls.length).toBe(1); expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith( moduloCall[1].input, @@ -597,12 +629,14 @@ describe('Native Animated', () => { extrapolateRight: 'extend', }, ); - const interpolationNodeTag = NativeAnimatedModule.createAnimatedNode.mock.calls.find( - call => call[1].type === 'interpolation', - )[0]; - const valueNodeTag = NativeAnimatedModule.createAnimatedNode.mock.calls.find( - call => call[1].type === 'value', - )[0]; + const interpolationNodeTag = + NativeAnimatedModule.createAnimatedNode.mock.calls.find( + call => call[1].type === 'interpolation', + )[0]; + const valueNodeTag = + NativeAnimatedModule.createAnimatedNode.mock.calls.find( + call => call[1].type === 'value', + )[0]; expect(NativeAnimatedModule.connectAnimatedNodes).toBeCalledWith( valueNodeTag, interpolationNodeTag, @@ -649,15 +683,17 @@ describe('Native Animated', () => { expect.any(Number), {type: 'diffclamp', input: expect.any(Number), max: 20, min: 0}, ); - const diffClampCalls = NativeAnimatedModule.createAnimatedNode.mock.calls.filter( - call => call[1].type === 'diffclamp', - ); + const diffClampCalls = + NativeAnimatedModule.createAnimatedNode.mock.calls.filter( + call => call[1].type === 'diffclamp', + ); expect(diffClampCalls.length).toBe(1); const diffClampCall = diffClampCalls[0]; const diffClampNodeTag = diffClampCall[0]; - const diffClampConnectionCalls = NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( - call => call[1] === diffClampNodeTag, - ); + const diffClampConnectionCalls = + NativeAnimatedModule.connectAnimatedNodes.mock.calls.filter( + call => call[1] === diffClampNodeTag, + ); expect(diffClampConnectionCalls.length).toBe(1); expect(NativeAnimatedModule.createAnimatedNode).toBeCalledWith( diffClampCall[1].input, @@ -914,6 +950,30 @@ describe('Native Animated', () => { animation.stop(); expect(NativeAnimatedModule.stopAnimation).toBeCalledWith(animationId); }); + + it('calls stopAnimation callback with native value', () => { + NativeAnimatedModule.getValue = jest.fn((tag, saveCallback) => { + saveCallback(1); + }); + + const anim = new Animated.Value(0); + Animated.timing(anim, { + duration: 1000, + useNativeDriver: true, + }).start(); + + const tag = anim.__getNativeTag(); + + let currentValue = 0; + anim.stopAnimation(value => (currentValue = value)); + + expect(NativeAnimatedModule.getValue).toBeCalledWith( + tag, + expect.any(Function), + ); + + expect(currentValue).toEqual(1); + }); }); describe('Animated Components', () => { diff --git a/Libraries/Animated/__tests__/Easing-test.js b/Libraries/Animated/__tests__/Easing-test.js index 409b1a7c3a8b..8efeed00037d 100644 --- a/Libraries/Animated/__tests__/Easing-test.js +++ b/Libraries/Animated/__tests__/Easing-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -91,366 +91,145 @@ describe('Easing', () => { const Samples = { in_quad: [ - 0, - 0.0030864197530864196, - 0.012345679012345678, - 0.027777777777777776, - 0.04938271604938271, - 0.0771604938271605, - 0.1111111111111111, - 0.15123456790123457, - 0.19753086419753085, - 0.25, - 0.308641975308642, - 0.37345679012345684, - 0.4444444444444444, - 0.5216049382716049, - 0.6049382716049383, - 0.6944444444444445, - 0.7901234567901234, - 0.8919753086419753, - 1, + 0, 0.0030864197530864196, 0.012345679012345678, 0.027777777777777776, + 0.04938271604938271, 0.0771604938271605, 0.1111111111111111, + 0.15123456790123457, 0.19753086419753085, 0.25, 0.308641975308642, + 0.37345679012345684, 0.4444444444444444, 0.5216049382716049, + 0.6049382716049383, 0.6944444444444445, 0.7901234567901234, + 0.8919753086419753, 1, ], out_quad: [ - 0, - 0.10802469135802469, - 0.20987654320987653, - 0.3055555555555555, - 0.3950617283950617, - 0.47839506172839513, - 0.5555555555555556, - 0.6265432098765432, - 0.691358024691358, - 0.75, - 0.8024691358024691, - 0.8487654320987654, - 0.888888888888889, - 0.9228395061728394, - 0.9506172839506174, - 0.9722222222222221, - 0.9876543209876543, - 0.9969135802469136, - 1, + 0, 0.10802469135802469, 0.20987654320987653, 0.3055555555555555, + 0.3950617283950617, 0.47839506172839513, 0.5555555555555556, + 0.6265432098765432, 0.691358024691358, 0.75, 0.8024691358024691, + 0.8487654320987654, 0.888888888888889, 0.9228395061728394, + 0.9506172839506174, 0.9722222222222221, 0.9876543209876543, + 0.9969135802469136, 1, ], inOut_quad: [ - 0, - 0.006172839506172839, - 0.024691358024691357, - 0.05555555555555555, - 0.09876543209876543, - 0.154320987654321, - 0.2222222222222222, - 0.30246913580246915, - 0.3950617283950617, - 0.5, - 0.6049382716049383, - 0.697530864197531, - 0.7777777777777777, - 0.845679012345679, - 0.9012345679012346, - 0.9444444444444444, - 0.9753086419753086, - 0.9938271604938271, - 1, + 0, 0.006172839506172839, 0.024691358024691357, 0.05555555555555555, + 0.09876543209876543, 0.154320987654321, 0.2222222222222222, + 0.30246913580246915, 0.3950617283950617, 0.5, 0.6049382716049383, + 0.697530864197531, 0.7777777777777777, 0.845679012345679, + 0.9012345679012346, 0.9444444444444444, 0.9753086419753086, + 0.9938271604938271, 1, ], in_cubic: [ - 0, - 0.00017146776406035664, - 0.0013717421124828531, - 0.004629629629629629, - 0.010973936899862825, - 0.021433470507544586, - 0.037037037037037035, - 0.05881344307270234, - 0.0877914951989026, - 0.125, - 0.1714677640603567, - 0.22822359396433475, - 0.2962962962962963, - 0.37671467764060357, - 0.4705075445816187, - 0.5787037037037038, - 0.7023319615912208, - 0.8424211248285322, - 1, + 0, 0.00017146776406035664, 0.0013717421124828531, 0.004629629629629629, + 0.010973936899862825, 0.021433470507544586, 0.037037037037037035, + 0.05881344307270234, 0.0877914951989026, 0.125, 0.1714677640603567, + 0.22822359396433475, 0.2962962962962963, 0.37671467764060357, + 0.4705075445816187, 0.5787037037037038, 0.7023319615912208, + 0.8424211248285322, 1, ], out_cubic: [ - 0, - 0.15757887517146785, - 0.2976680384087792, - 0.42129629629629617, - 0.5294924554183813, - 0.6232853223593964, - 0.7037037037037036, - 0.7717764060356652, - 0.8285322359396433, - 0.875, - 0.9122085048010974, - 0.9411865569272977, - 0.9629629629629629, - 0.9785665294924554, - 0.9890260631001372, - 0.9953703703703703, - 0.9986282578875172, - 0.9998285322359396, - 1, + 0, 0.15757887517146785, 0.2976680384087792, 0.42129629629629617, + 0.5294924554183813, 0.6232853223593964, 0.7037037037037036, + 0.7717764060356652, 0.8285322359396433, 0.875, 0.9122085048010974, + 0.9411865569272977, 0.9629629629629629, 0.9785665294924554, + 0.9890260631001372, 0.9953703703703703, 0.9986282578875172, + 0.9998285322359396, 1, ], inOut_cubic: [ - 0, - 0.0006858710562414266, - 0.0054869684499314125, - 0.018518518518518517, - 0.0438957475994513, - 0.08573388203017834, - 0.14814814814814814, - 0.23525377229080935, - 0.3511659807956104, - 0.5, - 0.6488340192043895, - 0.7647462277091908, - 0.8518518518518519, - 0.9142661179698217, - 0.9561042524005487, - 0.9814814814814815, - 0.9945130315500685, - 0.9993141289437586, - 1, + 0, 0.0006858710562414266, 0.0054869684499314125, 0.018518518518518517, + 0.0438957475994513, 0.08573388203017834, 0.14814814814814814, + 0.23525377229080935, 0.3511659807956104, 0.5, 0.6488340192043895, + 0.7647462277091908, 0.8518518518518519, 0.9142661179698217, + 0.9561042524005487, 0.9814814814814815, 0.9945130315500685, + 0.9993141289437586, 1, ], in_sin: [ - 0, - 0.003805301908254455, - 0.01519224698779198, - 0.03407417371093169, - 0.06030737921409157, - 0.09369221296335006, - 0.1339745962155613, - 0.1808479557110082, - 0.233955556881022, - 0.2928932188134524, - 0.35721239031346064, - 0.42642356364895384, - 0.4999999999999999, - 0.5773817382593005, - 0.6579798566743311, - 0.7411809548974793, - 0.8263518223330696, - 0.9128442572523416, - 0.9999999999999999, + 0, 0.003805301908254455, 0.01519224698779198, 0.03407417371093169, + 0.06030737921409157, 0.09369221296335006, 0.1339745962155613, + 0.1808479557110082, 0.233955556881022, 0.2928932188134524, + 0.35721239031346064, 0.42642356364895384, 0.4999999999999999, + 0.5773817382593005, 0.6579798566743311, 0.7411809548974793, + 0.8263518223330696, 0.9128442572523416, 0.9999999999999999, ], out_sin: [ - 0, - 0.08715574274765817, - 0.17364817766693033, - 0.25881904510252074, - 0.3420201433256687, - 0.42261826174069944, - 0.49999999999999994, - 0.573576436351046, - 0.6427876096865393, - 0.7071067811865475, - 0.766044443118978, - 0.8191520442889918, - 0.8660254037844386, - 0.9063077870366499, - 0.9396926207859083, - 0.9659258262890683, - 0.984807753012208, - 0.9961946980917455, - 1, + 0, 0.08715574274765817, 0.17364817766693033, 0.25881904510252074, + 0.3420201433256687, 0.42261826174069944, 0.49999999999999994, + 0.573576436351046, 0.6427876096865393, 0.7071067811865475, + 0.766044443118978, 0.8191520442889918, 0.8660254037844386, + 0.9063077870366499, 0.9396926207859083, 0.9659258262890683, + 0.984807753012208, 0.9961946980917455, 1, ], inOut_sin: [ - 0, - 0.00759612349389599, - 0.030153689607045786, - 0.06698729810778065, - 0.116977778440511, - 0.17860619515673032, - 0.24999999999999994, - 0.32898992833716556, - 0.4131759111665348, - 0.49999999999999994, - 0.5868240888334652, - 0.6710100716628343, - 0.7499999999999999, - 0.8213938048432696, - 0.883022221559489, - 0.9330127018922194, - 0.9698463103929542, - 0.9924038765061041, - 1, + 0, 0.00759612349389599, 0.030153689607045786, 0.06698729810778065, + 0.116977778440511, 0.17860619515673032, 0.24999999999999994, + 0.32898992833716556, 0.4131759111665348, 0.49999999999999994, + 0.5868240888334652, 0.6710100716628343, 0.7499999999999999, + 0.8213938048432696, 0.883022221559489, 0.9330127018922194, + 0.9698463103929542, 0.9924038765061041, 1, ], in_exp: [ - 0, - 0.0014352875901128893, - 0.002109491677524035, - 0.0031003926796253885, - 0.004556754060844206, - 0.006697218616039631, - 0.009843133202303688, - 0.014466792379488908, - 0.021262343752724643, - 0.03125, - 0.045929202883612456, - 0.06750373368076916, - 0.09921256574801243, - 0.1458161299470146, - 0.2143109957132682, - 0.31498026247371835, - 0.46293735614364506, - 0.6803950000871883, - 1, + 0, 0.0014352875901128893, 0.002109491677524035, 0.0031003926796253885, + 0.004556754060844206, 0.006697218616039631, 0.009843133202303688, + 0.014466792379488908, 0.021262343752724643, 0.03125, 0.045929202883612456, + 0.06750373368076916, 0.09921256574801243, 0.1458161299470146, + 0.2143109957132682, 0.31498026247371835, 0.46293735614364506, + 0.6803950000871883, 1, ], out_exp: [ - 0, - 0.31960499991281155, - 0.5370626438563548, - 0.6850197375262816, - 0.7856890042867318, - 0.8541838700529854, - 0.9007874342519875, - 0.9324962663192309, - 0.9540707971163875, - 0.96875, - 0.9787376562472754, - 0.9855332076205111, - 0.9901568667976963, - 0.9933027813839603, - 0.9954432459391558, - 0.9968996073203746, - 0.9978905083224759, - 0.9985647124098871, - 1, + 0, 0.31960499991281155, 0.5370626438563548, 0.6850197375262816, + 0.7856890042867318, 0.8541838700529854, 0.9007874342519875, + 0.9324962663192309, 0.9540707971163875, 0.96875, 0.9787376562472754, + 0.9855332076205111, 0.9901568667976963, 0.9933027813839603, + 0.9954432459391558, 0.9968996073203746, 0.9978905083224759, + 0.9985647124098871, 1, ], inOut_exp: [ - 0, - 0.0010547458387620175, - 0.002278377030422103, - 0.004921566601151844, - 0.010631171876362321, - 0.022964601441806228, - 0.049606282874006216, - 0.1071554978566341, - 0.23146867807182253, - 0.5, - 0.7685313219281775, - 0.892844502143366, - 0.9503937171259937, - 0.9770353985581938, - 0.9893688281236377, - 0.9950784333988482, - 0.9977216229695779, - 0.998945254161238, - 1, + 0, 0.0010547458387620175, 0.002278377030422103, 0.004921566601151844, + 0.010631171876362321, 0.022964601441806228, 0.049606282874006216, + 0.1071554978566341, 0.23146867807182253, 0.5, 0.7685313219281775, + 0.892844502143366, 0.9503937171259937, 0.9770353985581938, + 0.9893688281236377, 0.9950784333988482, 0.9977216229695779, + 0.998945254161238, 1, ], in_circle: [ - 0, - 0.0015444024660317135, - 0.006192010000093506, - 0.013986702816730645, - 0.025003956956430873, - 0.03935464078941209, - 0.057190958417936644, - 0.07871533601238889, - 0.10419358352238339, - 0.1339745962155614, - 0.1685205807169019, - 0.20845517506805522, - 0.2546440075000701, - 0.3083389112228482, - 0.37146063894529113, - 0.4472292016074334, - 0.5418771527091488, - 0.6713289009389102, - 1, + 0, 0.0015444024660317135, 0.006192010000093506, 0.013986702816730645, + 0.025003956956430873, 0.03935464078941209, 0.057190958417936644, + 0.07871533601238889, 0.10419358352238339, 0.1339745962155614, + 0.1685205807169019, 0.20845517506805522, 0.2546440075000701, + 0.3083389112228482, 0.37146063894529113, 0.4472292016074334, + 0.5418771527091488, 0.6713289009389102, 1, ], out_circle: [ - 0, - 0.3286710990610898, - 0.45812284729085123, - 0.5527707983925666, - 0.6285393610547089, - 0.6916610887771518, - 0.7453559924999298, - 0.7915448249319448, - 0.8314794192830981, - 0.8660254037844386, - 0.8958064164776166, - 0.9212846639876111, - 0.9428090415820634, - 0.9606453592105879, - 0.9749960430435691, - 0.9860132971832694, - 0.9938079899999065, - 0.9984555975339683, - 1, + 0, 0.3286710990610898, 0.45812284729085123, 0.5527707983925666, + 0.6285393610547089, 0.6916610887771518, 0.7453559924999298, + 0.7915448249319448, 0.8314794192830981, 0.8660254037844386, + 0.8958064164776166, 0.9212846639876111, 0.9428090415820634, + 0.9606453592105879, 0.9749960430435691, 0.9860132971832694, + 0.9938079899999065, 0.9984555975339683, 1, ], inOut_circle: [ - 0, - 0.003096005000046753, - 0.012501978478215436, - 0.028595479208968322, - 0.052096791761191696, - 0.08426029035845095, - 0.12732200375003505, - 0.18573031947264557, - 0.2709385763545744, - 0.5, - 0.7290614236454256, - 0.8142696805273546, - 0.8726779962499649, - 0.915739709641549, - 0.9479032082388084, - 0.9714045207910317, - 0.9874980215217846, - 0.9969039949999532, - 1, + 0, 0.003096005000046753, 0.012501978478215436, 0.028595479208968322, + 0.052096791761191696, 0.08426029035845095, 0.12732200375003505, + 0.18573031947264557, 0.2709385763545744, 0.5, 0.7290614236454256, + 0.8142696805273546, 0.8726779962499649, 0.915739709641549, + 0.9479032082388084, 0.9714045207910317, 0.9874980215217846, + 0.9969039949999532, 1, ], in_back_: [ - 0, - -0.004788556241426612, - -0.017301289437585736, - -0.0347587962962963, - -0.05438167352537723, - -0.07339051783264748, - -0.08900592592592595, - -0.09844849451303156, - -0.0989388203017833, - -0.08769750000000004, - -0.06194513031550073, - -0.018902307956104283, - 0.044210370370370254, - 0.13017230795610413, - 0.2417629080932785, - 0.3817615740740742, - 0.5529477091906719, - 0.7581007167352535, - 0.9999999999999998, + 0, -0.004788556241426612, -0.017301289437585736, -0.0347587962962963, + -0.05438167352537723, -0.07339051783264748, -0.08900592592592595, + -0.09844849451303156, -0.0989388203017833, -0.08769750000000004, + -0.06194513031550073, -0.018902307956104283, 0.044210370370370254, + 0.13017230795610413, 0.2417629080932785, 0.3817615740740742, + 0.5529477091906719, 0.7581007167352535, 0.9999999999999998, ], out_back_: [ - 2.220446049250313e-16, - 0.24189928326474652, - 0.44705229080932807, - 0.6182384259259258, - 0.7582370919067215, - 0.8698276920438959, - 0.9557896296296297, - 1.0189023079561044, - 1.0619451303155008, - 1.0876975, - 1.0989388203017834, - 1.0984484945130315, - 1.089005925925926, - 1.0733905178326475, - 1.0543816735253773, - 1.0347587962962963, - 1.0173012894375857, - 1.0047885562414267, - 1, + 2.220446049250313e-16, 0.24189928326474652, 0.44705229080932807, + 0.6182384259259258, 0.7582370919067215, 0.8698276920438959, + 0.9557896296296297, 1.0189023079561044, 1.0619451303155008, 1.0876975, + 1.0989388203017834, 1.0984484945130315, 1.089005925925926, + 1.0733905178326475, 1.0543816735253773, 1.0347587962962963, + 1.0173012894375857, 1.0047885562414267, 1, ], }; - Object.keys(Samples).forEach(function(type) { - it('should ease ' + type, function() { + Object.keys(Samples).forEach(function (type) { + it('should ease ' + type, function () { const [modeName, easingName, isFunction] = type.split('_'); let easing = Easing[easingName]; if (isFunction !== undefined) { diff --git a/Libraries/Animated/__tests__/Interpolation-test.js b/Libraries/Animated/__tests__/Interpolation-test.js index 2bdebfd4935c..64585ac683bd 100644 --- a/Libraries/Animated/__tests__/Interpolation-test.js +++ b/Libraries/Animated/__tests__/Interpolation-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/__tests__/TimingAnimation-test.js b/Libraries/Animated/__tests__/TimingAnimation-test.js index 8576ea426ba8..e82407876a2d 100644 --- a/Libraries/Animated/__tests__/TimingAnimation-test.js +++ b/Libraries/Animated/__tests__/TimingAnimation-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/__tests__/bezier-test.js b/Libraries/Animated/__tests__/bezier-test.js index e7be582a524c..1a02d7ad62ba 100644 --- a/Libraries/Animated/__tests__/bezier-test.js +++ b/Libraries/Animated/__tests__/bezier-test.js @@ -1,5 +1,5 @@ /** - * Portions Copyright (c) Facebook, Inc. and its affiliates. + * Portions Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,7 @@ const bezier = require('../bezier'); -const identity = function(x) { +const identity = function (x) { return x; }; @@ -28,7 +28,7 @@ function assertClose(a, b, precision = 3) { } function makeAssertCloseWithPrecision(precision) { - return function(a, b) { + return function (a, b) { assertClose(a, b, precision); }; } @@ -44,43 +44,43 @@ function allEquals(be1, be2, samples, assertion) { } function repeat(n) { - return function(f) { + return function (f) { for (let i = 0; i < n; ++i) { f(); } }; } -describe('bezier', function() { - it('should be a function', function() { +describe('bezier', function () { + it('should be a function', function () { expect(typeof bezier === 'function').toBe(true); }); - it('should creates an object', function() { + it('should creates an object', function () { expect(typeof bezier(0, 0, 1, 1) === 'function').toBe(true); }); - it('should fail with wrong arguments', function() { - expect(function() { + it('should fail with wrong arguments', function () { + expect(function () { bezier(0.5, 0.5, -5, 0.5); }).toThrow(); - expect(function() { + expect(function () { bezier(0.5, 0.5, 5, 0.5); }).toThrow(); - expect(function() { + expect(function () { bezier(-2, 0.5, 0.5, 0.5); }).toThrow(); - expect(function() { + expect(function () { bezier(2, 0.5, 0.5, 0.5); }).toThrow(); }); - describe('linear curves', function() { - it('should be linear', function() { + describe('linear curves', function () { + it('should be linear', function () { allEquals(bezier(0, 0, 1, 1), bezier(1, 1, 0, 0), 100); allEquals(bezier(0, 0, 1, 1), identity, 100); }); }); - describe('common properties', function() { - it('should be the right value at extremes', function() { - repeat(10)(function() { + describe('common properties', function () { + it('should be the right value at extremes', function () { + repeat(10)(function () { const a = Math.random(), b = 2 * Math.random() - 0.5, c = Math.random(), @@ -91,24 +91,24 @@ describe('bezier', function() { }); }); - it('should approach the projected value of its x=y projected curve', function() { - repeat(10)(function() { + it('should approach the projected value of its x=y projected curve', function () { + repeat(10)(function () { const a = Math.random(), b = Math.random(), c = Math.random(), d = Math.random(); const easing = bezier(a, b, c, d); const projected = bezier(b, a, d, c); - const composed = function(x) { + const composed = function (x) { return projected(easing(x)); }; allEquals(identity, composed, 100, makeAssertCloseWithPrecision(2)); }); }); }); - describe('two same instances', function() { - it('should be strictly equals', function() { - repeat(10)(function() { + describe('two same instances', function () { + it('should be strictly equals', function () { + repeat(10)(function () { const a = Math.random(), b = 2 * Math.random() - 0.5, c = Math.random(), @@ -117,9 +117,9 @@ describe('bezier', function() { }); }); }); - describe('symmetric curves', function() { - it('should have a central value y~=0.5 at x=0.5', function() { - repeat(10)(function() { + describe('symmetric curves', function () { + it('should have a central value y~=0.5 at x=0.5', function () { + repeat(10)(function () { const a = Math.random(), b = 2 * Math.random() - 0.5, c = 1 - a, @@ -128,14 +128,14 @@ describe('bezier', function() { assertClose(easing(0.5), 0.5, 2); }); }); - it('should be symmetrical', function() { - repeat(10)(function() { + it('should be symmetrical', function () { + repeat(10)(function () { const a = Math.random(), b = 2 * Math.random() - 0.5, c = 1 - a, d = 1 - b; const easing = bezier(a, b, c, d); - const sym = function(x) { + const sym = function (x) { return 1 - easing(1 - x); }; allEquals(easing, sym, 100, makeAssertCloseWithPrecision(2)); diff --git a/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js b/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js index e82ea170a3eb..9d8fa9b1869d 100644 --- a/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js +++ b/Libraries/Animated/__tests__/createAnimatedComponentInjection-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/animations/Animation.js b/Libraries/Animated/animations/Animation.js index 3555bf2cc266..f22c5e9e4ada 100644 --- a/Libraries/Animated/animations/Animation.js +++ b/Libraries/Animated/animations/Animation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,7 +11,7 @@ 'use strict'; const NativeAnimatedHelper = require('../NativeAnimatedHelper'); - +import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type AnimatedValue from '../nodes/AnimatedValue'; export type EndResult = {finished: boolean, ...}; @@ -20,6 +20,7 @@ export type EndCallback = (result: EndResult) => void; export type AnimationConfig = { isInteraction?: boolean, useNativeDriver: boolean, + platformConfig?: PlatformConfig, onComplete?: ?EndCallback, iterations?: number, }; @@ -65,12 +66,13 @@ class Animation { startNativeAnimationWaitId, ); try { - animatedValue.__makeNative(); + const config = this.__getNativeAnimationConfig(); + animatedValue.__makeNative(config.platformConfig); this.__nativeId = NativeAnimatedHelper.generateNewAnimationId(); NativeAnimatedHelper.API.startAnimatingNode( this.__nativeId, animatedValue.__getNativeTag(), - this.__getNativeAnimationConfig(), + config, // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.__debouncedOnEnd.bind(this), ); diff --git a/Libraries/Animated/animations/DecayAnimation.js b/Libraries/Animated/animations/DecayAnimation.js index b04b911e7600..c53ff08ac0fe 100644 --- a/Libraries/Animated/animations/DecayAnimation.js +++ b/Libraries/Animated/animations/DecayAnimation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,6 +14,7 @@ const Animation = require('./Animation'); const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type AnimatedValue from '../nodes/AnimatedValue'; import type {AnimationConfig, EndCallback} from './Animation'; @@ -44,12 +45,14 @@ class DecayAnimation extends Animation { _onUpdate: (value: number) => void; _animationFrame: any; _useNativeDriver: boolean; + _platformConfig: ?PlatformConfig; constructor(config: DecayAnimationConfigSingle) { super(); this._deceleration = config.deceleration ?? 0.998; this._velocity = config.velocity; this._useNativeDriver = shouldUseNativeDriver(config); + this._platformConfig = config.platformConfig; this.__isInteraction = config.isInteraction ?? !this._useNativeDriver; this.__iterations = config.iterations ?? 1; } @@ -57,6 +60,7 @@ class DecayAnimation extends Animation { __getNativeAnimationConfig(): {| deceleration: number, iterations: number, + platformConfig: ?PlatformConfig, type: $TEMPORARY$string<'decay'>, velocity: number, |} { @@ -65,6 +69,7 @@ class DecayAnimation extends Animation { deceleration: this._deceleration, velocity: this._velocity, iterations: this.__iterations, + platformConfig: this._platformConfig, }; } diff --git a/Libraries/Animated/animations/SpringAnimation.js b/Libraries/Animated/animations/SpringAnimation.js index e09db93b7c53..471fe50216cd 100644 --- a/Libraries/Animated/animations/SpringAnimation.js +++ b/Libraries/Animated/animations/SpringAnimation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,8 +20,11 @@ const invariant = require('invariant'); const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {AnimationConfig, EndCallback} from './Animation'; +import AnimatedColor from '../nodes/AnimatedColor'; + export type SpringAnimationConfig = { ...AnimationConfig, toValue: @@ -33,6 +36,14 @@ export type SpringAnimationConfig = { ... } | AnimatedValueXY + | { + r: number, + g: number, + b: number, + a: number, + ... + } + | AnimatedColor | AnimatedInterpolation, overshootClamping?: boolean, restDisplacementThreshold?: number, @@ -92,6 +103,7 @@ class SpringAnimation extends Animation { _onUpdate: (value: number) => void; _animationFrame: any; _useNativeDriver: boolean; + _platformConfig: ?PlatformConfig; constructor(config: SpringAnimationConfigSingle) { super(); @@ -104,6 +116,7 @@ class SpringAnimation extends Animation { this._toValue = config.toValue; this._delay = config.delay ?? 0; this._useNativeDriver = shouldUseNativeDriver(config); + this._platformConfig = config.platformConfig; this.__isInteraction = config.isInteraction ?? !this._useNativeDriver; this.__iterations = config.iterations ?? 1; @@ -162,6 +175,7 @@ class SpringAnimation extends Animation { initialVelocity: number, iterations: number, mass: number, + platformConfig: ?PlatformConfig, overshootClamping: boolean, restDisplacementThreshold: number, restSpeedThreshold: number, @@ -180,6 +194,7 @@ class SpringAnimation extends Animation { initialVelocity: this._initialVelocity ?? this._lastVelocity, toValue: this._toValue, iterations: this.__iterations, + platformConfig: this._platformConfig, }; } diff --git a/Libraries/Animated/animations/TimingAnimation.js b/Libraries/Animated/animations/TimingAnimation.js index 7f239ce0102f..3ed0e0f12882 100644 --- a/Libraries/Animated/animations/TimingAnimation.js +++ b/Libraries/Animated/animations/TimingAnimation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,8 +17,11 @@ const Animation = require('./Animation'); const {shouldUseNativeDriver} = require('../NativeAnimatedHelper'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {AnimationConfig, EndCallback} from './Animation'; +import AnimatedColor from '../nodes/AnimatedColor'; + export type TimingAnimationConfig = { ...AnimationConfig, toValue: @@ -30,6 +33,14 @@ export type TimingAnimationConfig = { ... } | AnimatedValueXY + | { + r: number, + g: number, + b: number, + a: number, + ... + } + | AnimatedColor | AnimatedInterpolation, easing?: (value: number) => number, duration?: number, @@ -48,7 +59,6 @@ let _easeInOut; function easeInOut() { if (!_easeInOut) { const Easing = require('../Easing'); - // $FlowFixMe[method-unbinding] _easeInOut = Easing.inOut(Easing.ease); } return _easeInOut; @@ -65,6 +75,7 @@ class TimingAnimation extends Animation { _animationFrame: any; _timeout: any; _useNativeDriver: boolean; + _platformConfig: ?PlatformConfig; constructor(config: TimingAnimationConfigSingle) { super(); @@ -74,6 +85,7 @@ class TimingAnimation extends Animation { this._delay = config.delay ?? 0; this.__iterations = config.iterations ?? 1; this._useNativeDriver = shouldUseNativeDriver(config); + this._platformConfig = config.platformConfig; this.__isInteraction = config.isInteraction ?? !this._useNativeDriver; } @@ -90,6 +102,7 @@ class TimingAnimation extends Animation { frames, toValue: this._toValue, iterations: this.__iterations, + platformConfig: this._platformConfig, }; } diff --git a/Libraries/Animated/bezier.js b/Libraries/Animated/bezier.js index 0a53a33c7448..da60afa0ec32 100644 --- a/Libraries/Animated/bezier.js +++ b/Libraries/Animated/bezier.js @@ -1,5 +1,5 @@ /** - * Portions Copyright (c) Facebook, Inc. and its affiliates. + * Portions Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,27 +27,33 @@ const kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); const float32ArraySupported = typeof Float32Array === 'function'; -function A(aA1, aA2) { +function A(aA1: number, aA2: number) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } -function B(aA1, aA2) { +function B(aA1: number, aA2: number) { return 3.0 * aA2 - 6.0 * aA1; } -function C(aA1) { +function C(aA1: number) { return 3.0 * aA1; } // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2. -function calcBezier(aT, aA1, aA2) { +function calcBezier(aT: number, aA1: number, aA2: number) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2. -function getSlope(aT, aA1, aA2) { +function getSlope(aT: number, aA1: number, aA2: number) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } -function binarySubdivide(aX, _aA, _aB, mX1, mX2) { +function binarySubdivide( + aX: number, + _aA: number, + _aB: number, + mX1: number, + mX2: number, +) { let currentX, currentT, i = 0, @@ -68,7 +74,12 @@ function binarySubdivide(aX, _aA, _aB, mX1, mX2) { return currentT; } -function newtonRaphsonIterate(aX, _aGuessT, mX1, mX2) { +function newtonRaphsonIterate( + aX: number, + _aGuessT: number, + mX1: number, + mX2: number, +) { let aGuessT = _aGuessT; for (let i = 0; i < NEWTON_ITERATIONS; ++i) { const currentSlope = getSlope(aGuessT, mX1, mX2); @@ -101,7 +112,7 @@ module.exports = function bezier( } } - function getTForX(aX) { + function getTForX(aX: number) { let intervalStart = 0.0; let currentSample = 1; const lastSample = kSplineTableSize - 1; diff --git a/Libraries/Animated/components/AnimatedFlatList.js b/Libraries/Animated/components/AnimatedFlatList.js index 49a1ebcbd19b..ebe160f12e75 100644 --- a/Libraries/Animated/components/AnimatedFlatList.js +++ b/Libraries/Animated/components/AnimatedFlatList.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/components/AnimatedImage.js b/Libraries/Animated/components/AnimatedImage.js index c11cd41ff2a3..b0e7b9042020 100644 --- a/Libraries/Animated/components/AnimatedImage.js +++ b/Libraries/Animated/components/AnimatedImage.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/components/AnimatedScrollView.js b/Libraries/Animated/components/AnimatedScrollView.js index 8769f9382fd5..887948366ac8 100644 --- a/Libraries/Animated/components/AnimatedScrollView.js +++ b/Libraries/Animated/components/AnimatedScrollView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/components/AnimatedSectionList.js b/Libraries/Animated/components/AnimatedSectionList.js index 98ccd918460b..2c467a669982 100644 --- a/Libraries/Animated/components/AnimatedSectionList.js +++ b/Libraries/Animated/components/AnimatedSectionList.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/components/AnimatedText.js b/Libraries/Animated/components/AnimatedText.js index 98a0718f1652..0cd6cd5245d3 100644 --- a/Libraries/Animated/components/AnimatedText.js +++ b/Libraries/Animated/components/AnimatedText.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/components/AnimatedView.js b/Libraries/Animated/components/AnimatedView.js index 8f570cb371cd..75358b003d5d 100644 --- a/Libraries/Animated/components/AnimatedView.js +++ b/Libraries/Animated/components/AnimatedView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/createAnimatedComponent.js b/Libraries/Animated/createAnimatedComponent.js index 5ab4073d02b3..3272281e6334 100644 --- a/Libraries/Animated/createAnimatedComponent.js +++ b/Libraries/Animated/createAnimatedComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -168,7 +168,7 @@ function createAnimatedComponent( } }; - _attachProps(nextProps) { + _attachProps(nextProps: any) { const oldPropsAnimated = this._propsAnimated; this._propsAnimated = new AnimatedProps( @@ -234,12 +234,12 @@ function createAnimatedComponent( this._markUpdateComplete(); } - UNSAFE_componentWillReceiveProps(newProps) { + UNSAFE_componentWillReceiveProps(newProps: any) { this._waitForUpdate(); this._attachProps(newProps); } - componentDidUpdate(prevProps) { + componentDidUpdate(prevProps: any) { if (this._component !== this._prevComponent) { this._propsAnimated.setNativeView(this._component); } diff --git a/Libraries/Animated/createAnimatedComponentInjection.js b/Libraries/Animated/createAnimatedComponentInjection.js index 5a1727e959a9..ab172bf12ca2 100644 --- a/Libraries/Animated/createAnimatedComponentInjection.js +++ b/Libraries/Animated/createAnimatedComponentInjection.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js b/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js index a7d5f8169e56..b2cd04ac56e4 100644 --- a/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js +++ b/Libraries/Animated/createAnimatedComponent_EXPERIMENTAL.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Animated/nodes/AnimatedAddition.js b/Libraries/Animated/nodes/AnimatedAddition.js index e2887ab82993..409db6e4d6b7 100644 --- a/Libraries/Animated/nodes/AnimatedAddition.js +++ b/Libraries/Animated/nodes/AnimatedAddition.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,6 +15,7 @@ const AnimatedNode = require('./AnimatedNode'); const AnimatedValue = require('./AnimatedValue'); const AnimatedWithChildren = require('./AnimatedWithChildren'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {InterpolationConfigType} from './AnimatedInterpolation'; class AnimatedAddition extends AnimatedWithChildren { @@ -27,10 +28,10 @@ class AnimatedAddition extends AnimatedWithChildren { this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } - __makeNative() { - this._a.__makeNative(); - this._b.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._a.__makeNative(platformConfig); + this._b.__makeNative(platformConfig); + super.__makeNative(platformConfig); } __getValue(): number { diff --git a/Libraries/Animated/nodes/AnimatedColor.js b/Libraries/Animated/nodes/AnimatedColor.js new file mode 100644 index 000000000000..1178a45b24c6 --- /dev/null +++ b/Libraries/Animated/nodes/AnimatedColor.js @@ -0,0 +1,266 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ + +'use strict'; + +import AnimatedValue from './AnimatedValue'; +import AnimatedWithChildren from './AnimatedWithChildren'; +import normalizeColor from '../../StyleSheet/normalizeColor'; +import {processColorObject} from '../../StyleSheet/PlatformColorValueTypes'; + +import type {ColorValue} from '../../StyleSheet/StyleSheet'; +import type {NativeColorValue} from '../../StyleSheet/PlatformColorValueTypes'; + +type ColorListenerCallback = (value: string) => mixed; +type RgbaValue = { + +r: number, + +g: number, + +b: number, + +a: number, + ... +}; +type RgbaAnimatedValue = { + +r: AnimatedValue, + +g: AnimatedValue, + +b: AnimatedValue, + +a: AnimatedValue, + ... +}; + +const defaultColor: RgbaValue = {r: 0, g: 0, b: 0, a: 1.0}; +let _uniqueId = 1; + +/* eslint no-bitwise: 0 */ +function processColor(color?: ?ColorValue): ?(RgbaValue | NativeColorValue) { + if (color === undefined || color === null) { + return null; + } + + let normalizedColor = normalizeColor(color); + if (normalizedColor === undefined || normalizedColor === null) { + return null; + } + + if (typeof normalizedColor === 'object') { + const processedColorObj = processColorObject(normalizedColor); + if (processedColorObj != null) { + return processedColorObj; + } + } else if (typeof normalizedColor === 'number') { + const r = (normalizedColor & 0xff000000) >>> 24; + const g = (normalizedColor & 0x00ff0000) >>> 16; + const b = (normalizedColor & 0x0000ff00) >>> 8; + const a = (normalizedColor & 0x000000ff) / 255; + + return {r, g, b, a}; + } + + return null; +} + +function isRgbaValue(value: any): boolean { + return ( + value && + typeof value.r === 'number' && + typeof value.g === 'number' && + typeof value.b === 'number' && + typeof value.a === 'number' + ); +} + +function isRgbaAnimatedValue(value: any): boolean { + return ( + value && + value.r instanceof AnimatedValue && + value.g instanceof AnimatedValue && + value.b instanceof AnimatedValue && + value.a instanceof AnimatedValue + ); +} + +export default class AnimatedColor extends AnimatedWithChildren { + r: AnimatedValue; + g: AnimatedValue; + b: AnimatedValue; + a: AnimatedValue; + _listeners: { + [key: string]: { + r: string, + g: string, + b: string, + a: string, + ... + }, + ... + }; + + constructor(valueIn?: ?(RgbaValue | RgbaAnimatedValue | ColorValue)) { + super(); + let value: RgbaValue | RgbaAnimatedValue | ColorValue = + valueIn || defaultColor; + + if (isRgbaAnimatedValue(value)) { + // $FlowIgnore[incompatible-cast] - Type is verified above + const rgbaAnimatedValue: RgbaAnimatedValue = (value: RgbaAnimatedValue); + this.r = rgbaAnimatedValue.r; + this.g = rgbaAnimatedValue.g; + this.b = rgbaAnimatedValue.b; + this.a = rgbaAnimatedValue.a; + } else { + // Handle potential parsable string color or platform color object + if (!isRgbaValue(value)) { + // $FlowIgnore[incompatible-cast] - Type is verified via conditionals + value = processColor((value: ColorValue)) || {r: 0, g: 0, b: 0, a: 1.0}; + // TODO: support platform color + } + + // $FlowIgnore[incompatible-cast] - Type is verified via conditionals + const rgbaValue: RgbaValue = (value: RgbaValue); + this.r = new AnimatedValue(rgbaValue.r); + this.g = new AnimatedValue(rgbaValue.g); + this.b = new AnimatedValue(rgbaValue.b); + this.a = new AnimatedValue(rgbaValue.a); + } + this._listeners = {}; + } + + /** + * Directly set the value. This will stop any animations running on the value + * and update all the bound properties. + */ + setValue(value: {r: number, g: number, b: number, a: number, ...}): void { + this.r.setValue(value.r); + this.g.setValue(value.g); + this.b.setValue(value.b); + this.a.setValue(value.a); + } + + /** + * Sets an offset that is applied on top of whatever value is set, whether + * via `setValue`, an animation, or `Animated.event`. Useful for compensating + * things like the start of a pan gesture. + */ + setOffset(offset: {r: number, g: number, b: number, a: number, ...}): void { + this.r.setOffset(offset.r); + this.g.setOffset(offset.g); + this.b.setOffset(offset.b); + this.a.setOffset(offset.a); + } + + /** + * Merges the offset value into the base value and resets the offset to zero. + * The final output of the value is unchanged. + */ + flattenOffset(): void { + this.r.flattenOffset(); + this.g.flattenOffset(); + this.b.flattenOffset(); + this.a.flattenOffset(); + } + + /** + * Sets the offset value to the base value, and resets the base value to + * zero. The final output of the value is unchanged. + */ + extractOffset(): void { + this.r.extractOffset(); + this.g.extractOffset(); + this.b.extractOffset(); + this.a.extractOffset(); + } + + /** + * Adds an asynchronous listener to the value so you can observe updates from + * animations. This is useful because there is no way to synchronously read + * the value because it might be driven natively. + * + * Returns a string that serves as an identifier for the listener. + */ + addListener(callback: ColorListenerCallback): string { + const id = String(_uniqueId++); + const jointCallback = ({value: number}) => { + callback(this.__getValue()); + }; + this._listeners[id] = { + r: this.r.addListener(jointCallback), + g: this.g.addListener(jointCallback), + b: this.b.addListener(jointCallback), + a: this.a.addListener(jointCallback), + }; + return id; + } + + /** + * Unregister a listener. The `id` param shall match the identifier + * previously returned by `addListener()`. + */ + removeListener(id: string): void { + this.r.removeListener(this._listeners[id].r); + this.g.removeListener(this._listeners[id].g); + this.b.removeListener(this._listeners[id].b); + this.a.removeListener(this._listeners[id].a); + delete this._listeners[id]; + } + + /** + * Remove all registered listeners. + */ + removeAllListeners(): void { + this.r.removeAllListeners(); + this.g.removeAllListeners(); + this.b.removeAllListeners(); + this.a.removeAllListeners(); + this._listeners = {}; + } + + /** + * Stops any running animation or tracking. `callback` is invoked with the + * final value after stopping the animation, which is useful for updating + * state to match the animation position with layout. + */ + stopAnimation(callback?: (value: string) => void): void { + this.r.stopAnimation(); + this.g.stopAnimation(); + this.b.stopAnimation(); + this.a.stopAnimation(); + callback && callback(this.__getValue()); + } + + /** + * Stops any animation and resets the value to its original. + */ + resetAnimation(callback?: (value: string) => void): void { + this.r.resetAnimation(); + this.g.resetAnimation(); + this.b.resetAnimation(); + this.a.resetAnimation(); + callback && callback(this.__getValue()); + } + + __getValue(): string { + return `rgba(${this.r.__getValue()}, ${this.g.__getValue()}, ${this.b.__getValue()}, ${this.a.__getValue()})`; + } + + __attach(): void { + this.r.__addChild(this); + this.g.__addChild(this); + this.b.__addChild(this); + this.a.__addChild(this); + super.__attach(); + } + + __detach(): void { + this.r.__removeChild(this); + this.g.__removeChild(this); + this.b.__removeChild(this); + this.a.__removeChild(this); + super.__detach(); + } +} diff --git a/Libraries/Animated/nodes/AnimatedDiffClamp.js b/Libraries/Animated/nodes/AnimatedDiffClamp.js index 84eb3d715765..629e04cc6811 100644 --- a/Libraries/Animated/nodes/AnimatedDiffClamp.js +++ b/Libraries/Animated/nodes/AnimatedDiffClamp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,6 +15,7 @@ const AnimatedNode = require('./AnimatedNode'); const AnimatedWithChildren = require('./AnimatedWithChildren'); import type {InterpolationConfigType} from './AnimatedInterpolation'; +import type {PlatformConfig} from '../AnimatedPlatformConfig'; class AnimatedDiffClamp extends AnimatedWithChildren { _a: AnimatedNode; @@ -32,9 +33,9 @@ class AnimatedDiffClamp extends AnimatedWithChildren { this._value = this._lastValue = this._a.__getValue(); } - __makeNative() { - this._a.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._a.__makeNative(platformConfig); + super.__makeNative(platformConfig); } interpolate(config: InterpolationConfigType): AnimatedInterpolation { diff --git a/Libraries/Animated/nodes/AnimatedDivision.js b/Libraries/Animated/nodes/AnimatedDivision.js index fad47ae87d12..1dcd4622ac13 100644 --- a/Libraries/Animated/nodes/AnimatedDivision.js +++ b/Libraries/Animated/nodes/AnimatedDivision.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,6 +16,7 @@ const AnimatedValue = require('./AnimatedValue'); const AnimatedWithChildren = require('./AnimatedWithChildren'); import type {InterpolationConfigType} from './AnimatedInterpolation'; +import type {PlatformConfig} from '../AnimatedPlatformConfig'; class AnimatedDivision extends AnimatedWithChildren { _a: AnimatedNode; @@ -31,10 +32,10 @@ class AnimatedDivision extends AnimatedWithChildren { this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } - __makeNative() { - this._a.__makeNative(); - this._b.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._a.__makeNative(platformConfig); + this._b.__makeNative(platformConfig); + super.__makeNative(platformConfig); } __getValue(): number { diff --git a/Libraries/Animated/nodes/AnimatedInterpolation.js b/Libraries/Animated/nodes/AnimatedInterpolation.js index ce06272b5c6d..5ebea80ba102 100644 --- a/Libraries/Animated/nodes/AnimatedInterpolation.js +++ b/Libraries/Animated/nodes/AnimatedInterpolation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,8 @@ const NativeAnimatedHelper = require('../NativeAnimatedHelper'); const invariant = require('invariant'); const normalizeColor = require('../../StyleSheet/normalizeColor'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; + type ExtrapolateType = 'extend' | 'identity' | 'clamp'; export type InterpolationConfigType = { @@ -30,7 +32,7 @@ export type InterpolationConfigType = { extrapolateRight?: ExtrapolateType, }; -const linear = t => t; +const linear = (t: number) => t; /** * Very handy helper to map input ranges to output ranges with an easing @@ -248,7 +250,7 @@ function createInterpolationFromStringOutputRange( }; } -function isRgbOrRgba(range) { +function isRgbOrRgba(range: string) { return typeof range === 'string' && range.startsWith('rgb'); } @@ -317,9 +319,9 @@ class AnimatedInterpolation extends AnimatedWithChildren { this._interpolation = createInterpolation(config); } - __makeNative() { - this._parent.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._parent.__makeNative(platformConfig); + super.__makeNative(platformConfig); } __getValue(): number | string { diff --git a/Libraries/Animated/nodes/AnimatedModulo.js b/Libraries/Animated/nodes/AnimatedModulo.js index 48dd4a6157c6..88663cc0e124 100644 --- a/Libraries/Animated/nodes/AnimatedModulo.js +++ b/Libraries/Animated/nodes/AnimatedModulo.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,6 +15,7 @@ const AnimatedNode = require('./AnimatedNode'); const AnimatedWithChildren = require('./AnimatedWithChildren'); import type {InterpolationConfigType} from './AnimatedInterpolation'; +import type {PlatformConfig} from '../AnimatedPlatformConfig'; class AnimatedModulo extends AnimatedWithChildren { _a: AnimatedNode; @@ -26,9 +27,9 @@ class AnimatedModulo extends AnimatedWithChildren { this._modulus = modulus; } - __makeNative() { - this._a.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._a.__makeNative(platformConfig); + super.__makeNative(platformConfig); } __getValue(): number { diff --git a/Libraries/Animated/nodes/AnimatedMultiplication.js b/Libraries/Animated/nodes/AnimatedMultiplication.js index 8104962ead9a..9adb25705497 100644 --- a/Libraries/Animated/nodes/AnimatedMultiplication.js +++ b/Libraries/Animated/nodes/AnimatedMultiplication.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,6 +16,7 @@ const AnimatedValue = require('./AnimatedValue'); const AnimatedWithChildren = require('./AnimatedWithChildren'); import type {InterpolationConfigType} from './AnimatedInterpolation'; +import type {PlatformConfig} from '../AnimatedPlatformConfig'; class AnimatedMultiplication extends AnimatedWithChildren { _a: AnimatedNode; @@ -27,10 +28,10 @@ class AnimatedMultiplication extends AnimatedWithChildren { this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } - __makeNative() { - this._a.__makeNative(); - this._b.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._a.__makeNative(platformConfig); + this._b.__makeNative(platformConfig); + super.__makeNative(platformConfig); } __getValue(): number { diff --git a/Libraries/Animated/nodes/AnimatedNode.js b/Libraries/Animated/nodes/AnimatedNode.js index 7371d49fd5b3..30e802cc914e 100644 --- a/Libraries/Animated/nodes/AnimatedNode.js +++ b/Libraries/Animated/nodes/AnimatedNode.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,6 +15,8 @@ const NativeAnimatedHelper = require('../NativeAnimatedHelper'); const NativeAnimatedAPI = NativeAnimatedHelper.API; const invariant = require('invariant'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; + type ValueListenerCallback = (state: {value: number, ...}) => mixed; let _uniqueId = 1; @@ -23,6 +25,7 @@ let _uniqueId = 1; // support them yet class AnimatedNode { _listeners: {[key: string]: ValueListenerCallback, ...}; + _platformConfig: ?PlatformConfig; __nativeAnimatedValueListener: ?any; __attach(): void {} __detach(): void { @@ -50,11 +53,12 @@ class AnimatedNode { this._listeners = {}; } - __makeNative() { + __makeNative(platformConfig: ?PlatformConfig) { if (!this.__isNative) { throw new Error('This node cannot be made a "native" animated node'); } + this._platformConfig = platformConfig; if (this.hasListeners()) { this._startListeningToNativeValueUpdates(); } @@ -65,7 +69,7 @@ class AnimatedNode { * animations. This is useful because there is no way to * synchronously read the value because it might be driven natively. * - * See https://reactnative.dev/docs/animatedvalue.html#addlistener + * See https://reactnative.dev/docs/animatedvalue#addlistener */ addListener(callback: (value: any) => mixed): string { const id = String(_uniqueId++); @@ -80,7 +84,7 @@ class AnimatedNode { * Unregister a listener. The `id` param shall match the identifier * previously returned by `addListener()`. * - * See https://reactnative.dev/docs/animatedvalue.html#removelistener + * See https://reactnative.dev/docs/animatedvalue#removelistener */ removeListener(id: string): void { delete this._listeners[id]; @@ -92,7 +96,7 @@ class AnimatedNode { /** * Remove all registered listeners. * - * See https://reactnative.dev/docs/animatedvalue.html#removealllisteners + * See https://reactnative.dev/docs/animatedvalue#removealllisteners */ removeAllListeners(): void { this._listeners = {}; @@ -119,15 +123,16 @@ class AnimatedNode { } NativeAnimatedAPI.startListeningToAnimatedNodeValue(this.__getNativeTag()); - this.__nativeAnimatedValueListener = NativeAnimatedHelper.nativeEventEmitter.addListener( - 'onAnimatedValueUpdate', - data => { - if (data.tag !== this.__getNativeTag()) { - return; - } - this._onAnimatedValueUpdateReceived(data.value); - }, - ); + this.__nativeAnimatedValueListener = + NativeAnimatedHelper.nativeEventEmitter.addListener( + 'onAnimatedValueUpdate', + data => { + if (data.tag !== this.__getNativeTag()) { + return; + } + this._onAnimatedValueUpdateReceived(data.value); + }, + ); } _onAnimatedValueUpdateReceived(value: number) { @@ -162,10 +167,11 @@ class AnimatedNode { if (this.__nativeTag == null) { this.__nativeTag = nativeTag; - NativeAnimatedHelper.API.createAnimatedNode( - nativeTag, - this.__getNativeConfig(), - ); + const config = this.__getNativeConfig(); + if (this._platformConfig) { + config.platformConfig = this._platformConfig; + } + NativeAnimatedHelper.API.createAnimatedNode(nativeTag, config); this.__shouldUpdateListenersForNewNativeTag = true; } @@ -179,6 +185,13 @@ class AnimatedNode { toJSON(): any { return this.__getValue(); } + + __getPlatformConfig(): ?PlatformConfig { + return this._platformConfig; + } + __setPlatformConfig(platformConfig: ?PlatformConfig) { + this._platformConfig = platformConfig; + } } module.exports = AnimatedNode; diff --git a/Libraries/Animated/nodes/AnimatedProps.js b/Libraries/Animated/nodes/AnimatedProps.js index 6f915bb5b8fd..baf5c395c992 100644 --- a/Libraries/Animated/nodes/AnimatedProps.js +++ b/Libraries/Animated/nodes/AnimatedProps.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,6 +18,8 @@ const ReactNative = require('../../Renderer/shims/ReactNative'); const invariant = require('invariant'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; + class AnimatedProps extends AnimatedNode { _props: Object; _animatedView: any; @@ -91,15 +93,21 @@ class AnimatedProps extends AnimatedNode { this._callback(); } - __makeNative(): void { + __makeNative(platformConfig: ?PlatformConfig): void { if (!this.__isNative) { this.__isNative = true; for (const key in this._props) { const value = this._props[key]; if (value instanceof AnimatedNode) { - value.__makeNative(); + value.__makeNative(platformConfig); } } + + // Since this does not call the super.__makeNative, we need to store the + // supplied platformConfig here, before calling __connectAnimatedView + // where it will be needed to traverse the graph of attached values. + super.__setPlatformConfig(platformConfig); + if (this._animatedView) { this.__connectAnimatedView(); } @@ -161,7 +169,7 @@ class AnimatedProps extends AnimatedNode { for (const propKey in this._props) { const value = this._props[propKey]; if (value instanceof AnimatedNode) { - value.__makeNative(); + value.__makeNative(this.__getPlatformConfig()); propsConfig[propKey] = value.__getNativeTag(); } } diff --git a/Libraries/Animated/nodes/AnimatedStyle.js b/Libraries/Animated/nodes/AnimatedStyle.js index 6ccd56263a79..6b6761ba256b 100644 --- a/Libraries/Animated/nodes/AnimatedStyle.js +++ b/Libraries/Animated/nodes/AnimatedStyle.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,6 +17,8 @@ const NativeAnimatedHelper = require('../NativeAnimatedHelper'); const flattenStyle = require('../../StyleSheet/flattenStyle'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; + class AnimatedStyle extends AnimatedWithChildren { _style: Object; @@ -33,7 +35,7 @@ class AnimatedStyle extends AnimatedWithChildren { } // Recursively get values for nested styles (like iOS's shadowOffset) - _walkStyleAndGetValues(style) { + _walkStyleAndGetValues(style: any) { const updatedStyle = {}; for (const key in style) { const value = style[key]; @@ -58,7 +60,7 @@ class AnimatedStyle extends AnimatedWithChildren { } // Recursively get animated values for nested styles (like iOS's shadowOffset) - _walkStyleAndGetAnimatedValues(style) { + _walkStyleAndGetAnimatedValues(style: any) { const updatedStyle = {}; for (const key in style) { const value = style[key]; @@ -95,14 +97,14 @@ class AnimatedStyle extends AnimatedWithChildren { super.__detach(); } - __makeNative() { + __makeNative(platformConfig: ?PlatformConfig) { for (const key in this._style) { const value = this._style[key]; if (value instanceof AnimatedNode) { - value.__makeNative(); + value.__makeNative(platformConfig); } } - super.__makeNative(); + super.__makeNative(platformConfig); } __getNativeConfig(): Object { @@ -110,7 +112,7 @@ class AnimatedStyle extends AnimatedWithChildren { for (const styleKey in this._style) { if (this._style[styleKey] instanceof AnimatedNode) { const style = this._style[styleKey]; - style.__makeNative(); + style.__makeNative(this.__getPlatformConfig()); styleConfig[styleKey] = style.__getNativeTag(); } // Non-animated styles are set using `setNativeProps`, no need diff --git a/Libraries/Animated/nodes/AnimatedSubtraction.js b/Libraries/Animated/nodes/AnimatedSubtraction.js index 9f0e27da3d7f..3c8eb158fd05 100644 --- a/Libraries/Animated/nodes/AnimatedSubtraction.js +++ b/Libraries/Animated/nodes/AnimatedSubtraction.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,6 +16,7 @@ const AnimatedValue = require('./AnimatedValue'); const AnimatedWithChildren = require('./AnimatedWithChildren'); import type {InterpolationConfigType} from './AnimatedInterpolation'; +import type {PlatformConfig} from '../AnimatedPlatformConfig'; class AnimatedSubtraction extends AnimatedWithChildren { _a: AnimatedNode; @@ -27,10 +28,10 @@ class AnimatedSubtraction extends AnimatedWithChildren { this._b = typeof b === 'number' ? new AnimatedValue(b) : b; } - __makeNative() { - this._a.__makeNative(); - this._b.__makeNative(); - super.__makeNative(); + __makeNative(platformConfig: ?PlatformConfig) { + this._a.__makeNative(platformConfig); + this._b.__makeNative(platformConfig); + super.__makeNative(platformConfig); } __getValue(): number { diff --git a/Libraries/Animated/nodes/AnimatedTracking.js b/Libraries/Animated/nodes/AnimatedTracking.js index 303f8233ea32..e8f74eaa54ac 100644 --- a/Libraries/Animated/nodes/AnimatedTracking.js +++ b/Libraries/Animated/nodes/AnimatedTracking.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,6 +17,7 @@ const { shouldUseNativeDriver, } = require('../NativeAnimatedHelper'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; import type {EndCallback} from '../animations/Animation'; class AnimatedTracking extends AnimatedNode { @@ -44,11 +45,11 @@ class AnimatedTracking extends AnimatedNode { this.__attach(); } - __makeNative() { + __makeNative(platformConfig: ?PlatformConfig) { this.__isNative = true; - this._parent.__makeNative(); - super.__makeNative(); - this._value.__makeNative(); + this._parent.__makeNative(platformConfig); + super.__makeNative(platformConfig); + this._value.__makeNative(platformConfig); } __getValue(): Object { @@ -63,7 +64,8 @@ class AnimatedTracking extends AnimatedNode { // if we don't do this `update` method will get called. At that point it // may be too late as it would mean the JS driver has already started // updating node values - this.__makeNative(); + let {platformConfig} = this._animationConfig; + this.__makeNative(platformConfig); } } diff --git a/Libraries/Animated/nodes/AnimatedTransform.js b/Libraries/Animated/nodes/AnimatedTransform.js index 8c2dd25852fb..0fee6b077873 100644 --- a/Libraries/Animated/nodes/AnimatedTransform.js +++ b/Libraries/Animated/nodes/AnimatedTransform.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,6 +14,8 @@ const AnimatedNode = require('./AnimatedNode'); const AnimatedWithChildren = require('./AnimatedWithChildren'); const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import type {PlatformConfig} from '../AnimatedPlatformConfig'; + class AnimatedTransform extends AnimatedWithChildren { _transforms: $ReadOnlyArray; @@ -22,16 +24,16 @@ class AnimatedTransform extends AnimatedWithChildren { this._transforms = transforms; } - __makeNative() { + __makeNative(platformConfig: ?PlatformConfig) { this._transforms.forEach(transform => { for (const key in transform) { const value = transform[key]; if (value instanceof AnimatedNode) { - value.__makeNative(); + value.__makeNative(platformConfig); } } }); - super.__makeNative(); + super.__makeNative(platformConfig); } __getValue(): $ReadOnlyArray { diff --git a/Libraries/Animated/nodes/AnimatedValue.js b/Libraries/Animated/nodes/AnimatedValue.js index ac3d72915b41..c0e8f7341cc4 100644 --- a/Libraries/Animated/nodes/AnimatedValue.js +++ b/Libraries/Animated/nodes/AnimatedValue.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,6 +15,7 @@ const AnimatedWithChildren = require('./AnimatedWithChildren'); const InteractionManager = require('../../Interaction/InteractionManager'); const NativeAnimatedHelper = require('../NativeAnimatedHelper'); +import type AnimatedNode from './AnimatedNode'; import type Animation, {EndCallback} from '../animations/Animation'; import type {InterpolationConfigType} from './AnimatedInterpolation'; import type AnimatedTracking from './AnimatedTracking'; @@ -45,7 +46,7 @@ const NativeAnimatedAPI = NativeAnimatedHelper.API; */ function _flush(rootNode: AnimatedValue): void { const animatedStyles = new Set(); - function findAnimatedStyles(node) { + function findAnimatedStyles(node: AnimatedValue | AnimatedNode) { /* $FlowFixMe[prop-missing] (>=0.68.0 site=react_native_fb) This comment * suppresses an error found when Flow v0.68 was deployed. To see the error * delete this comment and run Flow. */ @@ -77,7 +78,7 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) { * mechanism at a time. Using a new mechanism (e.g. starting a new animation, * or calling `setValue`) will stop any previous ones. * - * See https://reactnative.dev/docs/animatedvalue.html + * See https://reactnative.dev/docs/animatedvalue */ class AnimatedValue extends AnimatedWithChildren { _value: number; @@ -99,7 +100,7 @@ class AnimatedValue extends AnimatedWithChildren { __detach() { if (this.__isNative) { NativeAnimatedAPI.getValue(this.__getNativeTag(), value => { - this._value = value; + this._value = value - this._offset; }); } this.stopAnimation(); @@ -114,7 +115,7 @@ class AnimatedValue extends AnimatedWithChildren { * Directly set the value. This will stop any animations running on the value * and update all the bound properties. * - * See https://reactnative.dev/docs/animatedvalue.html#setvalue + * See https://reactnative.dev/docs/animatedvalue#setvalue */ setValue(value: number): void { if (this._animation) { @@ -137,7 +138,7 @@ class AnimatedValue extends AnimatedWithChildren { * `setValue`, an animation, or `Animated.event`. Useful for compensating * things like the start of a pan gesture. * - * See https://reactnative.dev/docs/animatedvalue.html#setoffset + * See https://reactnative.dev/docs/animatedvalue#setoffset */ setOffset(offset: number): void { this._offset = offset; @@ -150,7 +151,7 @@ class AnimatedValue extends AnimatedWithChildren { * Merges the offset value into the base value and resets the offset to zero. * The final output of the value is unchanged. * - * See https://reactnative.dev/docs/animatedvalue.html#flattenoffset + * See https://reactnative.dev/docs/animatedvalue#flattenoffset */ flattenOffset(): void { this._value += this._offset; @@ -164,7 +165,7 @@ class AnimatedValue extends AnimatedWithChildren { * Sets the offset value to the base value, and resets the base value to zero. * The final output of the value is unchanged. * - * See https://reactnative.dev/docs/animatedvalue.html#extractoffset + * See https://reactnative.dev/docs/animatedvalue#extractoffset */ extractOffset(): void { this._offset += this._value; @@ -179,19 +180,25 @@ class AnimatedValue extends AnimatedWithChildren { * final value after stopping the animation, which is useful for updating * state to match the animation position with layout. * - * See https://reactnative.dev/docs/animatedvalue.html#stopanimation + * See https://reactnative.dev/docs/animatedvalue#stopanimation */ stopAnimation(callback?: ?(value: number) => void): void { this.stopTracking(); this._animation && this._animation.stop(); this._animation = null; - callback && callback(this.__getValue()); + if (callback) { + if (this.__isNative) { + NativeAnimatedAPI.getValue(this.__getNativeTag(), callback); + } else { + callback(this.__getValue()); + } + } } /** * Stops any animation and resets the value to its original. * - * See https://reactnative.dev/docs/animatedvalue.html#resetanimation + * See https://reactnative.dev/docs/animatedvalue#resetanimation */ resetAnimation(callback?: ?(value: number) => void): void { this.stopAnimation(callback); @@ -220,7 +227,7 @@ class AnimatedValue extends AnimatedWithChildren { * Typically only used internally, but could be used by a custom Animation * class. * - * See https://reactnative.dev/docs/animatedvalue.html#animate + * See https://reactnative.dev/docs/animatedvalue#animate */ animate(animation: Animation, callback: ?EndCallback): void { let handle = null; @@ -263,6 +270,8 @@ class AnimatedValue extends AnimatedWithChildren { track(tracking: AnimatedTracking): void { this.stopTracking(); this._tracking = tracking; + // Make sure that the tracking animation starts executing + this._tracking && this._tracking.update(); } _updateValue(value: number, flush: boolean): void { diff --git a/Libraries/Animated/nodes/AnimatedValueXY.js b/Libraries/Animated/nodes/AnimatedValueXY.js index 28d3395db8a8..bc1f80fe2941 100644 --- a/Libraries/Animated/nodes/AnimatedValueXY.js +++ b/Libraries/Animated/nodes/AnimatedValueXY.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,7 +27,7 @@ let _uniqueId = 1; * 2D Value for driving 2D animations, such as pan gestures. Almost identical * API to normal `Animated.Value`, but multiplexed. * - * See https://reactnative.dev/docs/animatedvaluexy.html + * See https://reactnative.dev/docs/animatedvaluexy */ class AnimatedValueXY extends AnimatedWithChildren { x: AnimatedValue; @@ -38,7 +38,7 @@ class AnimatedValueXY extends AnimatedWithChildren { y: string, ... }, - ..., + ... }; constructor( @@ -69,7 +69,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * Directly set the value. This will stop any animations running on the value * and update all the bound properties. * - * See https://reactnative.dev/docs/animatedvaluexy.html#setvalue + * See https://reactnative.dev/docs/animatedvaluexy#setvalue */ setValue(value: {x: number, y: number, ...}) { this.x.setValue(value.x); @@ -81,7 +81,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * via `setValue`, an animation, or `Animated.event`. Useful for compensating * things like the start of a pan gesture. * - * See https://reactnative.dev/docs/animatedvaluexy.html#setoffset + * See https://reactnative.dev/docs/animatedvaluexy#setoffset */ setOffset(offset: {x: number, y: number, ...}) { this.x.setOffset(offset.x); @@ -92,7 +92,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * Merges the offset value into the base value and resets the offset to zero. * The final output of the value is unchanged. * - * See https://reactnative.dev/docs/animatedvaluexy.html#flattenoffset + * See https://reactnative.dev/docs/animatedvaluexy#flattenoffset */ flattenOffset(): void { this.x.flattenOffset(); @@ -103,7 +103,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * Sets the offset value to the base value, and resets the base value to * zero. The final output of the value is unchanged. * - * See https://reactnative.dev/docs/animatedvaluexy.html#extractoffset + * See https://reactnative.dev/docs/animatedvaluexy#extractoffset */ extractOffset(): void { this.x.extractOffset(); @@ -124,7 +124,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Stops any animation and resets the value to its original. * - * See https://reactnative.dev/docs/animatedvaluexy.html#resetanimation + * See https://reactnative.dev/docs/animatedvaluexy#resetanimation */ resetAnimation( callback?: (value: { @@ -143,7 +143,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * final value after stopping the animation, which is useful for updating * state to match the animation position with layout. * - * See https://reactnative.dev/docs/animatedvaluexy.html#stopanimation + * See https://reactnative.dev/docs/animatedvaluexy#stopanimation */ stopAnimation( callback?: (value: { @@ -164,7 +164,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * * Returns a string that serves as an identifier for the listener. * - * See https://reactnative.dev/docs/animatedvaluexy.html#addlistener + * See https://reactnative.dev/docs/animatedvaluexy#addlistener */ addListener(callback: ValueXYListenerCallback): string { const id = String(_uniqueId++); @@ -182,7 +182,7 @@ class AnimatedValueXY extends AnimatedWithChildren { * Unregister a listener. The `id` param shall match the identifier * previously returned by `addListener()`. * - * See https://reactnative.dev/docs/animatedvaluexy.html#removelistener + * See https://reactnative.dev/docs/animatedvaluexy#removelistener */ removeListener(id: string): void { this.x.removeListener(this._listeners[id].x); @@ -193,7 +193,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Remove all registered listeners. * - * See https://reactnative.dev/docs/animatedvaluexy.html#removealllisteners + * See https://reactnative.dev/docs/animatedvaluexy#removealllisteners */ removeAllListeners(): void { this.x.removeAllListeners(); @@ -204,7 +204,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Converts `{x, y}` into `{left, top}` for use in style. * - * See https://reactnative.dev/docs/animatedvaluexy.html#getlayout + * See https://reactnative.dev/docs/animatedvaluexy#getlayout */ getLayout(): {[key: string]: AnimatedValue, ...} { return { @@ -216,7 +216,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Converts `{x, y}` into a useable translation transform. * - * See https://reactnative.dev/docs/animatedvaluexy.html#gettranslatetransform + * See https://reactnative.dev/docs/animatedvaluexy#gettranslatetransform */ getTranslateTransform(): Array<{[key: string]: AnimatedValue, ...}> { return [{translateX: this.x}, {translateY: this.y}]; diff --git a/Libraries/Animated/nodes/AnimatedWithChildren.js b/Libraries/Animated/nodes/AnimatedWithChildren.js index 5f4ff1c6de1f..435365d1f6ee 100644 --- a/Libraries/Animated/nodes/AnimatedWithChildren.js +++ b/Libraries/Animated/nodes/AnimatedWithChildren.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ 'use strict'; +import type {PlatformConfig} from '../AnimatedPlatformConfig'; const AnimatedNode = require('./AnimatedNode'); const NativeAnimatedHelper = require('../NativeAnimatedHelper'); @@ -21,18 +22,18 @@ class AnimatedWithChildren extends AnimatedNode { this._children = []; } - __makeNative() { + __makeNative(platformConfig: ?PlatformConfig) { if (!this.__isNative) { this.__isNative = true; for (const child of this._children) { - child.__makeNative(); + child.__makeNative(platformConfig); NativeAnimatedHelper.API.connectAnimatedNodes( this.__getNativeTag(), child.__getNativeTag(), ); } } - super.__makeNative(); + super.__makeNative(platformConfig); } __addChild(child: AnimatedNode): void { @@ -42,7 +43,7 @@ class AnimatedWithChildren extends AnimatedNode { this._children.push(child); if (this.__isNative) { // Only accept "native" animated nodes as children - child.__makeNative(); + child.__makeNative(this.__getPlatformConfig()); NativeAnimatedHelper.API.connectAnimatedNodes( this.__getNativeTag(), child.__getNativeTag(), diff --git a/Libraries/Animated/useAnimatedProps.js b/Libraries/Animated/useAnimatedProps.js index 142faedb1b23..8629fd4ebdf9 100644 --- a/Libraries/Animated/useAnimatedProps.js +++ b/Libraries/Animated/useAnimatedProps.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/AppState/AppState.js b/Libraries/AppState/AppState.js index 303c97ed28e2..89459dd41045 100644 --- a/Libraries/AppState/AppState.js +++ b/Libraries/AppState/AppState.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,7 +33,7 @@ type NativeAppStateEventDefinitions = { * `AppState` can tell you if the app is in the foreground or background, * and notify you when the state changes. * - * See https://reactnative.dev/docs/appstate.html + * See https://reactnative.dev/docs/appstate */ class AppState { currentState: ?string = null; @@ -47,11 +47,12 @@ class AppState { } else { this.isAvailable = true; - const emitter: NativeEventEmitter = new NativeEventEmitter( - // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior - // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' ? null : NativeAppState, - ); + const emitter: NativeEventEmitter = + new NativeEventEmitter( + // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior + // If you want to use the native module on other platforms, please remove this condition and test its behavior + Platform.OS !== 'ios' ? null : NativeAppState, + ); this._emitter = emitter; this.currentState = NativeAppState.getConstants().initialAppState; @@ -90,7 +91,7 @@ class AppState { * Add a handler to AppState changes by listening to the `change` event type * and providing the handler. * - * See https://reactnative.dev/docs/appstate.html#addeventlistener + * See https://reactnative.dev/docs/appstate#addeventlistener */ addEventListener>( type: K, diff --git a/Libraries/AppState/NativeAppState.js b/Libraries/AppState/NativeAppState.js index b08fe5ca81a5..d546e70051d0 100644 --- a/Libraries/AppState/NativeAppState.js +++ b/Libraries/AppState/NativeAppState.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BatchedBridge/BatchedBridge.js b/Libraries/BatchedBridge/BatchedBridge.js index 5b928edcc6b3..0c25ba26811a 100644 --- a/Libraries/BatchedBridge/BatchedBridge.js +++ b/Libraries/BatchedBridge/BatchedBridge.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BatchedBridge/MessageQueue.js b/Libraries/BatchedBridge/MessageQueue.js index c01bbb14749c..b47453429116 100644 --- a/Libraries/BatchedBridge/MessageQueue.js +++ b/Libraries/BatchedBridge/MessageQueue.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -72,19 +72,17 @@ class MessageQueue { } // $FlowFixMe[cannot-write] - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - this.callFunctionReturnFlushedQueue = this.callFunctionReturnFlushedQueue.bind( - this, - ); + this.callFunctionReturnFlushedQueue = + // $FlowFixMe[method-unbinding] added when improving typing for this parameters + this.callFunctionReturnFlushedQueue.bind(this); // $FlowFixMe[cannot-write] // $FlowFixMe[method-unbinding] added when improving typing for this parameters this.flushedQueue = this.flushedQueue.bind(this); // $FlowFixMe[cannot-write] - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - this.invokeCallbackAndReturnFlushedQueue = this.invokeCallbackAndReturnFlushedQueue.bind( - this, - ); + this.invokeCallbackAndReturnFlushedQueue = + // $FlowFixMe[method-unbinding] added when improving typing for this parameters + this.invokeCallbackAndReturnFlushedQueue.bind(this); } /** diff --git a/Libraries/BatchedBridge/NativeModules.js b/Libraries/BatchedBridge/NativeModules.js index 257436199d34..8b407884a30d 100644 --- a/Libraries/BatchedBridge/NativeModules.js +++ b/Libraries/BatchedBridge/NativeModules.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js b/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js index 8644d15ea019..0d70e66c2d76 100644 --- a/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js +++ b/Libraries/BatchedBridge/__mocks__/MessageQueueTestConfig.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js b/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js index 667799a42f4b..77b9421c5982 100644 --- a/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js +++ b/Libraries/BatchedBridge/__mocks__/MessageQueueTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,8 +15,8 @@ * cases. */ const MessageQueueTestModule = { - testHook1: function() {}, - testHook2: function() {}, + testHook1: function () {}, + testHook2: function () {}, }; module.exports = MessageQueueTestModule; diff --git a/Libraries/BatchedBridge/__tests__/MessageQueue-test.js b/Libraries/BatchedBridge/__tests__/MessageQueue-test.js index 9c63238d8a09..2edb9ed76690 100644 --- a/Libraries/BatchedBridge/__tests__/MessageQueue-test.js +++ b/Libraries/BatchedBridge/__tests__/MessageQueue-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,8 +30,8 @@ const assertQueue = (flushedQueue, index, moduleID, methodID, params) => { // // [ ] Local modules that throw exceptions are gracefully caught. In that case // local callbacks stored by IDs are cleaned up. -describe('MessageQueue', function() { - beforeEach(function() { +describe('MessageQueue', function () { + beforeEach(function () { jest.resetModules(); MessageQueue = require('../MessageQueue'); MessageQueueTestModule = require('../__mocks__/MessageQueueTestModule'); @@ -141,7 +141,7 @@ describe('MessageQueue', function() { it('should check if the global error handler is not overridden by the DebuggerInternal object', () => { const dummyModule = { - dummy: function() {}, + dummy: function () {}, }; const name = 'emptyModuleName'; const factory = jest.fn(() => dummyModule); @@ -153,7 +153,7 @@ describe('MessageQueue', function() { it('should check if the global error handler is overridden by the DebuggerInternal object', () => { const dummyModule = { - dummy: function() {}, + dummy: function () {}, }; const name = 'emptyModuleName'; const factory = jest.fn(() => dummyModule); diff --git a/Libraries/BatchedBridge/__tests__/NativeModules-test.js b/Libraries/BatchedBridge/__tests__/NativeModules-test.js index bedff6127d95..f4d4aa7a93a6 100644 --- a/Libraries/BatchedBridge/__tests__/NativeModules-test.js +++ b/Libraries/BatchedBridge/__tests__/NativeModules-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,8 +14,6 @@ jest.unmock('../NativeModules'); let BatchedBridge; let NativeModules; -let fs; -let parseErrorStack; const MODULE_IDS = 0; const METHOD_IDS = 1; @@ -38,15 +36,13 @@ const assertQueue = (flushedQueue, index, moduleID, methodID, params) => { // success callbacks are cleaned up. // // [ ] Remote invocation throws if not supplying an error callback. -describe('MessageQueue', function() { - beforeEach(function() { +describe('MessageQueue', function () { + beforeEach(function () { jest.resetModules(); global.__fbBatchedBridgeConfig = require('../__mocks__/MessageQueueTestConfig'); BatchedBridge = require('../BatchedBridge'); NativeModules = require('../NativeModules'); - fs = require('fs'); - parseErrorStack = require('../../Core/Devtools/parseErrorStack'); }); it('should generate native modules', () => { @@ -55,7 +51,7 @@ describe('MessageQueue', function() { assertQueue(flushedQueue, 0, 0, 0, ['foo']); }); - it('should make round trip and clear memory', function() { + it('should make round trip and clear memory', function () { const onFail = jest.fn(); const onSucc = jest.fn(); @@ -101,7 +97,7 @@ describe('MessageQueue', function() { // Handle the first remote invocation by signaling failure. BatchedBridge.__invokeCallback(firstFailCBID, ['firstFailure']); // The failure callback was already invoked, the success is no longer valid - expect(function() { + expect(function () { BatchedBridge.__invokeCallback(firstSuccCBID, ['firstSucc']); }).toThrow(); expect(onFail.mock.calls.length).toBe(1); @@ -110,14 +106,14 @@ describe('MessageQueue', function() { // Handle the second remote invocation by signaling success. BatchedBridge.__invokeCallback(secondSuccCBID, ['secondSucc']); // The success callback was already invoked, the fail cb is no longer valid - expect(function() { + expect(function () { BatchedBridge.__invokeCallback(secondFailCBID, ['secondFail']); }).toThrow(); expect(onFail.mock.calls.length).toBe(1); expect(onSucc.mock.calls.length).toBe(1); }); - it('promise-returning methods (type=promise)', async function() { + it('promise-returning methods (type=promise)', async function () { // Perform communication const promise1 = NativeModules.RemoteModule1.promiseReturningMethod( 'paloAlto', @@ -162,7 +158,7 @@ describe('MessageQueue', function() { // Handle the first remote invocation by signaling failure. BatchedBridge.__invokeCallback(firstFailCBID, [{message: 'firstFailure'}]); // The failure callback was already invoked, the success is no longer valid - expect(function() { + expect(function () { BatchedBridge.__invokeCallback(firstSuccCBID, ['firstSucc']); }).toThrow(); await expect(promise1).rejects.toBeInstanceOf(Error); @@ -171,18 +167,18 @@ describe('MessageQueue', function() { // Handle the second remote invocation by signaling success. BatchedBridge.__invokeCallback(secondSuccCBID, ['secondSucc']); // The success callback was already invoked, the fail cb is no longer valid - expect(function() { + expect(function () { BatchedBridge.__invokeCallback(secondFailCBID, ['secondFail']); }).toThrow(); await promise2; }); describe('sync methods', () => { - afterEach(function() { + afterEach(function () { delete global.nativeCallSyncHook; }); - it('throwing an exception', function() { + it('throwing an exception', function () { global.nativeCallSyncHook = jest.fn(() => { throw new Error('firstFailure'); }); @@ -206,7 +202,7 @@ describe('MessageQueue', function() { }); }); - it('returning a value', function() { + it('returning a value', function () { global.nativeCallSyncHook = jest.fn(() => { return 'secondSucc'; }); diff --git a/Libraries/Blob/Blob.js b/Libraries/Blob/Blob.js index 99d5e59b8e58..b279a030cff3 100644 --- a/Libraries/Blob/Blob.js +++ b/Libraries/Blob/Blob.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/BlobManager.js b/Libraries/Blob/BlobManager.js index 4f4310adddb5..0d4cee7282ba 100644 --- a/Libraries/Blob/BlobManager.js +++ b/Libraries/Blob/BlobManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/BlobRegistry.js b/Libraries/Blob/BlobRegistry.js index ce1eaed34044..01bb0d11eff4 100644 --- a/Libraries/Blob/BlobRegistry.js +++ b/Libraries/Blob/BlobRegistry.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/BlobTypes.js b/Libraries/Blob/BlobTypes.js index cae2ee1f42c6..2c3e00eb06e4 100644 --- a/Libraries/Blob/BlobTypes.js +++ b/Libraries/Blob/BlobTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/File.js b/Libraries/Blob/File.js index e3a22412c5ec..5aa2dd73c46f 100644 --- a/Libraries/Blob/File.js +++ b/Libraries/Blob/File.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/FileReader.js b/Libraries/Blob/FileReader.js index a71d10fc562d..c58dfba687df 100644 --- a/Libraries/Blob/FileReader.js +++ b/Libraries/Blob/FileReader.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/NativeBlobModule.js b/Libraries/Blob/NativeBlobModule.js index d43c8bc3e3b2..2b474d693527 100644 --- a/Libraries/Blob/NativeBlobModule.js +++ b/Libraries/Blob/NativeBlobModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/NativeFileReaderModule.js b/Libraries/Blob/NativeFileReaderModule.js index a33d5d9b7754..ac964b3af42e 100644 --- a/Libraries/Blob/NativeFileReaderModule.js +++ b/Libraries/Blob/NativeFileReaderModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTBlobCollector.h b/Libraries/Blob/RCTBlobCollector.h index 43179d922796..fdd68112d682 100644 --- a/Libraries/Blob/RCTBlobCollector.h +++ b/Libraries/Blob/RCTBlobCollector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTBlobCollector.mm b/Libraries/Blob/RCTBlobCollector.mm index 505e98198d84..b7387c445a50 100644 --- a/Libraries/Blob/RCTBlobCollector.mm +++ b/Libraries/Blob/RCTBlobCollector.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTBlobManager.h b/Libraries/Blob/RCTBlobManager.h index 04b905ccb92a..34cd8b82cf90 100755 --- a/Libraries/Blob/RCTBlobManager.h +++ b/Libraries/Blob/RCTBlobManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTBlobManager.mm b/Libraries/Blob/RCTBlobManager.mm index 425dc73fb6c0..567e16ffee56 100755 --- a/Libraries/Blob/RCTBlobManager.mm +++ b/Libraries/Blob/RCTBlobManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -262,7 +262,7 @@ - (NSDictionary *)handleNetworkingRequest:(NSDictionary *)data NSDictionary *blob = [RCTConvert NSDictionary:data[@"blob"]]; NSString *contentType = @"application/octet-stream"; - NSString *blobType = [RCTConvert NSString:blob[@"type"]]; + NSString *blobType = [RCTConvert NSString:RCTNilIfNull(blob[@"type"])]; if (blobType != nil && blobType.length > 0) { contentType = blob[@"type"]; } diff --git a/Libraries/Blob/RCTBlobPlugins.h b/Libraries/Blob/RCTBlobPlugins.h index 141ca35579cb..d1fc8cfdae10 100644 --- a/Libraries/Blob/RCTBlobPlugins.h +++ b/Libraries/Blob/RCTBlobPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTBlobPlugins.mm b/Libraries/Blob/RCTBlobPlugins.mm index 289094f35d43..db0dcd825596 100644 --- a/Libraries/Blob/RCTBlobPlugins.mm +++ b/Libraries/Blob/RCTBlobPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTFileReaderModule.h b/Libraries/Blob/RCTFileReaderModule.h index 0eb246b5c475..80d38089073f 100644 --- a/Libraries/Blob/RCTFileReaderModule.h +++ b/Libraries/Blob/RCTFileReaderModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/RCTFileReaderModule.mm b/Libraries/Blob/RCTFileReaderModule.mm index 2525de0c201b..e834c61cc797 100644 --- a/Libraries/Blob/RCTFileReaderModule.mm +++ b/Libraries/Blob/RCTFileReaderModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/React-RCTBlob.podspec b/Libraries/Blob/React-RCTBlob.podspec index 8a7d469eac99..068860a770d5 100644 --- a/Libraries/Blob/React-RCTBlob.podspec +++ b/Libraries/Blob/React-RCTBlob.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -35,11 +35,11 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.dependency "RCT-Folly", folly_version - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version s.dependency "React-Core/RCTBlobHeaders", version diff --git a/Libraries/Blob/URL.js b/Libraries/Blob/URL.js index 3e63ff753fa1..9bcc8060e05e 100644 --- a/Libraries/Blob/URL.js +++ b/Libraries/Blob/URL.js @@ -1,10 +1,11 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format + * @flow */ const Blob = require('./Blob'); @@ -18,6 +19,7 @@ if ( typeof NativeBlobModule.getConstants().BLOB_URI_SCHEME === 'string' ) { const constants = NativeBlobModule.getConstants(); + // $FlowFixMe[incompatible-type] asserted above BLOB_URL_PREFIX = constants.BLOB_URI_SCHEME + ':'; if (typeof constants.BLOB_URI_HOST === 'string') { BLOB_URL_PREFIX += `//${constants.BLOB_URI_HOST}/`; @@ -64,23 +66,23 @@ export class URLSearchParams { this._searchParams.push([key, value]); } - delete(name) { + delete(name: string) { throw new Error('URLSearchParams.delete is not implemented'); } - get(name) { + get(name: string) { throw new Error('URLSearchParams.get is not implemented'); } - getAll(name) { + getAll(name: string) { throw new Error('URLSearchParams.getAll is not implemented'); } - has(name) { + has(name: string) { throw new Error('URLSearchParams.has is not implemented'); } - set(name, value) { + set(name: string, value: string) { throw new Error('URLSearchParams.set is not implemented'); } @@ -88,11 +90,12 @@ export class URLSearchParams { throw new Error('URLSearchParams.sort is not implemented'); } + // $FlowFixMe[unsupported-syntax] [Symbol.iterator]() { return this._searchParams[Symbol.iterator](); } - toString() { + toString(): string { if (this._searchParams.length === 0) { return ''; } @@ -111,9 +114,10 @@ function validateBaseUrl(url: string) { } export class URL { + _url: string; _searchParamsInstance = null; - static createObjectURL(blob: Blob) { + static createObjectURL(blob: Blob): string { if (BLOB_URL_PREFIX === null) { throw new Error('Cannot create URL for blob!'); } @@ -124,7 +128,7 @@ export class URL { // Do nothing. } - constructor(url: string, base: string) { + constructor(url: string, base: string | URL) { let baseUrl = null; if (!base || validateBaseUrl(url)) { this._url = url; @@ -137,7 +141,7 @@ export class URL { if (!validateBaseUrl(baseUrl)) { throw new TypeError(`Invalid base URL: ${baseUrl}`); } - } else if (typeof base === 'object') { + } else { baseUrl = base.toString(); } if (baseUrl.endsWith('/')) { @@ -153,15 +157,15 @@ export class URL { } } - get hash() { + get hash(): string { throw new Error('URL.hash is not implemented'); } - get host() { + get host(): string { throw new Error('URL.host is not implemented'); } - get hostname() { + get hostname(): string { throw new Error('URL.hostname is not implemented'); } @@ -169,27 +173,27 @@ export class URL { return this.toString(); } - get origin() { + get origin(): string { throw new Error('URL.origin is not implemented'); } - get password() { + get password(): string { throw new Error('URL.password is not implemented'); } - get pathname() { + get pathname(): string { throw new Error('URL.pathname not implemented'); } - get port() { + get port(): string { throw new Error('URL.port is not implemented'); } - get protocol() { + get protocol(): string { throw new Error('URL.protocol is not implemented'); } - get search() { + get search(): string { throw new Error('URL.search is not implemented'); } @@ -208,11 +212,12 @@ export class URL { if (this._searchParamsInstance === null) { return this._url; } + const instanceString = this._searchParamsInstance.toString(); const separator = this._url.indexOf('?') > -1 ? '&' : '?'; - return this._url + separator + this._searchParamsInstance.toString(); + return this._url + separator + instanceString; } - get username() { + get username(): string { throw new Error('URL.username is not implemented'); } } diff --git a/Libraries/Blob/__mocks__/BlobModule.js b/Libraries/Blob/__mocks__/BlobModule.js index 8a4ba3ef783a..99e5c405411b 100644 --- a/Libraries/Blob/__mocks__/BlobModule.js +++ b/Libraries/Blob/__mocks__/BlobModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/__mocks__/FileReaderModule.js b/Libraries/Blob/__mocks__/FileReaderModule.js index 1f5bfeac80e6..1cc016c82abb 100644 --- a/Libraries/Blob/__mocks__/FileReaderModule.js +++ b/Libraries/Blob/__mocks__/FileReaderModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Blob/__tests__/Blob-test.js b/Libraries/Blob/__tests__/Blob-test.js index 42aea6f05e58..5e406f024dd0 100644 --- a/Libraries/Blob/__tests__/Blob-test.js +++ b/Libraries/Blob/__tests__/Blob-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +16,7 @@ jest.setMock('../../BatchedBridge/NativeModules', { const Blob = require('../Blob'); -describe('Blob', function() { +describe('Blob', function () { it('should create empty blob', () => { const blob = new Blob(); expect(blob).toBeInstanceOf(Blob); diff --git a/Libraries/Blob/__tests__/BlobManager-test.js b/Libraries/Blob/__tests__/BlobManager-test.js index e711e68f9564..e03dd87d9d1c 100644 --- a/Libraries/Blob/__tests__/BlobManager-test.js +++ b/Libraries/Blob/__tests__/BlobManager-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,7 @@ jest.setMock('../../BatchedBridge/NativeModules', { const Blob = require('../Blob'); const BlobManager = require('../BlobManager'); -describe('BlobManager', function() { +describe('BlobManager', function () { it('should create blob from parts', () => { const blob = BlobManager.createFromParts([], {type: 'text/html'}); expect(blob).toBeInstanceOf(Blob); diff --git a/Libraries/Blob/__tests__/File-test.js b/Libraries/Blob/__tests__/File-test.js index eefbe2864edd..21b50650a998 100644 --- a/Libraries/Blob/__tests__/File-test.js +++ b/Libraries/Blob/__tests__/File-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,8 +17,8 @@ jest.setMock('../../BatchedBridge/NativeModules', { const Blob = require('../Blob'); const File = require('../File'); -describe('babel 7 smoke test', function() { - it('should be able to extend a class with native name', function() { +describe('babel 7 smoke test', function () { + it('should be able to extend a class with native name', function () { let called = false; class Array { constructor() { @@ -40,14 +40,14 @@ describe('babel 7 smoke test', function() { }); }); -describe('Blob', function() { - it('regression caused by circular dep && babel 7', function() { +describe('Blob', function () { + it('regression caused by circular dep && babel 7', function () { const blob = new Blob([], {type: 'image/jpeg'}); expect(blob).toBeInstanceOf(Blob); }); }); -describe('File', function() { +describe('File', function () { it('should create empty file', () => { const file = new File([], 'test.jpg'); expect(file).toBeInstanceOf(File); diff --git a/Libraries/Blob/__tests__/FileReader-test.js b/Libraries/Blob/__tests__/FileReader-test.js index 4e73df3c569b..8ae1c81a31f8 100644 --- a/Libraries/Blob/__tests__/FileReader-test.js +++ b/Libraries/Blob/__tests__/FileReader-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,7 @@ jest.unmock('event-target-shim').setMock('../../BatchedBridge/NativeModules', { const Blob = require('../Blob'); const FileReader = require('../FileReader'); -describe('FileReader', function() { +describe('FileReader', function () { it('should read blob as text', async () => { const e = await new Promise((resolve, reject) => { const reader = new FileReader(); diff --git a/Libraries/Blob/__tests__/URL-test.js b/Libraries/Blob/__tests__/URL-test.js index 713ceeea0ef9..28e89950b267 100644 --- a/Libraries/Blob/__tests__/URL-test.js +++ b/Libraries/Blob/__tests__/URL-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ const URL = require('../URL').URL; -describe('URL', function() { +describe('URL', function () { it('should pass Mozilla Dev Network examples', () => { const a = new URL('/', 'https://developer.mozilla.org'); expect(a.href).toBe('https://developer.mozilla.org/'); diff --git a/Libraries/BugReporting/BugReporting.js b/Libraries/BugReporting/BugReporting.js index d0f8dc2b18c7..2ee616af829c 100644 --- a/Libraries/BugReporting/BugReporting.js +++ b/Libraries/BugReporting/BugReporting.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BugReporting/NativeBugReporting.js b/Libraries/BugReporting/NativeBugReporting.js index 02ff311cc50f..13a51a585c0b 100644 --- a/Libraries/BugReporting/NativeBugReporting.js +++ b/Libraries/BugReporting/NativeBugReporting.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BugReporting/dumpReactTree.js b/Libraries/BugReporting/dumpReactTree.js index 0960662911cc..6673657d42a8 100644 --- a/Libraries/BugReporting/dumpReactTree.js +++ b/Libraries/BugReporting/dumpReactTree.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/BugReporting/getReactData.js b/Libraries/BugReporting/getReactData.js index c851f76f993f..4440cc4e0d0e 100644 --- a/Libraries/BugReporting/getReactData.js +++ b/Libraries/BugReporting/getReactData.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -121,7 +121,11 @@ function getData(element: Object): Object { }; } -function setInProps(internalInst, path: Array, value: any) { +function setInProps( + internalInst: any, + path: Array, + value: any, +) { const element = internalInst._currentElement; internalInst._currentElement = { ...element, @@ -130,12 +134,12 @@ function setInProps(internalInst, path: Array, value: any) { internalInst._instance.forceUpdate(); } -function setInState(inst, path: Array, value: any) { +function setInState(inst: any, path: Array, value: any) { setIn(inst.state, path, value); inst.forceUpdate(); } -function setInContext(inst, path: Array, value: any) { +function setInContext(inst: any, path: Array, value: any) { setIn(inst.context, path, value); inst.forceUpdate(); } @@ -148,7 +152,7 @@ function setIn(obj: Object, path: Array, value: any) { } } -function childrenList(children) { +function childrenList(children: any) { const res = []; for (const name in children) { res.push(children[name]); @@ -156,7 +160,12 @@ function childrenList(children) { return res; } -function copyWithSetImpl(obj, path, idx, value) { +function copyWithSetImpl( + obj: any | Array, + path: Array, + idx: number, + value: any, +) { if (idx >= path.length) { return value; } diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js index 3933de41bc9d..53b0db33f862 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,11 @@ import NativeAccessibilityManagerIOS from './NativeAccessibilityManager'; import legacySendAccessibilityEvent from './legacySendAccessibilityEvent'; import type {ElementRef} from 'react'; +// Events that are only supported on Android. +type AccessibilityEventDefinitionsAndroid = { + accessibilityServiceChanged: [boolean], +}; + // Events that are only supported on iOS. type AccessibilityEventDefinitionsIOS = { announcementFinished: [{announcement: string, success: boolean}], @@ -29,6 +34,7 @@ type AccessibilityEventDefinitionsIOS = { }; type AccessibilityEventDefinitions = { + ...AccessibilityEventDefinitionsAndroid, ...AccessibilityEventDefinitionsIOS, change: [boolean], // screenReaderChanged reduceMotionChanged: [boolean], @@ -38,23 +44,26 @@ type AccessibilityEventDefinitions = { type AccessibilityEventTypes = 'click' | 'focus'; // Mapping of public event names to platform-specific event names. -const EventNames: Map<$Keys, string> = - Platform.OS === 'android' - ? new Map([ - ['change', 'touchExplorationDidChange'], - ['reduceMotionChanged', 'reduceMotionDidChange'], - ['screenReaderChanged', 'touchExplorationDidChange'], - ]) - : new Map([ - ['announcementFinished', 'announcementFinished'], - ['boldTextChanged', 'boldTextChanged'], - ['change', 'screenReaderChanged'], - ['grayscaleChanged', 'grayscaleChanged'], - ['invertColorsChanged', 'invertColorsChanged'], - ['reduceMotionChanged', 'reduceMotionChanged'], - ['reduceTransparencyChanged', 'reduceTransparencyChanged'], - ['screenReaderChanged', 'screenReaderChanged'], - ]); +const EventNames: Map< + $Keys, + string, +> = Platform.OS === 'android' + ? new Map([ + ['change', 'touchExplorationDidChange'], + ['reduceMotionChanged', 'reduceMotionDidChange'], + ['screenReaderChanged', 'touchExplorationDidChange'], + ['accessibilityServiceChanged', 'accessibilityServiceDidChange'], + ]) + : new Map([ + ['announcementFinished', 'announcementFinished'], + ['boldTextChanged', 'boldTextChanged'], + ['change', 'screenReaderChanged'], + ['grayscaleChanged', 'grayscaleChanged'], + ['invertColorsChanged', 'invertColorsChanged'], + ['reduceMotionChanged', 'reduceMotionChanged'], + ['reduceTransparencyChanged', 'reduceTransparencyChanged'], + ['screenReaderChanged', 'screenReaderChanged'], + ]); /** * Sometimes it's useful to know whether or not the device has a screen reader @@ -63,7 +72,7 @@ const EventNames: Map<$Keys, string> = * well as to register to be notified when the state of the screen reader * changes. * - * See https://reactnative.dev/docs/accessibilityinfo.html + * See https://reactnative.dev/docs/accessibilityinfo */ const AccessibilityInfo = { /** @@ -72,7 +81,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when bold text is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo.html#isBoldTextEnabled + * See https://reactnative.dev/docs/accessibilityinfo#isBoldTextEnabled */ isBoldTextEnabled(): Promise { if (Platform.OS === 'android') { @@ -97,7 +106,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when grayscale is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo.html#isGrayscaleEnabled + * See https://reactnative.dev/docs/accessibilityinfo#isGrayscaleEnabled */ isGrayscaleEnabled(): Promise { if (Platform.OS === 'android') { @@ -122,7 +131,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when invert color is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo.html#isInvertColorsEnabled + * See https://reactnative.dev/docs/accessibilityinfo#isInvertColorsEnabled */ isInvertColorsEnabled(): Promise { if (Platform.OS === 'android') { @@ -147,7 +156,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when a reduce motion is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo.html#isReduceMotionEnabled + * See https://reactnative.dev/docs/accessibilityinfo#isReduceMotionEnabled */ isReduceMotionEnabled(): Promise { return new Promise((resolve, reject) => { @@ -176,7 +185,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when a reduce transparency is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo.html#isReduceTransparencyEnabled + * See https://reactnative.dev/docs/accessibilityinfo#isReduceTransparencyEnabled */ isReduceTransparencyEnabled(): Promise { if (Platform.OS === 'android') { @@ -201,7 +210,7 @@ const AccessibilityInfo = { * Returns a promise which resolves to a boolean. * The result is `true` when a screen reader is enabled and `false` otherwise. * - * See https://reactnative.dev/docs/accessibilityinfo.html#isScreenReaderEnabled + * See https://reactnative.dev/docs/accessibilityinfo#isScreenReaderEnabled */ isScreenReaderEnabled(): Promise { return new Promise((resolve, reject) => { @@ -224,6 +233,33 @@ const AccessibilityInfo = { }); }, + /** + * Query whether Accessibility Service is currently enabled. + * + * Returns a promise which resolves to a boolean. + * The result is `true` when any service is enabled and `false` otherwise. + * + * @platform android + * + * See https://reactnative.dev/docs/accessibilityinfo/#isaccessibilityserviceenabled-android + */ + isAccessibilityServiceEnabled(): Promise { + return new Promise((resolve, reject) => { + if (Platform.OS === 'android') { + if ( + NativeAccessibilityInfoAndroid != null && + NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled != null + ) { + NativeAccessibilityInfoAndroid.isAccessibilityServiceEnabled(resolve); + } else { + reject(null); + } + } else { + reject(null); + } + }); + }, + /** * Add an event handler. Supported events: * @@ -256,7 +292,7 @@ const AccessibilityInfo = { * - `success`: A boolean indicating whether the announcement was * successfully made. * - * See https://reactnative.dev/docs/accessibilityinfo.html#addeventlistener + * See https://reactnative.dev/docs/accessibilityinfo#addeventlistener */ addEventListener>( eventName: K, @@ -271,7 +307,7 @@ const AccessibilityInfo = { /** * Set accessibility focus to a React component. * - * See https://reactnative.dev/docs/accessibilityinfo.html#setaccessibilityfocus + * See https://reactnative.dev/docs/accessibilityinfo#setaccessibilityfocus */ setAccessibilityFocus(reactTag: number): void { legacySendAccessibilityEvent(reactTag, 'focus'); @@ -295,7 +331,7 @@ const AccessibilityInfo = { /** * Post a string to be announced by the screen reader. * - * See https://reactnative.dev/docs/accessibilityinfo.html#announceforaccessibility + * See https://reactnative.dev/docs/accessibilityinfo#announceforaccessibility */ announceForAccessibility(announcement: string): void { if (Platform.OS === 'android') { @@ -305,6 +341,30 @@ const AccessibilityInfo = { } }, + /** + * Post a string to be announced by the screen reader. + * - `announcement`: The string announced by the screen reader. + * - `options`: An object that configures the reading options. + * - `queue`: The announcement will be queued behind existing announcements. iOS only. + */ + announceForAccessibilityWithOptions( + announcement: string, + options: {queue?: boolean}, + ): void { + if (Platform.OS === 'android') { + NativeAccessibilityInfoAndroid?.announceForAccessibility(announcement); + } else { + if (NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions) { + NativeAccessibilityManagerIOS?.announceForAccessibilityWithOptions( + announcement, + options, + ); + } else { + NativeAccessibilityManagerIOS?.announceForAccessibility(announcement); + } + } + }, + /** * @deprecated Use `remove` on the EventSubscription from `addEventListener`. */ @@ -327,7 +387,7 @@ const AccessibilityInfo = { /** * Get the recommended timeout for changes to the UI needed by this user. * - * See https://reactnative.dev/docs/accessibilityinfo.html#getrecommendedtimeoutmillis + * See https://reactnative.dev/docs/accessibilityinfo#getrecommendedtimeoutmillis */ getRecommendedTimeoutMillis(originalTimeout: number): Promise { if (Platform.OS === 'android') { diff --git a/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js b/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js index 916667aa5c2c..beee9e285175 100644 --- a/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js +++ b/Libraries/Components/AccessibilityInfo/NativeAccessibilityInfo.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,6 +18,9 @@ export interface Spec extends TurboModule { +isTouchExplorationEnabled: ( onSuccess: (isScreenReaderEnabled: boolean) => void, ) => void; + +isAccessibilityServiceEnabled?: ?( + onSuccess: (isAccessibilityServiceEnabled: boolean) => void, + ) => void; +setAccessibilityFocus: (reactTag: number) => void; +announceForAccessibility: (announcement: string) => void; +getRecommendedTimeoutMillis?: ( diff --git a/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js b/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js index 9ee2403e372b..d4c400ac3e99 100644 --- a/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js +++ b/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -52,6 +52,10 @@ export interface Spec extends TurboModule { |}) => void; +setAccessibilityFocus: (reactTag: number) => void; +announceForAccessibility: (announcement: string) => void; + +announceForAccessibilityWithOptions?: ( + announcement: string, + options: {queue?: boolean}, + ) => void; } export default (TurboModuleRegistry.get('AccessibilityManager'): ?Spec); diff --git a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js index 3bb1c554950d..09556be26a46 100644 --- a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js +++ b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.ios.js b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.ios.js index 950336d1101c..17091e354ff5 100644 --- a/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.ios.js +++ b/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.js index 9100cf6483de..eb8b733e15a2 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js b/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js index 3475cebeddea..548069e885d6 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicatorViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,21 +22,21 @@ type NativeProps = $ReadOnly<{| /** * Whether the indicator should hide when not animating (true by default). * - * See https://reactnative.dev/docs/activityindicator.html#hideswhenstopped + * See https://reactnative.dev/docs/activityindicator#hideswhenstopped */ hidesWhenStopped?: WithDefault, /** * Whether to show the indicator (true, the default) or hide it (false). * - * See https://reactnative.dev/docs/activityindicator.html#animating + * See https://reactnative.dev/docs/activityindicator#animating */ animating?: WithDefault, /** * The foreground color of the spinner (default is gray). * - * See https://reactnative.dev/docs/activityindicator.html#color + * See https://reactnative.dev/docs/activityindicator#color */ color?: ?ColorValue, @@ -44,7 +44,7 @@ type NativeProps = $ReadOnly<{| * Size of the indicator (default is 'small'). * Passing a number to the size prop is only supported on Android. * - * See https://reactnative.dev/docs/activityindicator.html#size + * See https://reactnative.dev/docs/activityindicator#size */ size?: WithDefault<'small' | 'large', 'small'>, |}>; diff --git a/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js b/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js index 2b0f76c66366..91cb7bd6e292 100644 --- a/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js +++ b/Libraries/Components/ActivityIndicator/__tests__/ActivityIndicator-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Button.js b/Libraries/Components/Button.js index 5e11ecc9632e..4ae6a7271e3a 100644 --- a/Libraries/Components/Button.js +++ b/Libraries/Components/Button.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Clipboard/Clipboard.js b/Libraries/Components/Clipboard/Clipboard.js index 970aa93d494b..d387a229139e 100644 --- a/Libraries/Components/Clipboard/Clipboard.js +++ b/Libraries/Components/Clipboard/Clipboard.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Clipboard/NativeClipboard.js b/Libraries/Components/Clipboard/NativeClipboard.js index 6e33b2edce76..9e4ee4733f47 100644 --- a/Libraries/Components/Clipboard/NativeClipboard.js +++ b/Libraries/Components/Clipboard/NativeClipboard.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/DatePicker/DatePickerIOS.android.js b/Libraries/Components/DatePicker/DatePickerIOS.android.js index a3531c770b42..e97edf657c20 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.android.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/DatePicker/DatePickerIOS.ios.js b/Libraries/Components/DatePicker/DatePickerIOS.ios.js index 8295e3aeded2..91d5d0d6f53a 100644 --- a/Libraries/Components/DatePicker/DatePickerIOS.ios.js +++ b/Libraries/Components/DatePicker/DatePickerIOS.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -205,7 +205,23 @@ const styles = StyleSheet.create({ }, }); -function getHeight(pickerStyle, mode) { +function getHeight( + pickerStyle: ?( + | 'compact' + | 'inline' + | 'spinner' + | $TEMPORARY$string<'compact'> + | $TEMPORARY$string<'inline'> + | $TEMPORARY$string<'spinner'> + ), + mode: + | 'date' + | 'datetime' + | 'time' + | $TEMPORARY$string<'date'> + | $TEMPORARY$string<'datetime'> + | $TEMPORARY$string<'time'>, +) { if (pickerStyle === 'compact') { return styles.datePickerIOSCompact; } diff --git a/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js b/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js index e577f3ee37b4..c7ae082d19b7 100644 --- a/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js +++ b/Libraries/Components/DatePicker/RCTDatePickerNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/DatePicker/__tests__/DatePickerIOS-test.js b/Libraries/Components/DatePicker/__tests__/DatePickerIOS-test.js index 79579b82ee59..4fdcf8f8ca27 100644 --- a/Libraries/Components/DatePicker/__tests__/DatePickerIOS-test.js +++ b/Libraries/Components/DatePicker/__tests__/DatePickerIOS-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js b/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js index c8c157a2f8ec..751f9850cb72 100644 --- a/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js +++ b/Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js index 7efb3491e0e3..c0c1bf05375a 100644 --- a/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js +++ b/Libraries/Components/DrawerAndroid/AndroidDrawerLayoutNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -92,12 +92,12 @@ type NativeProps = $ReadOnly<{| /** * Function called whenever the navigation view has been opened. */ - onDrawerOpen?: ?DirectEventHandler, + onDrawerOpen?: ?DirectEventHandler, /** * Function called whenever the navigation view has been closed. */ - onDrawerClose?: ?DirectEventHandler, + onDrawerClose?: ?DirectEventHandler, /** * Make the drawer take the entire screen and draw the background of the diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js index 9c7b9154bbc3..8ae7f993da40 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -162,9 +162,10 @@ class DrawerLayoutAndroid extends React.Component { return {Left: 'left', Right: 'right'}; } - _nativeRef = React.createRef< - React.ElementRef, - >(); + _nativeRef = + React.createRef< + React.ElementRef, + >(); state: State = {statusBarBackgroundColor: null}; diff --git a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js index d5fd5cf83f75..3e5195260961 100644 --- a/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js +++ b/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js b/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js index c05331065cba..bc1b173de0a3 100644 --- a/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js +++ b/Libraries/Components/DrawerAndroid/__tests__/DrawerAndroid-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Keyboard/Keyboard.js b/Libraries/Components/Keyboard/Keyboard.js index fec163cd2845..84d8a3351347 100644 --- a/Libraries/Components/Keyboard/Keyboard.js +++ b/Libraries/Components/Keyboard/Keyboard.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -103,11 +103,12 @@ type KeyboardEventDefinitions = { */ class Keyboard { - _emitter: NativeEventEmitter = new NativeEventEmitter( - // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior - // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' ? null : NativeKeyboardObserver, - ); + _emitter: NativeEventEmitter = + new NativeEventEmitter( + // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior + // If you want to use the native module on other platforms, please remove this condition and test its behavior + Platform.OS !== 'ios' ? null : NativeKeyboardObserver, + ); /** * The `addListener` function connects a JavaScript function to an identified native @@ -141,9 +142,9 @@ class Keyboard { } /** - * @deprecated Use `remove` on the EventSubscription from `addEventListener`. + * @deprecated Use `remove` on the EventSubscription from `addListener`. */ - removeEventListener>( + removeListener>( eventType: K, listener: (...$ElementType) => mixed, ): void { diff --git a/Libraries/Components/Keyboard/KeyboardAvoidingView.js b/Libraries/Components/Keyboard/KeyboardAvoidingView.js index 26897f1632da..4536402c5104 100644 --- a/Libraries/Components/Keyboard/KeyboardAvoidingView.js +++ b/Libraries/Components/Keyboard/KeyboardAvoidingView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,7 +22,7 @@ import type { ViewLayout, ViewLayoutEvent, } from '../View/ViewPropTypes'; -import type {KeyboardEvent} from './Keyboard'; +import type {KeyboardEvent, KeyboardEventCoordinates} from './Keyboard'; type Props = $ReadOnly<{| ...ViewProps, @@ -71,7 +71,7 @@ class KeyboardAvoidingView extends React.Component { this.viewRef = React.createRef(); } - _relativeKeyboardHeight(keyboardFrame): number { + _relativeKeyboardHeight(keyboardFrame: KeyboardEventCoordinates): number { const frame = this._frame; if (!frame || !keyboardFrame) { return 0; @@ -87,7 +87,7 @@ class KeyboardAvoidingView extends React.Component { _onKeyboardChange = (event: ?KeyboardEvent) => { this._keyboardEvent = event; - this._updateBottomIfNecesarry(); + this._updateBottomIfNecessary(); }; _onLayout = (event: ViewLayoutEvent) => { @@ -99,11 +99,15 @@ class KeyboardAvoidingView extends React.Component { } if (wasFrameNull) { - this._updateBottomIfNecesarry(); + this._updateBottomIfNecessary(); + } + + if (this.props.onLayout) { + this.props.onLayout(event); } }; - _updateBottomIfNecesarry = () => { + _updateBottomIfNecessary = () => { if (this._keyboardEvent == null) { this.setState({bottom: 0}); return; @@ -157,6 +161,7 @@ class KeyboardAvoidingView extends React.Component { // eslint-disable-next-line no-unused-vars keyboardVerticalOffset = 0, style, + onLayout, ...props } = this.props; const bottomHeight = enabled === true ? this.state.bottom : 0; diff --git a/Libraries/Components/Keyboard/NativeKeyboardObserver.js b/Libraries/Components/Keyboard/NativeKeyboardObserver.js index 7868dd9fb094..2dfa7500e27a 100644 --- a/Libraries/Components/Keyboard/NativeKeyboardObserver.js +++ b/Libraries/Components/Keyboard/NativeKeyboardObserver.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Keyboard/__tests__/Keyboard-test.js b/Libraries/Components/Keyboard/__tests__/Keyboard-test.js index 2c7befec4183..3094781e2cc2 100644 --- a/Libraries/Components/Keyboard/__tests__/Keyboard-test.js +++ b/Libraries/Components/Keyboard/__tests__/Keyboard-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,7 +27,14 @@ describe('Keyboard', () => { }); describe('scheduling layout animation', () => { - const scheduleLayoutAnimation = (duration, easing): void => + const scheduleLayoutAnimation = ( + duration: null | number, + easing: + | null + | $TEMPORARY$string<'linear'> + | $TEMPORARY$string<'some-unknown-animation-type'> + | $TEMPORARY$string<'spring'>, + ): void => // $FlowFixMe[incompatible-call] Keyboard.scheduleLayoutAnimation({duration, easing}); @@ -53,7 +60,9 @@ describe('Keyboard', () => { }); describe('animation update type', () => { - const assertAnimationUpdateType = type => + const assertAnimationUpdateType = ( + type: $TEMPORARY$string<'keyboard'> | $TEMPORARY$string<'linear'>, + ) => expect(LayoutAnimation.configureNext).toHaveBeenCalledWith( expect.objectContaining({ duration: expect.anything(), diff --git a/Libraries/Components/MaskedView/MaskedViewIOS.android.js b/Libraries/Components/MaskedView/MaskedViewIOS.android.js index 016bfad57b63..d9faa8e64e6b 100644 --- a/Libraries/Components/MaskedView/MaskedViewIOS.android.js +++ b/Libraries/Components/MaskedView/MaskedViewIOS.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/MaskedView/MaskedViewIOS.ios.js b/Libraries/Components/MaskedView/MaskedViewIOS.ios.js index eb69fc4233af..9ae245ab6f35 100644 --- a/Libraries/Components/MaskedView/MaskedViewIOS.ios.js +++ b/Libraries/Components/MaskedView/MaskedViewIOS.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js b/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js index bae3709175a5..73448de16c11 100644 --- a/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js +++ b/Libraries/Components/MaskedView/RCTMaskedViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/MaskedView/__tests__/MaskedViewIOS-test.js b/Libraries/Components/MaskedView/__tests__/MaskedViewIOS-test.js index 3c758c71878c..0abfd11da654 100644 --- a/Libraries/Components/MaskedView/__tests__/MaskedViewIOS-test.js +++ b/Libraries/Components/MaskedView/__tests__/MaskedViewIOS-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Pressable/Pressable.js b/Libraries/Components/Pressable/Pressable.js index d8dc1e1d619b..877595adcf66 100644 --- a/Libraries/Components/Pressable/Pressable.js +++ b/Libraries/Components/Pressable/Pressable.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,7 +23,11 @@ import type { import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import usePressability from '../../Pressability/usePressability'; import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect'; -import type {LayoutEvent, PressEvent} from '../../Types/CoreEventTypes'; +import type { + LayoutEvent, + MouseEvent, + PressEvent, +} from '../../Types/CoreEventTypes'; import View from '../View/View'; type ViewStyleProp = $ElementType, 'style'>; @@ -63,6 +67,16 @@ type Props = $ReadOnly<{| */ children: React.Node | ((state: StateCallbackType) => React.Node), + /** + * Duration to wait after hover in before calling `onHoverIn`. + */ + delayHoverIn?: ?number, + + /** + * Duration to wait after hover out before calling `onHoverOut`. + */ + delayHoverOut?: ?number, + /** * Duration (in milliseconds) from `onPressIn` before `onLongPress` is called. */ @@ -89,6 +103,16 @@ type Props = $ReadOnly<{| */ onLayout?: ?(event: LayoutEvent) => mixed, + /** + * Called when the hover is activated to provide visual feedback. + */ + onHoverIn?: ?(event: MouseEvent) => mixed, + + /** + * Called when the hover is deactivated to undo visual feedback. + */ + onHoverOut?: ?(event: MouseEvent) => mixed, + /** * Called when a long-tap gesture is detected. */ @@ -152,9 +176,13 @@ function Pressable(props: Props, forwardedRef): React.Node { android_ripple, cancelable, children, + delayHoverIn, + delayHoverOut, delayLongPress, disabled, focusable, + onHoverIn, + onHoverOut, onLongPress, onPress, onPressIn, @@ -196,8 +224,12 @@ function Pressable(props: Props, forwardedRef): React.Node { hitSlop, pressRectOffset: pressRetentionOffset, android_disableSound, + delayHoverIn, + delayHoverOut, delayLongPress, delayPressIn: unstable_pressDelay, + onHoverIn, + onHoverOut, onLongPress, onPress, onPressIn(event: PressEvent): void { @@ -224,9 +256,13 @@ function Pressable(props: Props, forwardedRef): React.Node { android_disableSound, android_rippleConfig, cancelable, + delayHoverIn, + delayHoverOut, delayLongPress, disabled, hitSlop, + onHoverIn, + onHoverOut, onLongPress, onPress, onPressIn, diff --git a/Libraries/Components/Pressable/__tests__/Pressable-test.js b/Libraries/Components/Pressable/__tests__/Pressable-test.js index 46909623347a..09bb7ac8f336 100644 --- a/Libraries/Components/Pressable/__tests__/Pressable-test.js +++ b/Libraries/Components/Pressable/__tests__/Pressable-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Pressable/useAndroidRippleForView.js b/Libraries/Components/Pressable/useAndroidRippleForView.js index 18ee3d5c6a46..e9682d7027a1 100644 --- a/Libraries/Components/Pressable/useAndroidRippleForView.js +++ b/Libraries/Components/Pressable/useAndroidRippleForView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index 51803f1df2e8..cae4e4dc7dfd 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -100,7 +100,8 @@ const ProgressBarAndroid = ( const ProgressBarAndroidToExport = React.forwardRef(ProgressBarAndroid); -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -module.exports = (ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent); +module.exports = + /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an + * error found when Flow v0.89 was deployed. To see the error, delete this + * comment and run Flow. */ + (ProgressBarAndroidToExport: typeof ProgressBarAndroidNativeComponent); diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js index d5fd5cf83f75..3e5195260961 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js index 5b2fb1a222f9..625542b05baa 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js b/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js index 127a0d7149fc..6d5a06d5bfe4 100644 --- a/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js +++ b/Libraries/Components/ProgressBarAndroid/__tests__/ProgressBarAndroid-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js index d642a6545ab5..4150bbf20084 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js index d465440d1748..2712055e6492 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -71,4 +71,5 @@ const styles = StyleSheet.create({ const ProgressViewIOSWithRef = React.forwardRef(ProgressViewIOS); -module.exports = (ProgressViewIOSWithRef: typeof RCTProgressViewNativeComponent); +module.exports = + (ProgressViewIOSWithRef: typeof RCTProgressViewNativeComponent); diff --git a/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js b/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js index c0c0b56bfef2..cd833d0cf380 100644 --- a/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js +++ b/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ProgressViewIOS/__tests__/ProgressViewIOS-test.js b/Libraries/Components/ProgressViewIOS/__tests__/ProgressViewIOS-test.js index c6c0309d7dbe..1509c91f8ff7 100644 --- a/Libraries/Components/ProgressViewIOS/__tests__/ProgressViewIOS-test.js +++ b/Libraries/Components/ProgressViewIOS/__tests__/ProgressViewIOS-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js index de1b8d9a2a52..0ef1fdc208c4 100644 --- a/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js +++ b/Libraries/Components/RefreshControl/AndroidSwipeRefreshLayoutNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,6 @@ import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; import type { DirectEventHandler, Float, - Int32, WithDefault, } from '../../Types/CodegenTypes'; import type {ColorValue} from '../../StyleSheet/StyleSheet'; diff --git a/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js b/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js index fa4791f2ab62..0ebd98469e0a 100644 --- a/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js +++ b/Libraries/Components/RefreshControl/PullToRefreshViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/RefreshControl/RefreshControl.js b/Libraries/Components/RefreshControl/RefreshControl.js index 0f0a16dbbccf..f62a893b489f 100644 --- a/Libraries/Components/RefreshControl/RefreshControl.js +++ b/Libraries/Components/RefreshControl/RefreshControl.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -158,13 +158,8 @@ class RefreshControl extends React.Component { render(): React.Node { if (Platform.OS === 'ios') { - const { - enabled, - colors, - progressBackgroundColor, - size, - ...props - } = this.props; + const {enabled, colors, progressBackgroundColor, size, ...props} = + this.props; return ( = requireNativeComponent( - 'RCTRefreshControl', -); +const RCTRefreshControl: HostComponent = + requireNativeComponent('RCTRefreshControl'); class RefreshControlMock extends React.Component<{...}> { static latestRef: ?RefreshControlMock; diff --git a/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js b/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js index 5365e35f8fce..86b1d7edb6cd 100644 --- a/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js +++ b/Libraries/Components/SafeAreaView/RCTSafeAreaViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/SafeAreaView/SafeAreaView.js b/Libraries/Components/SafeAreaView/SafeAreaView.js index 2e6e0e74c7c7..20c05774ed41 100644 --- a/Libraries/Components/SafeAreaView/SafeAreaView.js +++ b/Libraries/Components/SafeAreaView/SafeAreaView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -42,8 +42,8 @@ if (Platform.OS === 'android') { }, ); } else { - const RCTSafeAreaViewNativeComponent = require('./RCTSafeAreaViewNativeComponent') - .default; + const RCTSafeAreaViewNativeComponent = + require('./RCTSafeAreaViewNativeComponent').default; exported = React.forwardRef>>( function SafeAreaView(props, forwardedRef) { diff --git a/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js b/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js index 4b7edf60fee4..5c1198421509 100644 --- a/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js +++ b/Libraries/Components/SafeAreaView/__tests__/SafeAreaView-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js b/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js index 71210f989d7e..63f6e660d53d 100644 --- a/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js +++ b/Libraries/Components/ScrollView/AndroidHorizontalScrollContentViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,6 +14,8 @@ import type {ViewProps} from '../View/ViewPropTypes'; type NativeProps = $ReadOnly<{| ...ViewProps, + + removeClippedSubviews?: ?boolean, |}>; type NativeType = HostComponent; diff --git a/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js b/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js index 9ba0b235f2e3..c2f29322bcca 100644 --- a/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js +++ b/Libraries/Components/ScrollView/AndroidHorizontalScrollViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,9 +12,8 @@ import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentTy import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; -const AndroidHorizontalScrollViewNativeComponent: HostComponent = NativeComponentRegistry.get( - 'AndroidHorizontalScrollView', - () => ({ +const AndroidHorizontalScrollViewNativeComponent: HostComponent = + NativeComponentRegistry.get('AndroidHorizontalScrollView', () => ({ uiViewClassName: 'AndroidHorizontalScrollView', bubblingEventTypes: {}, directEventTypes: {}, @@ -37,8 +36,19 @@ const AndroidHorizontalScrollViewNativeComponent: HostComponent = NativeC snapToStart: true, snapToOffsets: true, contentOffset: true, + borderBottomLeftRadius: true, + borderBottomRightRadius: true, + borderRadius: true, + borderStyle: true, + borderRightColor: {process: require('../../StyleSheet/processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderBottomColor: {process: require('../../StyleSheet/processColor')}, + borderTopLeftRadius: true, + borderTopColor: {process: require('../../StyleSheet/processColor')}, + removeClippedSubviews: true, + borderTopRightRadius: true, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, }, - }), -); + })); export default AndroidHorizontalScrollViewNativeComponent; diff --git a/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js b/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js index 4e3174044dfc..30a10939bf46 100644 --- a/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js +++ b/Libraries/Components/ScrollView/ScrollContentViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,14 +12,12 @@ import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; import type {ViewProps as Props} from '../View/ViewPropTypes'; -const ScrollContentViewNativeComponent: HostComponent = NativeComponentRegistry.get( - 'RCTScrollContentView', - () => ({ +const ScrollContentViewNativeComponent: HostComponent = + NativeComponentRegistry.get('RCTScrollContentView', () => ({ uiViewClassName: 'RCTScrollContentView', bubblingEventTypes: {}, directEventTypes: {}, validAttributes: {}, - }), -); + })); export default ScrollContentViewNativeComponent; diff --git a/Libraries/Components/ScrollView/ScrollView.js b/Libraries/Components/ScrollView/ScrollView.js index b121da39eb45..7cee521c162f 100644 --- a/Libraries/Components/ScrollView/ScrollView.js +++ b/Libraries/Components/ScrollView/ScrollView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -161,6 +161,7 @@ export type ScrollViewImperativeMethods = $ReadOnly<{| >, |}>; +export type DecelerationRateType = 'fast' | 'normal' | number; export type ScrollResponderType = ScrollViewImperativeMethods; type IOSProps = $ReadOnly<{| @@ -171,6 +172,12 @@ type IOSProps = $ReadOnly<{| * @platform ios */ automaticallyAdjustContentInsets?: ?boolean, + /** + * Controls whether the ScrollView should automatically adjust it's contentInset + * and scrollViewInsets when the Keyboard changes it's size. The default value is false. + * @platform ios + */ + automaticallyAdjustKeyboardInsets?: ?boolean, /** * Controls whether iOS should automatically adjust the scroll indicator * insets. The default value is true. Available on iOS 13 and later. @@ -467,7 +474,7 @@ export type Props = $ReadOnly<{| * - `'normal'`: 0.998 on iOS, 0.985 on Android (the default) * - `'fast'`: 0.99 on iOS, 0.9 on Android */ - decelerationRate?: ?('fast' | 'normal' | number), + decelerationRate?: ?DecelerationRateType, /** * When true, the scroll view's children are arranged horizontally in a row * instead of vertically in a column. The default value is false. @@ -688,7 +695,7 @@ type ScrollViewComponentStatics = $ReadOnly<{| * view from becoming the responder. * * - * `` vs [``](https://reactnative.dev/docs/flatlist.html) - which one to use? + * `` vs [``](https://reactnative.dev/docs/flatlist) - which one to use? * * `ScrollView` simply renders all its react child components at once. That * makes it very easy to understand and use. @@ -721,10 +728,8 @@ class ScrollView extends React.Component { _scrollAnimatedValue: AnimatedImplementation.Value; _scrollAnimatedValueAttachment: ?{detach: () => void, ...} = null; - _stickyHeaderRefs: Map< - string, - React.ElementRef, - > = new Map(); + _stickyHeaderRefs: Map> = + new Map(); _headerLayoutYs: Map = new Map(); _keyboardWillOpenTo: ?KeyboardEvent = null; @@ -845,7 +850,8 @@ class ScrollView extends React.Component { ref.scrollToEnd = this.scrollToEnd; ref.flashScrollIndicators = this.flashScrollIndicators; ref.scrollResponderZoomTo = this.scrollResponderZoomTo; - ref.scrollResponderScrollNativeHandleToKeyboard = this.scrollResponderScrollNativeHandleToKeyboard; + ref.scrollResponderScrollNativeHandleToKeyboard = + this.scrollResponderScrollNativeHandleToKeyboard; } }, }); @@ -1115,11 +1121,12 @@ class ScrollView extends React.Component { this.props.stickyHeaderIndices && this.props.stickyHeaderIndices.length > 0 ) { - this._scrollAnimatedValueAttachment = AnimatedImplementation.attachNativeEvent( - this._scrollViewRef, - 'onScroll', - [{nativeEvent: {contentOffset: {y: this._scrollAnimatedValue}}}], - ); + this._scrollAnimatedValueAttachment = + AnimatedImplementation.attachNativeEvent( + this._scrollViewRef, + 'onScroll', + [{nativeEvent: {contentOffset: {y: this._scrollAnimatedValue}}}], + ); } } @@ -1721,8 +1728,8 @@ class ScrollView extends React.Component { onScrollEndDrag: this._handleScrollEndDrag, onScrollShouldSetResponder: this._handleScrollShouldSetResponder, onStartShouldSetResponder: this._handleStartShouldSetResponder, - onStartShouldSetResponderCapture: this - ._handleStartShouldSetResponderCapture, + onStartShouldSetResponderCapture: + this._handleStartShouldSetResponderCapture, onTouchEnd: this._handleTouchEnd, onTouchMove: this._handleTouchMove, onTouchStart: this._handleTouchStart, diff --git a/Libraries/Components/ScrollView/ScrollViewCommands.js b/Libraries/Components/ScrollView/ScrollViewCommands.js index 4c1d8158ed49..a18c4b089216 100644 --- a/Libraries/Components/ScrollView/ScrollViewCommands.js +++ b/Libraries/Components/ScrollView/ScrollViewCommands.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ScrollView/ScrollViewContext.js b/Libraries/Components/ScrollView/ScrollViewContext.js index 0b5e9ac40de0..4c194ad54941 100644 --- a/Libraries/Components/ScrollView/ScrollViewContext.js +++ b/Libraries/Components/ScrollView/ScrollViewContext.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ScrollView/ScrollViewNativeComponent.js b/Libraries/Components/ScrollView/ScrollViewNativeComponent.js index cdfc8ff450f3..49fa3bfc3cec 100644 --- a/Libraries/Components/ScrollView/ScrollViewNativeComponent.js +++ b/Libraries/Components/ScrollView/ScrollViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,76 +11,140 @@ import type {ScrollViewNativeProps as Props} from './ScrollViewNativeComponentType'; import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; +import Platform from '../../Utilities/Platform'; -const ScrollViewNativeComponent: HostComponent = NativeComponentRegistry.get( - 'RCTScrollView', - () => ({ - uiViewClassName: 'RCTScrollView', - bubblingEventTypes: {}, - directEventTypes: { - topScrollToTop: { - registrationName: 'onScrollToTop', - }, - }, - validAttributes: { - alwaysBounceHorizontal: true, - alwaysBounceVertical: true, - automaticallyAdjustContentInsets: true, - automaticallyAdjustsScrollIndicatorInsets: true, - bounces: true, - bouncesZoom: true, - canCancelContentTouches: true, - centerContent: true, - contentInset: { - diff: require('../../Utilities/differ/pointsDiffer'), - }, - contentOffset: { - diff: require('../../Utilities/differ/pointsDiffer'), - }, - contentInsetAdjustmentBehavior: true, - decelerationRate: true, - directionalLockEnabled: true, - disableIntervalMomentum: true, - endFillColor: { - process: require('../../StyleSheet/processColor'), - }, - fadingEdgeLength: true, - indicatorStyle: true, - inverted: true, - keyboardDismissMode: true, - maintainVisibleContentPosition: true, - maximumZoomScale: true, - minimumZoomScale: true, - nestedScrollEnabled: true, - onMomentumScrollBegin: true, - onMomentumScrollEnd: true, - onScroll: true, - onScrollBeginDrag: true, - onScrollEndDrag: true, - onScrollToTop: true, - overScrollMode: true, - pagingEnabled: true, - persistentScrollbar: true, - pinchGestureEnabled: true, - scrollEnabled: true, - scrollEventThrottle: true, - scrollIndicatorInsets: { - diff: require('../../Utilities/differ/pointsDiffer'), - }, - scrollPerfTag: true, - scrollToOverflowEnabled: true, - scrollsToTop: true, - sendMomentumEvents: true, - showsHorizontalScrollIndicator: true, - showsVerticalScrollIndicator: true, - snapToAlignment: true, - snapToEnd: true, - snapToInterval: true, - snapToOffsets: true, - snapToStart: true, - zoomScale: true, - }, - }), -); +const RCTScrollViewViewConfig = + Platform.OS === 'android' + ? { + uiViewClassName: 'RCTScrollView', + bubblingEventTypes: {}, + directEventTypes: { + topMomentumScrollBegin: { + registrationName: 'onMomentumScrollBegin', + }, + topMomentumScrollEnd: { + registrationName: 'onMomentumScrollEnd', + }, + topScroll: { + registrationName: 'onScroll', + }, + topScrollBeginDrag: { + registrationName: 'onScrollBeginDrag', + }, + topScrollEndDrag: { + registrationName: 'onScrollEndDrag', + }, + }, + validAttributes: { + contentOffset: { + diff: require('../../Utilities/differ/pointsDiffer'), + }, + decelerationRate: true, + disableIntervalMomentum: true, + pagingEnabled: true, + scrollEnabled: true, + showsVerticalScrollIndicator: true, + snapToAlignment: true, + snapToEnd: true, + snapToInterval: true, + snapToOffsets: true, + snapToStart: true, + borderBottomLeftRadius: true, + borderBottomRightRadius: true, + sendMomentumEvents: true, + borderRadius: true, + nestedScrollEnabled: true, + borderStyle: true, + borderRightColor: {process: require('../../StyleSheet/processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderBottomColor: { + process: require('../../StyleSheet/processColor'), + }, + persistentScrollbar: true, + endFillColor: {process: require('../../StyleSheet/processColor')}, + fadingEdgeLength: true, + overScrollMode: true, + borderTopLeftRadius: true, + scrollPerfTag: true, + borderTopColor: {process: require('../../StyleSheet/processColor')}, + removeClippedSubviews: true, + borderTopRightRadius: true, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, + }, + } + : { + uiViewClassName: 'RCTScrollView', + bubblingEventTypes: {}, + directEventTypes: { + topMomentumScrollBegin: { + registrationName: 'onMomentumScrollBegin', + }, + topMomentumScrollEnd: { + registrationName: 'onMomentumScrollEnd', + }, + topScroll: { + registrationName: 'onScroll', + }, + topScrollBeginDrag: { + registrationName: 'onScrollBeginDrag', + }, + topScrollEndDrag: { + registrationName: 'onScrollEndDrag', + }, + topScrollToTop: { + registrationName: 'onScrollToTop', + }, + }, + validAttributes: { + alwaysBounceHorizontal: true, + alwaysBounceVertical: true, + automaticallyAdjustContentInsets: true, + automaticallyAdjustKeyboardInsets: true, + automaticallyAdjustsScrollIndicatorInsets: true, + bounces: true, + bouncesZoom: true, + canCancelContentTouches: true, + centerContent: true, + contentInset: { + diff: require('../../Utilities/differ/insetsDiffer'), + }, + contentOffset: { + diff: require('../../Utilities/differ/pointsDiffer'), + }, + contentInsetAdjustmentBehavior: true, + decelerationRate: true, + directionalLockEnabled: true, + disableIntervalMomentum: true, + indicatorStyle: true, + inverted: true, + keyboardDismissMode: true, + maintainVisibleContentPosition: true, + maximumZoomScale: true, + minimumZoomScale: true, + pagingEnabled: true, + pinchGestureEnabled: true, + scrollEnabled: true, + scrollEventThrottle: true, + scrollIndicatorInsets: { + diff: require('../../Utilities/differ/insetsDiffer'), + }, + scrollToOverflowEnabled: true, + scrollsToTop: true, + showsHorizontalScrollIndicator: true, + showsVerticalScrollIndicator: true, + snapToAlignment: true, + snapToEnd: true, + snapToInterval: true, + snapToOffsets: true, + snapToStart: true, + zoomScale: true, + }, + }; + +const ScrollViewNativeComponent: HostComponent = + NativeComponentRegistry.get( + 'RCTScrollView', + () => RCTScrollViewViewConfig, + ); export default ScrollViewNativeComponent; diff --git a/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js b/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js index 24e0c70f4427..956614947220 100644 --- a/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js +++ b/Libraries/Components/ScrollView/ScrollViewNativeComponentType.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,6 +21,7 @@ export type ScrollViewNativeProps = $ReadOnly<{ alwaysBounceHorizontal?: ?boolean, alwaysBounceVertical?: ?boolean, automaticallyAdjustContentInsets?: ?boolean, + automaticallyAdjustKeyboardInsets?: ?boolean, automaticallyAdjustsScrollIndicatorInsets?: ?boolean, bounces?: ?boolean, bouncesZoom?: ?boolean, diff --git a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js index ea21ce221b75..a6826f3ea7eb 100644 --- a/Libraries/Components/ScrollView/ScrollViewStickyHeader.js +++ b/Libraries/Components/ScrollView/ScrollViewStickyHeader.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -149,7 +149,7 @@ class ScrollViewStickyHeader extends React.Component { ); } - _onLayout = event => { + _onLayout = (event: any) => { const layoutY = event.nativeEvent.layout.y; const layoutHeight = event.nativeEvent.layout.height; const measured = true; diff --git a/Libraries/Components/ScrollView/ScrollViewViewConfig.js b/Libraries/Components/ScrollView/ScrollViewViewConfig.js index 5b276d54fa0f..9fd5b6f6114f 100644 --- a/Libraries/Components/ScrollView/ScrollViewViewConfig.js +++ b/Libraries/Components/ScrollView/ScrollViewViewConfig.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,6 +24,7 @@ const ScrollViewViewConfig = { alwaysBounceHorizontal: true, alwaysBounceVertical: true, automaticallyAdjustContentInsets: true, + automaticallyAdjustKeyboardInsets: true, automaticallyAdjustsScrollIndicatorInsets: true, bounces: true, bouncesZoom: true, diff --git a/Libraries/Components/ScrollView/__tests__/ScrollView-test.js b/Libraries/Components/ScrollView/__tests__/ScrollView-test.js index f2a7abe2c9f8..656017185dde 100644 --- a/Libraries/Components/ScrollView/__tests__/ScrollView-test.js +++ b/Libraries/Components/ScrollView/__tests__/ScrollView-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,12 +11,12 @@ 'use strict'; -import * as React from 'react'; -import ScrollView from '../ScrollView'; -import * as ReactNativeTestTools from '../../../Utilities/ReactNativeTestTools'; -import ReactTestRenderer from 'react-test-renderer'; -import View from '../../View/View'; -import Text from '../../../Text/Text'; +const React = require('react'); +const ScrollView = require('../ScrollView'); +const ReactNativeTestTools = require('../../../Utilities/ReactNativeTestTools'); +const ReactTestRenderer = require('react-test-renderer'); +const View = require('../../View/View'); +const Text = require('../../../Text/Text'); describe('', () => { it('should render as expected', () => { diff --git a/Libraries/Components/ScrollView/processDecelerationRate.js b/Libraries/Components/ScrollView/processDecelerationRate.js index b3d9542b6e55..72a5a0637d91 100644 --- a/Libraries/Components/ScrollView/processDecelerationRate.js +++ b/Libraries/Components/ScrollView/processDecelerationRate.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js b/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js index a00ff34c34a0..1540d4091b6c 100644 --- a/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js +++ b/Libraries/Components/SegmentedControlIOS/RCTSegmentedControlNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js index a4cbc5e98425..afc2f621e78d 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js index 84770d7646b9..d00b34a5df06 100644 --- a/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js +++ b/Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -87,14 +87,8 @@ class SegmentedControlIOS extends React.Component { }; render() { - const { - enabled, - forwardedRef, - onValueChange, - style, - values, - ...props - } = this.props; + const {enabled, forwardedRef, onValueChange, style, values, ...props} = + this.props; return ( , - onValueChange?: ?BubblingEventHandler, - onSlidingComplete?: ?DirectEventHandler, + onValueChange?: ?BubblingEventHandler, + onSlidingComplete?: ?DirectEventHandler, |}>; export default (codegenNativeComponent('Slider', { diff --git a/Libraries/Components/Sound/NativeSoundManager.js b/Libraries/Components/Sound/NativeSoundManager.js index fcf14489741d..1abf8c82bb3d 100644 --- a/Libraries/Components/Sound/NativeSoundManager.js +++ b/Libraries/Components/Sound/NativeSoundManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Sound/SoundManager.js b/Libraries/Components/Sound/SoundManager.js index f65776be07db..ff1a2cfaba47 100644 --- a/Libraries/Components/Sound/SoundManager.js +++ b/Libraries/Components/Sound/SoundManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,7 +11,7 @@ import NativeSoundManager from './NativeSoundManager'; const SoundManager = { - playTouchSound: function(): void { + playTouchSound: function (): void { if (NativeSoundManager) { NativeSoundManager.playTouchSound(); } diff --git a/Libraries/Components/StaticRenderer.js b/Libraries/Components/StaticRenderer.js index 292c8660cc54..666dbd1cd347 100644 --- a/Libraries/Components/StaticRenderer.js +++ b/Libraries/Components/StaticRenderer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js b/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js index fb7647c8b4c1..4e13d10ba7b4 100644 --- a/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js +++ b/Libraries/Components/StatusBar/NativeStatusBarManagerAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js b/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js index 4765b603a865..6218a70bc5b5 100644 --- a/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js +++ b/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/StatusBar/StatusBar.js b/Libraries/Components/StatusBar/StatusBar.js index 49c96f77e073..516deaad91fb 100644 --- a/Libraries/Components/StatusBar/StatusBar.js +++ b/Libraries/Components/StatusBar/StatusBar.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/StatusBar/__tests__/StatusBar-test.js b/Libraries/Components/StatusBar/__tests__/StatusBar-test.js index a75d4fc1b0d3..976af8aa6985 100644 --- a/Libraries/Components/StatusBar/__tests__/StatusBar-test.js +++ b/Libraries/Components/StatusBar/__tests__/StatusBar-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Switch/AndroidSwitchNativeComponent.js b/Libraries/Components/Switch/AndroidSwitchNativeComponent.js index 7d7b8dd36820..200c5230d660 100644 --- a/Libraries/Components/Switch/AndroidSwitchNativeComponent.js +++ b/Libraries/Components/Switch/AndroidSwitchNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Switch/Switch.js b/Libraries/Components/Switch/Switch.js index abb7f00b761d..fcdc534c7956 100644 --- a/Libraries/Components/Switch/Switch.js +++ b/Libraries/Components/Switch/Switch.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -170,7 +170,8 @@ const SwitchWithForwardedRef: React.AbstractComponent< // that the update should be ignored and we should stick with the value // that we have in JS. const jsValue = value === true; - const shouldUpdateNativeSwitch = native.value !== jsValue; + const shouldUpdateNativeSwitch = + native.value != null && native.value !== jsValue; if ( shouldUpdateNativeSwitch && nativeSwitchRef.current?.setNativeProps != null diff --git a/Libraries/Components/Switch/SwitchNativeComponent.js b/Libraries/Components/Switch/SwitchNativeComponent.js index 7f4715de1808..5187656915de 100644 --- a/Libraries/Components/Switch/SwitchNativeComponent.js +++ b/Libraries/Components/Switch/SwitchNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js index 944d4844e3f3..26982732c966 100644 --- a/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/AndroidTextInputNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,6 @@ import type { } from '../../StyleSheet/StyleSheet'; import codegenNativeCommands from '../../Utilities/codegenNativeCommands'; import type {TextInputNativeCommands} from './TextInputNativeCommands'; -import AndroidTextInputViewConfig from './AndroidTextInputViewConfig'; import * as NativeComponentRegistry from '../../NativeComponent/NativeComponentRegistry'; export type KeyboardType = @@ -73,42 +72,90 @@ export type NativeProps = $ReadOnly<{| * Android props after this */ /** - * Determines which content to suggest on auto complete, e.g.`username`. - * To disable auto complete, use `off`. + * Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content. + * To disable autocomplete, set `autoComplete` to `off`. * * *Android Only* * - * The following values work on Android only: + * Possible values for `autoComplete` are: * - * - `username` - * - `password` - * - `email` - * - `name` - * - `tel` - * - `street-address` - * - `postal-code` - * - `cc-number` + * - `birthdate-day` + * - `birthdate-full` + * - `birthdate-month` + * - `birthdate-year` * - `cc-csc` * - `cc-exp` + * - `cc-exp-day` * - `cc-exp-month` * - `cc-exp-year` + * - `cc-number` + * - `email` + * - `gender` + * - `name` + * - `name-family` + * - `name-given` + * - `name-middle` + * - `name-middle-initial` + * - `name-prefix` + * - `name-suffix` + * - `password` + * - `password-new` + * - `postal-address` + * - `postal-address-country` + * - `postal-address-extended` + * - `postal-address-extended-postal-code` + * - `postal-address-locality` + * - `postal-address-region` + * - `postal-code` + * - `street-address` + * - `sms-otp` + * - `tel` + * - `tel-country-code` + * - `tel-national` + * - `tel-device` + * - `username` + * - `username-new` * - `off` * * @platform android */ autoComplete?: WithDefault< + | 'birthdate-day' + | 'birthdate-full' + | 'birthdate-month' + | 'birthdate-year' | 'cc-csc' | 'cc-exp' + | 'cc-exp-day' | 'cc-exp-month' | 'cc-exp-year' | 'cc-number' | 'email' + | 'gender' | 'name' + | 'name-family' + | 'name-given' + | 'name-middle' + | 'name-middle-initial' + | 'name-prefix' + | 'name-suffix' | 'password' + | 'password-new' + | 'postal-address' + | 'postal-address-country' + | 'postal-address-extended' + | 'postal-address-extended-postal-code' + | 'postal-address-locality' + | 'postal-address-region' | 'postal-code' | 'street-address' + | 'sms-otp' | 'tel' + | 'tel-country-code' + | 'tel-national' + | 'tel-device' | 'username' + | 'username-new' | 'off', 'off', >, @@ -548,7 +595,121 @@ export const Commands: NativeCommands = codegenNativeCommands({ let AndroidTextInputNativeComponent = NativeComponentRegistry.get( 'AndroidTextInput', - () => AndroidTextInputViewConfig, + () => ({ + uiViewClassName: 'AndroidTextInput', + bubblingEventTypes: { + topBlur: { + phasedRegistrationNames: { + bubbled: 'onBlur', + captured: 'onBlurCapture', + }, + }, + topEndEditing: { + phasedRegistrationNames: { + bubbled: 'onEndEditing', + captured: 'onEndEditingCapture', + }, + }, + topFocus: { + phasedRegistrationNames: { + bubbled: 'onFocus', + captured: 'onFocusCapture', + }, + }, + topKeyPress: { + phasedRegistrationNames: { + bubbled: 'onKeyPress', + captured: 'onKeyPressCapture', + }, + }, + topSubmitEditing: { + phasedRegistrationNames: { + bubbled: 'onSubmitEditing', + captured: 'onSubmitEditingCapture', + }, + }, + topTextInput: { + phasedRegistrationNames: { + bubbled: 'onTextInput', + captured: 'onTextInputCapture', + }, + }, + }, + directEventTypes: { + topScroll: { + registrationName: 'onScroll', + }, + }, + validAttributes: { + maxFontSizeMultiplier: true, + adjustsFontSizeToFit: true, + minimumFontScale: true, + autoFocus: true, + placeholder: true, + inlineImagePadding: true, + contextMenuHidden: true, + textShadowColor: {process: require('../../StyleSheet/processColor')}, + maxLength: true, + selectTextOnFocus: true, + textShadowRadius: true, + underlineColorAndroid: { + process: require('../../StyleSheet/processColor'), + }, + textDecorationLine: true, + blurOnSubmit: true, + textAlignVertical: true, + fontStyle: true, + textShadowOffset: true, + selectionColor: {process: require('../../StyleSheet/processColor')}, + selection: true, + placeholderTextColor: {process: require('../../StyleSheet/processColor')}, + importantForAutofill: true, + lineHeight: true, + textTransform: true, + returnKeyType: true, + keyboardType: true, + multiline: true, + color: {process: require('../../StyleSheet/processColor')}, + autoComplete: true, + numberOfLines: true, + letterSpacing: true, + returnKeyLabel: true, + fontSize: true, + onKeyPress: true, + cursorColor: {process: require('../../StyleSheet/processColor')}, + text: true, + showSoftInputOnFocus: true, + textAlign: true, + autoCapitalize: true, + autoCorrect: true, + caretHidden: true, + secureTextEntry: true, + textBreakStrategy: true, + onScroll: true, + onContentSizeChange: true, + disableFullscreenUI: true, + includeFontPadding: true, + fontWeight: true, + fontFamily: true, + allowFontScaling: true, + onSelectionChange: true, + mostRecentEventCount: true, + inlineImageLeft: true, + editable: true, + fontVariant: true, + borderBottomRightRadius: true, + borderBottomColor: {process: require('../../StyleSheet/processColor')}, + borderRadius: true, + borderRightColor: {process: require('../../StyleSheet/processColor')}, + borderColor: {process: require('../../StyleSheet/processColor')}, + borderTopRightRadius: true, + borderStyle: true, + borderBottomLeftRadius: true, + borderLeftColor: {process: require('../../StyleSheet/processColor')}, + borderTopLeftRadius: true, + borderTopColor: {process: require('../../StyleSheet/processColor')}, + }, + }), ); // flowlint-next-line unclear-type:off diff --git a/Libraries/Components/TextInput/AndroidTextInputViewConfig.js b/Libraries/Components/TextInput/AndroidTextInputViewConfig.js deleted file mode 100644 index bb36f91ffbf6..000000000000 --- a/Libraries/Components/TextInput/AndroidTextInputViewConfig.js +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -import ReactNativeViewViewConfig from '../../Components/View/ReactNativeViewViewConfig'; -import type {PartialViewConfig} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes'; - -const AndroidTextInputViewConfig = { - uiViewClassName: 'AndroidTextInput', - bubblingEventTypes: { - topBlur: { - phasedRegistrationNames: { - bubbled: 'onBlur', - captured: 'onBlurCapture', - }, - }, - topEndEditing: { - phasedRegistrationNames: { - bubbled: 'onEndEditing', - captured: 'onEndEditingCapture', - }, - }, - topFocus: { - phasedRegistrationNames: { - bubbled: 'onFocus', - captured: 'onFocusCapture', - }, - }, - topKeyPress: { - phasedRegistrationNames: { - bubbled: 'onKeyPress', - captured: 'onKeyPressCapture', - }, - }, - topSubmitEditing: { - phasedRegistrationNames: { - bubbled: 'onSubmitEditing', - captured: 'onSubmitEditingCapture', - }, - }, - topTextInput: { - phasedRegistrationNames: { - bubbled: 'onTextInput', - captured: 'onTextInputCapture', - }, - }, - }, - directEventTypes: {}, - validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, - - maxFontSizeMultiplier: true, - adjustsFontSizeToFit: true, - minimumFontScale: true, - autoFocus: true, - placeholder: true, - inlineImagePadding: true, - contextMenuHidden: true, - textShadowColor: {process: require('../../StyleSheet/processColor')}, - maxLength: true, - selectTextOnFocus: true, - textShadowRadius: true, - underlineColorAndroid: {process: require('../../StyleSheet/processColor')}, - textDecorationLine: true, - blurOnSubmit: true, - textAlignVertical: true, - fontStyle: true, - textShadowOffset: true, - selectionColor: {process: require('../../StyleSheet/processColor')}, - selection: true, - placeholderTextColor: {process: require('../../StyleSheet/processColor')}, - importantForAutofill: true, - lineHeight: true, - textTransform: true, - returnKeyType: true, - keyboardType: true, - multiline: true, - color: {process: require('../../StyleSheet/processColor')}, - autoCompleteType: true, - autoComplete: true, - numberOfLines: true, - letterSpacing: true, - returnKeyLabel: true, - fontSize: true, - onKeyPress: true, - cursorColor: {process: require('../../StyleSheet/processColor')}, - text: true, - showSoftInputOnFocus: true, - textAlign: true, - autoCapitalize: true, - autoCorrect: true, - caretHidden: true, - secureTextEntry: true, - textBreakStrategy: true, - onScroll: true, - onContentSizeChange: true, - disableFullscreenUI: true, - includeFontPadding: true, - fontWeight: true, - fontFamily: true, - allowFontScaling: true, - onSelectionChange: true, - mostRecentEventCount: true, - inlineImageLeft: true, - editable: true, - fontVariant: true, - }, -}; - -module.exports = (AndroidTextInputViewConfig: PartialViewConfig); diff --git a/Libraries/Components/TextInput/InputAccessoryView.js b/Libraries/Components/TextInput/InputAccessoryView.js index eb83a9ca0e7b..efb9f7d0217f 100644 --- a/Libraries/Components/TextInput/InputAccessoryView.js +++ b/Libraries/Components/TextInput/InputAccessoryView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js b/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js index 1a37cd95e75c..f9e7508501c6 100644 --- a/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js +++ b/Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js b/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js index 51e79f707e8d..e43950b51cbb 100644 --- a/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/RCTMultilineTextInputNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,10 +22,15 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['focus', 'blur', 'setTextAndSelection'], }); -const MultilineTextInputNativeComponent: HostComponent = NativeComponentRegistry.get( - 'RCTMultilineTextInputView', - () => RCTTextInputViewConfig, -); +const MultilineTextInputNativeComponent: HostComponent = + NativeComponentRegistry.get('RCTMultilineTextInputView', () => ({ + uiViewClassName: 'RCTMultilineTextInputView', + ...RCTTextInputViewConfig, + validAttributes: { + ...RCTTextInputViewConfig.validAttributes, + dataDetectorTypes: true, + }, + })); // flowlint-next-line unclear-type:off export default ((MultilineTextInputNativeComponent: any): HostComponent); diff --git a/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js b/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js index e9ac2bc9cc20..0490d96a111b 100644 --- a/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js +++ b/Libraries/Components/TextInput/RCTSingelineTextInputNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,10 +22,11 @@ export const Commands: NativeCommands = codegenNativeCommands({ supportedCommands: ['focus', 'blur', 'setTextAndSelection'], }); -const SinglelineTextInputNativeComponent: HostComponent = NativeComponentRegistry.get( - 'RCTSinglelineTextInputView', - () => RCTTextInputViewConfig, -); +const SinglelineTextInputNativeComponent: HostComponent = + NativeComponentRegistry.get('RCTSinglelineTextInputView', () => ({ + uiViewClassName: 'RCTSinglelineTextInputView', + ...RCTTextInputViewConfig, + })); // flowlint-next-line unclear-type:off export default ((SinglelineTextInputNativeComponent: any): HostComponent); diff --git a/Libraries/Components/TextInput/RCTTextInputViewConfig.js b/Libraries/Components/TextInput/RCTTextInputViewConfig.js index ecd4868759c5..ee479389c816 100644 --- a/Libraries/Components/TextInput/RCTTextInputViewConfig.js +++ b/Libraries/Components/TextInput/RCTTextInputViewConfig.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,10 +9,13 @@ */ import type {PartialViewConfig} from '../../Renderer/shims/ReactNativeTypes'; -import ReactNativeViewViewConfig from '../../Components/View/ReactNativeViewViewConfig'; + +type PartialViewConfigWithoutName = $Rest< + PartialViewConfig, + {uiViewClassName: string}, +>; const RCTTextInputViewConfig = { - uiViewClassName: 'RCTSinglelineTextInputView', bubblingEventTypes: { topBlur: { phasedRegistrationNames: { @@ -26,6 +29,12 @@ const RCTTextInputViewConfig = { captured: 'onChangeCapture', }, }, + topContentSizeChange: { + phasedRegistrationNames: { + captured: 'onContentSizeChangeCapture', + bubbled: 'onContentSizeChange', + }, + }, topEndEditing: { phasedRegistrationNames: { bubbled: 'onEndEditing', @@ -70,9 +79,24 @@ const RCTTextInputViewConfig = { }, }, }, - directEventTypes: {}, + directEventTypes: { + topTextInput: { + registrationName: 'onTextInput', + }, + topKeyPressSync: { + registrationName: 'onKeyPressSync', + }, + topScroll: { + registrationName: 'onScroll', + }, + topSelectionChange: { + registrationName: 'onSelectionChange', + }, + topChangeSync: { + registrationName: 'onChangeSync', + }, + }, validAttributes: { - ...ReactNativeViewViewConfig.validAttributes, fontSize: true, fontWeight: true, fontVariant: true, @@ -99,23 +123,18 @@ const RCTTextInputViewConfig = { caretHidden: true, enablesReturnKeyAutomatically: true, placeholderTextColor: {process: require('../../StyleSheet/processColor')}, - onSelectionChange: true, clearButtonMode: true, - onContentSizeChange: true, keyboardType: true, selection: true, returnKeyType: true, blurOnSubmit: true, mostRecentEventCount: true, - onChange: true, scrollEnabled: true, selectionColor: {process: require('../../StyleSheet/processColor')}, contextMenuHidden: true, secureTextEntry: true, - onTextInput: true, placeholder: true, autoCorrect: true, - onScroll: true, multiline: true, textContentType: true, maxLength: true, @@ -126,7 +145,9 @@ const RCTTextInputViewConfig = { selectTextOnFocus: true, text: true, clearTextOnFocus: true, + showSoftInputOnFocus: true, + autoFocus: true, }, }; -module.exports = (RCTTextInputViewConfig: PartialViewConfig); +module.exports = (RCTTextInputViewConfig: PartialViewConfigWithoutName); diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index f61d266b4b95..d5d167d61e29 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,8 +10,6 @@ import * as React from 'react'; -import DeprecatedTextInputPropTypes from '../../DeprecatedPropTypes/DeprecatedTextInputPropTypes'; - import Platform from '../../Utilities/Platform'; import StyleSheet, { type TextStyleProp, @@ -34,7 +32,6 @@ import type { PressEvent, } from '../../Types/CoreEventTypes'; import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes'; -import type {TextInputNativeCommands} from './TextInputNativeCommands'; const {useLayoutEffect, useRef, useState} = React; @@ -49,17 +46,17 @@ let RCTMultilineTextInputNativeCommands; if (Platform.OS === 'android') { AndroidTextInput = require('./AndroidTextInputNativeComponent').default; - AndroidTextInputCommands = require('./AndroidTextInputNativeComponent') - .Commands; + AndroidTextInputCommands = + require('./AndroidTextInputNativeComponent').Commands; } else if (Platform.OS === 'ios') { - RCTSinglelineTextInputView = require('./RCTSingelineTextInputNativeComponent') - .default; - RCTSinglelineTextInputNativeCommands = require('./RCTSingelineTextInputNativeComponent') - .Commands; - RCTMultilineTextInputView = require('./RCTMultilineTextInputNativeComponent') - .default; - RCTMultilineTextInputNativeCommands = require('./RCTMultilineTextInputNativeComponent') - .Commands; + RCTSinglelineTextInputView = + require('./RCTSingelineTextInputNativeComponent').default; + RCTSinglelineTextInputNativeCommands = + require('./RCTSingelineTextInputNativeComponent').Commands; + RCTMultilineTextInputView = + require('./RCTMultilineTextInputNativeComponent').default; + RCTMultilineTextInputNativeCommands = + require('./RCTMultilineTextInputNativeComponent').Commands; } export type ChangeEvent = SyntheticEvent< @@ -308,25 +305,49 @@ type IOSProps = $ReadOnly<{| type AndroidProps = $ReadOnly<{| /** - * Determines which content to suggest on auto complete, e.g.`username`. - * To disable auto complete, use `off`. + * Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content. + * To disable autocomplete, set `autoComplete` to `off`. * * *Android Only* * - * The following values work on Android only: + * Possible values for `autoComplete` are: * - * - `username` - * - `password` - * - `email` - * - `name` - * - `tel` - * - `street-address` - * - `postal-code` - * - `cc-number` + * - `birthdate-day` + * - `birthdate-full` + * - `birthdate-month` + * - `birthdate-year` * - `cc-csc` * - `cc-exp` + * - `cc-exp-day` * - `cc-exp-month` * - `cc-exp-year` + * - `cc-number` + * - `email` + * - `gender` + * - `name` + * - `name-family` + * - `name-given` + * - `name-middle` + * - `name-middle-initial` + * - `name-prefix` + * - `name-suffix` + * - `password` + * - `password-new` + * - `postal-address` + * - `postal-address-country` + * - `postal-address-extended` + * - `postal-address-extended-postal-code` + * - `postal-address-locality` + * - `postal-address-region` + * - `postal-code` + * - `street-address` + * - `sms-otp` + * - `tel` + * - `tel-country-code` + * - `tel-national` + * - `tel-device` + * - `username` + * - `username-new` * - `off` * * @platform android @@ -577,12 +598,33 @@ export type Props = $ReadOnly<{| */ onChange?: ?(e: ChangeEvent) => mixed, + /** + * DANGER: this API is not stable and will change in the future. + * + * Callback will be called on the main thread and may result in dropped frames. + * Callback that is called when the text input's text changes. + * + * @platform ios + */ + unstable_onChangeSync?: ?(e: ChangeEvent) => mixed, + /** * Callback that is called when the text input's text changes. * Changed text is passed as an argument to the callback handler. */ onChangeText?: ?(text: string) => mixed, + /** + * DANGER: this API is not stable and will change in the future. + * + * Callback will be called on the main thread and may result in dropped frames. + * Callback that is called when the text input's text changes. + * Changed text is passed as an argument to the callback handler. + * + * @platform ios + */ + unstable_onChangeTextSync?: ?(text: string) => mixed, + /** * Callback that is called when the text input's content size changes. * This will be called with @@ -611,6 +653,21 @@ export type Props = $ReadOnly<{| */ onKeyPress?: ?(e: KeyPressEvent) => mixed, + /** + * DANGER: this API is not stable and will change in the future. + * + * Callback will be called on the main thread and may result in dropped frames. + * + * Callback that is called when a key is pressed. + * This will be called with `{ nativeEvent: { key: keyValue } }` + * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and + * the typed-in character otherwise including `' '` for space. + * Fires before `onChange` callbacks. + * + * @platform ios + */ + unstable_onKeyPressSync?: ?(e: KeyPressEvent) => mixed, + /** * Called when a touch is engaged. */ @@ -745,6 +802,7 @@ type ImperativeMethods = $ReadOnly<{| clear: () => void, isFocused: () => boolean, getNativeRef: () => ?React.ElementRef>, + setSelection: (start: number, end: number) => void, |}>; const emptyFunctionThatReturnsTrue = () => true; @@ -988,6 +1046,18 @@ function InternalTextInput(props: Props): React.Node { } } + function setSelection(start: number, end: number): void { + if (inputRef.current != null) { + viewCommands.setTextAndSelection( + inputRef.current, + mostRecentEventCount, + null, + start, + end, + ); + } + } + // TODO: Fix this returning true on null === null, when no input is focused function isFocused(): boolean { return TextInputState.currentlyFocusedInput() === inputRef.current; @@ -1028,14 +1098,15 @@ function InternalTextInput(props: Props): React.Node { ref.clear = clear; ref.isFocused = isFocused; ref.getNativeRef = getNativeRef; + ref.setSelection = setSelection; } }, }); const _onChange = (event: ChangeEvent) => { - const text = event.nativeEvent.text; + const currentText = event.nativeEvent.text; props.onChange && props.onChange(event); - props.onChangeText && props.onChangeText(text); + props.onChangeText && props.onChangeText(currentText); if (inputRef.current == null) { // calling `props.onChange` or `props.onChangeText` @@ -1043,7 +1114,27 @@ function InternalTextInput(props: Props): React.Node { return; } - setLastNativeText(text); + setLastNativeText(currentText); + // This must happen last, after we call setLastNativeText. + // Different ordering can cause bugs when editing AndroidTextInputs + // with multiple Fragments. + // We must update this so that controlled input updates work. + setMostRecentEventCount(event.nativeEvent.eventCount); + }; + + const _onChangeSync = (event: ChangeEvent) => { + const currentText = event.nativeEvent.text; + props.unstable_onChangeSync && props.unstable_onChangeSync(event); + props.unstable_onChangeTextSync && + props.unstable_onChangeTextSync(currentText); + + if (inputRef.current == null) { + // calling `props.onChange` or `props.onChangeText` + // may clean up the input itself. Exits here. + return; + } + + setLastNativeText(currentText); // This must happen last, after we call setLastNativeText. // Different ordering can cause bugs when editing AndroidTextInputs // with multiple Fragments. @@ -1137,6 +1228,10 @@ function InternalTextInput(props: Props): React.Node { ? [styles.multilineInput, props.style] : props.style; + const useOnChangeSync = + (props.unstable_onChangeSync || props.unstable_onChangeTextSync) && + !(props.onChange || props.onChangeText); + textInput = ( , - propTypes: typeof DeprecatedTextInputPropTypes, |}>; const styles = StyleSheet.create({ diff --git a/Libraries/Components/TextInput/TextInputNativeCommands.js b/Libraries/Components/TextInput/TextInputNativeCommands.js index 5177dc5c7141..560ae5bf8a33 100644 --- a/Libraries/Components/TextInput/TextInputNativeCommands.js +++ b/Libraries/Components/TextInput/TextInputNativeCommands.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/TextInput/TextInputState.js b/Libraries/Components/TextInput/TextInputState.js index ec7ca47333e5..fe9a1c89da7d 100644 --- a/Libraries/Components/TextInput/TextInputState.js +++ b/Libraries/Components/TextInput/TextInputState.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/TextInput/__tests__/InputAccessoryView-test.js b/Libraries/Components/TextInput/__tests__/InputAccessoryView-test.js index 78e04f94fc8b..f1a2d643651a 100644 --- a/Libraries/Components/TextInput/__tests__/InputAccessoryView-test.js +++ b/Libraries/Components/TextInput/__tests__/InputAccessoryView-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/TextInput/__tests__/TextInput-test.js b/Libraries/Components/TextInput/__tests__/TextInput-test.js index 5d912d78aef0..9704a1a2c5f2 100644 --- a/Libraries/Components/TextInput/__tests__/TextInput-test.js +++ b/Libraries/Components/TextInput/__tests__/TextInput-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -102,15 +102,10 @@ describe('TextInput tests', () => { TextInput.State.focusTextInput(textInputRef.current); expect(textInputRef.current.isFocused()).toBe(true); expect(TextInput.State.currentlyFocusedInput()).toBe(textInputRef.current); - // This function is currently deprecated and will be removed in the future - expect(TextInput.State.currentlyFocusedField()).toBe( - ReactNative.findNodeHandle(textInputRef.current), - ); + TextInput.State.blurTextInput(textInputRef.current); expect(textInputRef.current.isFocused()).toBe(false); expect(TextInput.State.currentlyFocusedInput()).toBe(null); - // This function is currently deprecated and will be removed in the future - expect(TextInput.State.currentlyFocusedField()).toBe(null); }); it('should unfocus when other TextInput is focused', () => { @@ -144,24 +139,17 @@ describe('TextInput tests', () => { expect(textInputRe1.current.isFocused()).toBe(false); expect(textInputRe2.current.isFocused()).toBe(false); - const inputTag1 = ReactNative.findNodeHandle(textInputRe1.current); - const inputTag2 = ReactNative.findNodeHandle(textInputRe2.current); - TextInput.State.focusTextInput(textInputRe1.current); expect(textInputRe1.current.isFocused()).toBe(true); expect(textInputRe2.current.isFocused()).toBe(false); expect(TextInput.State.currentlyFocusedInput()).toBe(textInputRe1.current); - // This function is currently deprecated and will be removed in the future - expect(TextInput.State.currentlyFocusedField()).toBe(inputTag1); TextInput.State.focusTextInput(textInputRe2.current); expect(textInputRe1.current.isFocused()).toBe(false); expect(textInputRe2.current.isFocused()).toBe(true); expect(TextInput.State.currentlyFocusedInput()).toBe(textInputRe2.current); - // This function is currently deprecated and will be removed in the future - expect(TextInput.State.currentlyFocusedField()).toBe(inputTag2); }); it('should render as expected', () => { diff --git a/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap b/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap index ea9693e96244..874fae2b158a 100644 --- a/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap +++ b/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap @@ -10,6 +10,7 @@ exports[`TextInput tests should render as expected: should deep render when mock mostRecentEventCount={0} onBlur={[Function]} onChange={[Function]} + onChangeSync={null} onClick={[Function]} onFocus={[Function]} onResponderGrant={[Function]} @@ -38,6 +39,7 @@ exports[`TextInput tests should render as expected: should deep render when not mostRecentEventCount={0} onBlur={[Function]} onChange={[Function]} + onChangeSync={null} onClick={[Function]} onFocus={[Function]} onResponderGrant={[Function]} diff --git a/Libraries/Components/ToastAndroid/NativeToastAndroid.js b/Libraries/Components/ToastAndroid/NativeToastAndroid.js index 7325c47d484d..b35757b25d43 100644 --- a/Libraries/Components/ToastAndroid/NativeToastAndroid.js +++ b/Libraries/Components/ToastAndroid/NativeToastAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/ToastAndroid/ToastAndroid.android.js b/Libraries/Components/ToastAndroid/ToastAndroid.android.js index b15100a1769e..81e03fd8f30f 100644 --- a/Libraries/Components/ToastAndroid/ToastAndroid.android.js +++ b/Libraries/Components/ToastAndroid/ToastAndroid.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -42,11 +42,11 @@ const ToastAndroid = { BOTTOM: (ToastAndroidConstants.BOTTOM: number), CENTER: (ToastAndroidConstants.CENTER: number), - show: function(message: string, duration: number): void { + show: function (message: string, duration: number): void { NativeToastAndroid.show(message, duration); }, - showWithGravity: function( + showWithGravity: function ( message: string, duration: number, gravity: number, @@ -54,7 +54,7 @@ const ToastAndroid = { NativeToastAndroid.showWithGravity(message, duration, gravity); }, - showWithGravityAndOffset: function( + showWithGravityAndOffset: function ( message: string, duration: number, gravity: number, diff --git a/Libraries/Components/ToastAndroid/ToastAndroid.ios.js b/Libraries/Components/ToastAndroid/ToastAndroid.ios.js index 611e50fe87b5..d6e98fc61d97 100644 --- a/Libraries/Components/ToastAndroid/ToastAndroid.ios.js +++ b/Libraries/Components/ToastAndroid/ToastAndroid.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,11 +11,11 @@ 'use strict'; const ToastAndroid = { - show: function(message: string, duration: number): void { + show: function (message: string, duration: number): void { console.warn('ToastAndroid is not supported on this platform.'); }, - showWithGravity: function( + showWithGravity: function ( message: string, duration: number, gravity: number, @@ -23,7 +23,7 @@ const ToastAndroid = { console.warn('ToastAndroid is not supported on this platform.'); }, - showWithGravityAndOffset: function( + showWithGravityAndOffset: function ( message: string, duration: number, gravity: number, diff --git a/Libraries/Components/Touchable/BoundingDimensions.js b/Libraries/Components/Touchable/BoundingDimensions.js index 114b950733df..87d9279bc686 100644 --- a/Libraries/Components/Touchable/BoundingDimensions.js +++ b/Libraries/Components/Touchable/BoundingDimensions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,7 +24,7 @@ function BoundingDimensions(width, height) { this.height = height; } -BoundingDimensions.prototype.destructor = function() { +BoundingDimensions.prototype.destructor = function () { this.width = null; this.height = null; }; @@ -33,7 +33,7 @@ BoundingDimensions.prototype.destructor = function() { * @param {HTMLElement} element Element to return `BoundingDimensions` for. * @return {BoundingDimensions} Bounding dimensions of `element`. */ -BoundingDimensions.getPooledFromElement = function(element) { +BoundingDimensions.getPooledFromElement = function (element) { return BoundingDimensions.getPooled( element.offsetWidth, element.offsetHeight, diff --git a/Libraries/Components/Touchable/PooledClass.js b/Libraries/Components/Touchable/PooledClass.js index 1c9e940bd53d..139f1657ea48 100644 --- a/Libraries/Components/Touchable/PooledClass.js +++ b/Libraries/Components/Touchable/PooledClass.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,8 +18,8 @@ import invariant from 'invariant'; * the Class itself, not an instance. If any others are needed, simply add them * here, or in their own files. */ -const oneArgumentPooler = function(copyFieldsFrom) { - const Klass = this; +const oneArgumentPooler = function (copyFieldsFrom) { + const Klass = this; // eslint-disable-line consistent-this if (Klass.instancePool.length) { const instance = Klass.instancePool.pop(); Klass.call(instance, copyFieldsFrom); @@ -29,8 +29,8 @@ const oneArgumentPooler = function(copyFieldsFrom) { } }; -const twoArgumentPooler = function(a1, a2) { - const Klass = this; +const twoArgumentPooler = function (a1, a2) { + const Klass = this; // eslint-disable-line consistent-this if (Klass.instancePool.length) { const instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2); @@ -40,8 +40,8 @@ const twoArgumentPooler = function(a1, a2) { } }; -const threeArgumentPooler = function(a1, a2, a3) { - const Klass = this; +const threeArgumentPooler = function (a1, a2, a3) { + const Klass = this; // eslint-disable-line consistent-this if (Klass.instancePool.length) { const instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3); @@ -51,8 +51,8 @@ const threeArgumentPooler = function(a1, a2, a3) { } }; -const fourArgumentPooler = function(a1, a2, a3, a4) { - const Klass = this; +const fourArgumentPooler = function (a1, a2, a3, a4) { + const Klass = this; // eslint-disable-line consistent-this if (Klass.instancePool.length) { const instance = Klass.instancePool.pop(); Klass.call(instance, a1, a2, a3, a4); @@ -62,8 +62,8 @@ const fourArgumentPooler = function(a1, a2, a3, a4) { } }; -const standardReleaser = function(instance) { - const Klass = this; +const standardReleaser = function (instance) { + const Klass = this; // eslint-disable-line consistent-this invariant( instance instanceof Klass, 'Trying to release an instance into a pool of a different type.', @@ -88,7 +88,7 @@ type Pooler = any; * @param {Function} CopyConstructor Constructor that can be used to reset. * @param {Function} pooler Customizable pooler. */ -const addPoolingTo = function( +const addPoolingTo = function ( CopyConstructor: Class, pooler: Pooler, ): Class & { diff --git a/Libraries/Components/Touchable/Position.js b/Libraries/Components/Touchable/Position.js index 5656bf9aaab9..adbbd170c0d0 100644 --- a/Libraries/Components/Touchable/Position.js +++ b/Libraries/Components/Touchable/Position.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ function Position(left, top) { this.top = top; } -Position.prototype.destructor = function() { +Position.prototype.destructor = function () { this.left = null; this.top = null; }; diff --git a/Libraries/Components/Touchable/Touchable.js b/Libraries/Components/Touchable/Touchable.js index 6622645cab6b..47fdfa892d06 100644 --- a/Libraries/Components/Touchable/Touchable.js +++ b/Libraries/Components/Touchable/Touchable.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -361,7 +361,7 @@ const LONG_PRESS_ALLOWED_MOVEMENT = 10; * @lends Touchable.prototype */ const TouchableMixin = { - componentDidMount: function() { + componentDidMount: function () { if (!Platform.isTV) { return; } @@ -370,7 +370,7 @@ const TouchableMixin = { /** * Clear all timeouts on unmount */ - componentWillUnmount: function() { + componentWillUnmount: function () { this.touchableDelayTimeout && clearTimeout(this.touchableDelayTimeout); this.longPressDelayTimeout && clearTimeout(this.longPressDelayTimeout); this.pressOutDelayTimeout && clearTimeout(this.pressOutDelayTimeout); @@ -383,7 +383,7 @@ const TouchableMixin = { * @return {object} State object to be placed inside of * `this.state.touchable`. */ - touchableGetInitialState: function(): $TEMPORARY$object<{| + touchableGetInitialState: function (): $TEMPORARY$object<{| touchable: $TEMPORARY$object<{|responderID: null, touchState: void|}>, |}> { return { @@ -395,21 +395,21 @@ const TouchableMixin = { /** * Must return true if embedded in a native platform scroll view. */ - touchableHandleResponderTerminationRequest: function(): any { + touchableHandleResponderTerminationRequest: function (): any { return !this.props.rejectResponderTermination; }, /** * Must return true to start the process of `Touchable`. */ - touchableHandleStartShouldSetResponder: function(): any { + touchableHandleStartShouldSetResponder: function (): any { return !this.props.disabled; }, /** * Return true to cancel press on long press. */ - touchableLongPressCancelsPress: function(): boolean { + touchableLongPressCancelsPress: function (): boolean { return true; }, @@ -418,8 +418,7 @@ const TouchableMixin = { * @param {SyntheticEvent} e Synthetic event from event system. * */ - // $FlowFixMe[signature-verification-failure] - touchableHandleResponderGrant: function(e: PressEvent) { + touchableHandleResponderGrant: function (e: PressEvent) { const dispatchID = e.currentTarget; // Since e is used in a callback invoked on another event loop // (as in setTimeout etc), we need to call e.persist() on the @@ -460,8 +459,7 @@ const TouchableMixin = { /** * Place as callback for a DOM element's `onResponderRelease` event. */ - // $FlowFixMe[signature-verification-failure] - touchableHandleResponderRelease: function(e: PressEvent) { + touchableHandleResponderRelease: function (e: PressEvent) { this.pressInLocation = null; this._receiveSignal(Signals.RESPONDER_RELEASE, e); }, @@ -469,8 +467,7 @@ const TouchableMixin = { /** * Place as callback for a DOM element's `onResponderTerminate` event. */ - // $FlowFixMe[signature-verification-failure] - touchableHandleResponderTerminate: function(e: PressEvent) { + touchableHandleResponderTerminate: function (e: PressEvent) { this.pressInLocation = null; this._receiveSignal(Signals.RESPONDER_TERMINATED, e); }, @@ -478,8 +475,7 @@ const TouchableMixin = { /** * Place as callback for a DOM element's `onResponderMove` event. */ - // $FlowFixMe[signature-verification-failure] - touchableHandleResponderMove: function(e: PressEvent) { + touchableHandleResponderMove: function (e: PressEvent) { // Measurement may not have returned yet. if (!this.state.touchable.positionOnActivate) { return; @@ -564,8 +560,7 @@ const TouchableMixin = { * element that was blurred just prior to this. This can be overridden when * using `Touchable.Mixin.withoutDefaultFocusAndBlur`. */ - // $FlowFixMe[signature-verification-failure] - touchableHandleFocus: function(e: Event) { + touchableHandleFocus: function (e: Event) { this.props.onFocus && this.props.onFocus(e); }, @@ -577,8 +572,7 @@ const TouchableMixin = { * This can be overridden when using * `Touchable.Mixin.withoutDefaultFocusAndBlur`. */ - // $FlowFixMe[signature-verification-failure] - touchableHandleBlur: function(e: Event) { + touchableHandleBlur: function (e: Event) { this.props.onBlur && this.props.onBlur(e); }, @@ -658,7 +652,7 @@ const TouchableMixin = { * @sideeffects * @private */ - _remeasureMetricsOnActivation: function() { + _remeasureMetricsOnActivation: function () { const responderID = this.state.touchable.responderID; if (responderID == null) { return; @@ -671,8 +665,7 @@ const TouchableMixin = { } }, - // $FlowFixMe[signature-verification-failure] - _handleQueryLayout: function( + _handleQueryLayout: function ( l: number, t: number, w: number, @@ -698,14 +691,12 @@ const TouchableMixin = { ); }, - // $FlowFixMe[signature-verification-failure] - _handleDelay: function(e: PressEvent) { + _handleDelay: function (e: PressEvent) { this.touchableDelayTimeout = null; this._receiveSignal(Signals.DELAY, e); }, - // $FlowFixMe[signature-verification-failure] - _handleLongDelay: function(e: PressEvent) { + _handleLongDelay: function (e: PressEvent) { this.longPressDelayTimeout = null; const curState = this.state.touchable.touchState; if ( @@ -724,8 +715,7 @@ const TouchableMixin = { * @throws Error if invalid state transition or unrecognized signal. * @sideeffects */ - // $FlowFixMe[signature-verification-failure] - _receiveSignal: function(signal: Signal, e: PressEvent) { + _receiveSignal: function (signal: Signal, e: PressEvent) { const responderID = this.state.touchable.responderID; const curState = this.state.touchable.touchState; const nextState = Transitions[curState] && Transitions[curState][signal]; @@ -764,20 +754,19 @@ const TouchableMixin = { } }, - _cancelLongPressDelayTimeout: function() { + _cancelLongPressDelayTimeout: function () { this.longPressDelayTimeout && clearTimeout(this.longPressDelayTimeout); this.longPressDelayTimeout = null; }, - _isHighlight: function(state: State): boolean { + _isHighlight: function (state: State): boolean { return ( state === States.RESPONDER_ACTIVE_PRESS_IN || state === States.RESPONDER_ACTIVE_LONG_PRESS_IN ); }, - // $FlowFixMe[signature-verification-failure] - _savePressInLocation: function(e: PressEvent) { + _savePressInLocation: function (e: PressEvent) { const touch = extractSingleTouch(e.nativeEvent); const pageX = touch && touch.pageX; const pageY = touch && touch.pageY; @@ -786,7 +775,7 @@ const TouchableMixin = { this.pressInLocation = {pageX, pageY, locationX, locationY}; }, - _getDistanceBetweenPoints: function( + _getDistanceBetweenPoints: function ( aX: number, aY: number, bX: number, @@ -808,8 +797,7 @@ const TouchableMixin = { * @param {Event} e Native event. * @sideeffects */ - // $FlowFixMe[signature-verification-failure] - _performSideEffectsForTransition: function( + _performSideEffectsForTransition: function ( curState: State, nextState: State, signal: Signal, @@ -870,14 +858,12 @@ const TouchableMixin = { this.touchableDelayTimeout = null; }, - // $FlowFixMe[signature-verification-failure] - _startHighlight: function(e: PressEvent) { + _startHighlight: function (e: PressEvent) { this._savePressInLocation(e); this.touchableHandleActivePressIn && this.touchableHandleActivePressIn(e); }, - // $FlowFixMe[signature-verification-failure] - _endHighlight: function(e: PressEvent) { + _endHighlight: function (e: PressEvent) { if (this.touchableHandleActivePressOut) { if ( this.touchableGetPressOutDelayMS && @@ -906,7 +892,8 @@ const { touchableHandleBlur, ...TouchableMixinWithoutDefaultFocusAndBlur } = TouchableMixin; -TouchableMixin.withoutDefaultFocusAndBlur = TouchableMixinWithoutDefaultFocusAndBlur; +TouchableMixin.withoutDefaultFocusAndBlur = + TouchableMixinWithoutDefaultFocusAndBlur; const Touchable = { Mixin: TouchableMixin, diff --git a/Libraries/Components/Touchable/TouchableBounce.js b/Libraries/Components/Touchable/TouchableBounce.js index 4bf9c201fc5a..60f4050e7798 100644 --- a/Libraries/Components/Touchable/TouchableBounce.js +++ b/Libraries/Components/Touchable/TouchableBounce.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -128,11 +128,8 @@ class TouchableBounce extends React.Component { render(): React.Node { // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before // adopting `Pressability`, so preserve that behavior. - const { - onBlur, - onFocus, - ...eventHandlersWithoutBlurAndFocus - } = this.state.pressability.getEventHandlers(); + const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} = + this.state.pressability.getEventHandlers(); return ( { // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before // adopting `Pressability`, so preserve that behavior. - const { - onBlur, - onFocus, - ...eventHandlersWithoutBlurAndFocus - } = this.state.pressability.getEventHandlers(); + const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} = + this.state.pressability.getEventHandlers(); const accessibilityState = this.props.disabled != null diff --git a/Libraries/Components/Touchable/TouchableNativeFeedback.js b/Libraries/Components/Touchable/TouchableNativeFeedback.js index 6132f0a6c259..1ae3119ebaf7 100644 --- a/Libraries/Components/Touchable/TouchableNativeFeedback.js +++ b/Libraries/Components/Touchable/TouchableNativeFeedback.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -99,9 +99,7 @@ class TouchableNativeFeedback extends React.Component { * Creates a value for the `background` prop that uses the Android theme's * default background for selectable elements. */ - static SelectableBackground: ( - rippleRadius: ?number, - ) => $ReadOnly<{| + static SelectableBackground: (rippleRadius: ?number) => $ReadOnly<{| attribute: 'selectableItemBackground', type: 'ThemeAttrAndroid', rippleRadius: ?number, @@ -115,9 +113,7 @@ class TouchableNativeFeedback extends React.Component { * Creates a value for the `background` prop that uses the Android theme's * default background for borderless selectable elements. Requires API 21+. */ - static SelectableBackgroundBorderless: ( - rippleRadius: ?number, - ) => $ReadOnly<{| + static SelectableBackgroundBorderless: (rippleRadius: ?number) => $ReadOnly<{| attribute: 'selectableItemBackgroundBorderless', type: 'ThemeAttrAndroid', rippleRadius: ?number, @@ -252,11 +248,8 @@ class TouchableNativeFeedback extends React.Component { // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before // adopting `Pressability`, so preserve that behavior. - const { - onBlur, - onFocus, - ...eventHandlersWithoutBlurAndFocus - } = this.state.pressability.getEventHandlers(); + const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} = + this.state.pressability.getEventHandlers(); const accessibilityState = this.props.disabled != null diff --git a/Libraries/Components/Touchable/TouchableOpacity.js b/Libraries/Components/Touchable/TouchableOpacity.js index 01b59674ad38..089c50c008f7 100644 --- a/Libraries/Components/Touchable/TouchableOpacity.js +++ b/Libraries/Components/Touchable/TouchableOpacity.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -188,7 +188,6 @@ class TouchableOpacity extends React.Component { Animated.timing(this.state.anim, { toValue, duration, - // $FlowFixMe[method-unbinding] easing: Easing.inOut(Easing.quad), useNativeDriver: true, }).start(); @@ -210,11 +209,8 @@ class TouchableOpacity extends React.Component { render(): React.Node { // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before // adopting `Pressability`, so preserve that behavior. - const { - onBlur, - onFocus, - ...eventHandlersWithoutBlurAndFocus - } = this.state.pressability.getEventHandlers(); + const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} = + this.state.pressability.getEventHandlers(); const accessibilityState = this.props.disabled != null diff --git a/Libraries/Components/Touchable/TouchableWithoutFeedback.js b/Libraries/Components/Touchable/TouchableWithoutFeedback.js index 0b2c305b232d..b1bb99c28a9c 100755 --- a/Libraries/Components/Touchable/TouchableWithoutFeedback.js +++ b/Libraries/Components/Touchable/TouchableWithoutFeedback.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -106,11 +106,8 @@ class TouchableWithoutFeedback extends React.Component { // BACKWARD-COMPATIBILITY: Focus and blur events were never supported before // adopting `Pressability`, so preserve that behavior. - const { - onBlur, - onFocus, - ...eventHandlersWithoutBlurAndFocus - } = this.state.pressability.getEventHandlers(); + const {onBlur, onFocus, ...eventHandlersWithoutBlurAndFocus} = + this.state.pressability.getEventHandlers(); const elementProps: {[string]: mixed, ...} = { ...eventHandlersWithoutBlurAndFocus, diff --git a/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js b/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js index f25f4150dedf..d1ae224b2206 100644 --- a/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js +++ b/Libraries/Components/Touchable/__tests__/TouchableHighlight-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Touchable/__tests__/TouchableNativeFeedback-test.js b/Libraries/Components/Touchable/__tests__/TouchableNativeFeedback-test.js index 237b1a22745c..dca7e508cc64 100644 --- a/Libraries/Components/Touchable/__tests__/TouchableNativeFeedback-test.js +++ b/Libraries/Components/Touchable/__tests__/TouchableNativeFeedback-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Touchable/__tests__/TouchableOpacity-test.js b/Libraries/Components/Touchable/__tests__/TouchableOpacity-test.js index f38211b67aeb..30aa9b656aa2 100644 --- a/Libraries/Components/Touchable/__tests__/TouchableOpacity-test.js +++ b/Libraries/Components/Touchable/__tests__/TouchableOpacity-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/Touchable/__tests__/TouchableWithoutFeedback-test.js b/Libraries/Components/Touchable/__tests__/TouchableWithoutFeedback-test.js index 0648d372d388..bbf3483ec8b0 100644 --- a/Libraries/Components/Touchable/__tests__/TouchableWithoutFeedback-test.js +++ b/Libraries/Components/Touchable/__tests__/TouchableWithoutFeedback-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js b/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js index 2a2969905bc6..89e2d42f2e16 100644 --- a/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js +++ b/Libraries/Components/UnimplementedViews/UnimplementedNativeViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/UnimplementedViews/UnimplementedView.js b/Libraries/Components/UnimplementedViews/UnimplementedView.js index 4bbb41060ff3..24a6e3a51c4e 100644 --- a/Libraries/Components/UnimplementedViews/UnimplementedView.js +++ b/Libraries/Components/UnimplementedViews/UnimplementedView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/View/ReactNativeStyleAttributes.js b/Libraries/Components/View/ReactNativeStyleAttributes.js index 9f87352219ef..9525991e831b 100644 --- a/Libraries/Components/View/ReactNativeStyleAttributes.js +++ b/Libraries/Components/View/ReactNativeStyleAttributes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/View/ReactNativeViewAttributes.js b/Libraries/Components/View/ReactNativeViewAttributes.js index da38aeef7908..be31fae1ae2b 100644 --- a/Libraries/Components/View/ReactNativeViewAttributes.js +++ b/Libraries/Components/View/ReactNativeViewAttributes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/View/ReactNativeViewViewConfig.js b/Libraries/Components/View/ReactNativeViewViewConfig.js index ff0b6d837e17..e56eb0dfe3db 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfig.js +++ b/Libraries/Components/View/ReactNativeViewViewConfig.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -104,6 +104,15 @@ const ReactNativeViewConfig: ViewConfig = { topMagicTap: { registrationName: 'onMagicTap', }, + topPointerEnter: { + registrationName: 'pointerenter', + }, + topPointerLeave: { + registrationName: 'pointerleave', + }, + topPointerMove: { + registrationName: 'pointermove', + }, // Events for react-native-gesture-handler (T45765076) // Remove once this library can handle JS View Configs onGestureHandlerEvent: { @@ -122,7 +131,6 @@ const ReactNativeViewConfig: ViewConfig = { accessibilityLabel: true, accessibilityLiveRegion: true, accessibilityRole: true, - accessibilityStates: true, // TODO: Can be removed after next release accessibilityState: true, accessibilityValue: true, accessibilityViewIsModal: true, @@ -193,6 +201,9 @@ const ReactNativeViewConfig: ViewConfig = { onAccessibilityAction: true, onAccessibilityEscape: true, onAccessibilityTap: true, + pointerenter: true, + pointerleave: true, + pointermove: true, onLayout: true, onMagicTap: true, opacity: true, diff --git a/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js b/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js index ad2542dfa284..504e5290272c 100644 --- a/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js +++ b/Libraries/Components/View/ReactNativeViewViewConfigAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/View/View.js b/Libraries/Components/View/View.js index 5bf6f7407d40..0379a7ce912f 100644 --- a/Libraries/Components/View/View.js +++ b/Libraries/Components/View/View.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/View/ViewAccessibility.js b/Libraries/Components/View/ViewAccessibility.js index 66ba513789f9..51343752c55e 100644 --- a/Libraries/Components/View/ViewAccessibility.js +++ b/Libraries/Components/View/ViewAccessibility.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/View/ViewNativeComponent.js b/Libraries/Components/View/ViewNativeComponent.js index 4ca5ec9cf3c4..9d6db6e23cfb 100644 --- a/Libraries/Components/View/ViewNativeComponent.js +++ b/Libraries/Components/View/ViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,13 +16,12 @@ import ReactNativeViewViewConfigAndroid from './ReactNativeViewViewConfigAndroid import {type ViewProps as Props} from './ViewPropTypes'; import * as React from 'react'; -const ViewNativeComponent: HostComponent = NativeComponentRegistry.get( - 'RCTView', - () => +const ViewNativeComponent: HostComponent = + NativeComponentRegistry.get('RCTView', () => Platform.OS === 'android' ? ReactNativeViewViewConfigAndroid : {uiViewClassName: 'RCTView'}, -); + ); interface NativeCommands { +hotspotUpdate: ( diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 497d94cff18b..0e6f739470b3 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -49,7 +49,7 @@ type DirectEventProps = $ReadOnly<{| * When `accessible` is true, the system will try to invoke this function * when the user performs accessibility tap gesture. * - * See https://reactnative.dev/docs/view.html#onaccessibilitytap + * See https://reactnative.dev/docs/view#onaccessibilitytap */ onAccessibilityTap?: ?() => mixed, @@ -62,7 +62,7 @@ type DirectEventProps = $ReadOnly<{| * the new layout may not yet be reflected on the screen at the time the * event is received, especially if a layout animation is in progress. * - * See https://reactnative.dev/docs/view.html#onlayout + * See https://reactnative.dev/docs/view#onlayout */ onLayout?: ?(event: LayoutEvent) => mixed, @@ -70,7 +70,7 @@ type DirectEventProps = $ReadOnly<{| * When `accessible` is `true`, the system will invoke this function when the * user performs the magic tap gesture. * - * See https://reactnative.dev/docs/view.html#onmagictap + * See https://reactnative.dev/docs/view#onmagictap */ onMagicTap?: ?() => mixed, @@ -78,7 +78,7 @@ type DirectEventProps = $ReadOnly<{| * When `accessible` is `true`, the system will invoke this function when the * user performs the escape gesture. * - * See https://reactnative.dev/docs/view.html#onaccessibilityescape + * See https://reactnative.dev/docs/view#onaccessibilityescape */ onAccessibilityEscape?: ?() => mixed, |}>; @@ -112,7 +112,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onMoveShouldSetResponder: (event) => [true | false]`, where * `event` is a synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onmoveshouldsetresponder + * See https://reactnative.dev/docs/view#onmoveshouldsetresponder */ onMoveShouldSetResponder?: ?(e: PressEvent) => boolean, @@ -123,7 +123,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onMoveShouldSetResponderCapture: (event) => [true | false]`, * where `event` is a synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onMoveShouldsetrespondercapture + * See https://reactnative.dev/docs/view#onMoveShouldsetrespondercapture */ onMoveShouldSetResponderCapture?: ?(e: PressEvent) => boolean, @@ -137,7 +137,7 @@ type GestureResponderEventProps = $ReadOnly<{| * PanResponder includes a note `// TODO: t7467124 investigate if this can be removed` that * should help fixing this return type. * - * See https://reactnative.dev/docs/view.html#onrespondergrant + * See https://reactnative.dev/docs/view#onrespondergrant */ onResponderGrant?: ?(e: PressEvent) => void | boolean, @@ -147,7 +147,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onResponderMove: (event) => {}`, where `event` is a synthetic * touch event as described above. * - * See https://reactnative.dev/docs/view.html#onrespondermove + * See https://reactnative.dev/docs/view#onrespondermove */ onResponderMove?: ?(e: PressEvent) => void, @@ -158,7 +158,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onResponderReject: (event) => {}`, where `event` is a * synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onresponderreject + * See https://reactnative.dev/docs/view#onresponderreject */ onResponderReject?: ?(e: PressEvent) => void, @@ -168,7 +168,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onResponderRelease: (event) => {}`, where `event` is a * synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onresponderrelease + * See https://reactnative.dev/docs/view#onresponderrelease */ onResponderRelease?: ?(e: PressEvent) => void, @@ -184,7 +184,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onResponderTerminate: (event) => {}`, where `event` is a * synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onresponderterminate + * See https://reactnative.dev/docs/view#onresponderterminate */ onResponderTerminate?: ?(e: PressEvent) => void, @@ -195,7 +195,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onResponderTerminationRequest: (event) => {}`, where `event` * is a synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onresponderterminationrequest + * See https://reactnative.dev/docs/view#onresponderterminationrequest */ onResponderTerminationRequest?: ?(e: PressEvent) => boolean, @@ -205,7 +205,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onStartShouldSetResponder: (event) => [true | false]`, where * `event` is a synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onstartshouldsetresponder + * See https://reactnative.dev/docs/view#onstartshouldsetresponder */ onStartShouldSetResponder?: ?(e: PressEvent) => boolean, @@ -216,7 +216,7 @@ type GestureResponderEventProps = $ReadOnly<{| * `View.props.onStartShouldSetResponderCapture: (event) => [true | false]`, * where `event` is a synthetic touch event as described above. * - * See https://reactnative.dev/docs/view.html#onstartshouldsetrespondercapture + * See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture */ onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean, |}>; @@ -245,7 +245,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android * - * See https://reactnative.dev/docs/view.html#rendertohardwaretextureandroid + * See https://reactnative.dev/docs/view#rendertohardwaretextureandroid */ renderToHardwareTextureAndroid?: ?boolean, @@ -255,7 +255,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android * - * See https://reactnative.dev/docs/view.html#needsoffscreenalphacompositing + * See https://reactnative.dev/docs/view#needsoffscreenalphacompositing */ needsOffscreenAlphaCompositing?: ?boolean, @@ -265,7 +265,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android * - * See https://reactnative.dev/docs/view.html#accessibilityliveregion + * See https://reactnative.dev/docs/view#accessibilityliveregion */ accessibilityLiveRegion?: ?('none' | 'polite' | 'assertive'), @@ -276,7 +276,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android * - * See https://reactnative.dev/docs/view.html#importantforaccessibility + * See https://reactnative.dev/docs/view#importantforaccessibility */ importantForAccessibility?: ?('auto' | 'yes' | 'no' | 'no-hide-descendants'), @@ -352,7 +352,7 @@ type IOSViewProps = $ReadOnly<{| * * @platform ios * - * See https://reactnative.dev/docs/view.html#accessibilityviewismodal + * See https://reactnative.dev/docs/view#accessibilityviewismodal */ accessibilityViewIsModal?: ?boolean, @@ -362,7 +362,7 @@ type IOSViewProps = $ReadOnly<{| * * @platform ios * - * See https://reactnative.dev/docs/view.html#accessibilityElementsHidden + * See https://reactnative.dev/docs/view#accessibilityElementsHidden */ accessibilityElementsHidden?: ?boolean, @@ -371,7 +371,7 @@ type IOSViewProps = $ReadOnly<{| * * @platform ios * - * See https://reactnative.dev/docs/view.html#shouldrasterizeios + * See https://reactnative.dev/docs/view#shouldrasterizeios */ shouldRasterizeIOS?: ?boolean, |}>; @@ -392,7 +392,7 @@ export type ViewProps = $ReadOnly<{| * When `true`, indicates that the view is an accessibility element. * By default, all the touchable elements are accessible. * - * See https://reactnative.dev/docs/view.html#accessible + * See https://reactnative.dev/docs/view#accessible */ accessible?: ?boolean, @@ -401,7 +401,7 @@ export type ViewProps = $ReadOnly<{| * with the element. By default, the label is constructed by traversing all * the children and accumulating all the `Text` nodes separated by space. * - * See https://reactnative.dev/docs/view.html#accessibilitylabel + * See https://reactnative.dev/docs/view#accessibilitylabel */ accessibilityLabel?: ?Stringish, @@ -411,7 +411,7 @@ export type ViewProps = $ReadOnly<{| * accessibility label. * * - * See https://reactnative.dev/docs/view.html#accessibilityHint + * See https://reactnative.dev/docs/view#accessibilityHint */ accessibilityHint?: ?Stringish, @@ -432,6 +432,13 @@ export type ViewProps = $ReadOnly<{| */ accessibilityActions?: ?$ReadOnlyArray, + /** + * Specifies the nativeID of the associated label text. When the assistive technology focuses on the component with this props, the text is read aloud. + * + * @platform android + */ + accessibilityLabelledBy?: ?string | ?Array, + /** * Views that are only used to layout their children or otherwise don't draw * anything may be automatically removed from the native hierarchy as an @@ -441,7 +448,7 @@ export type ViewProps = $ReadOnly<{| * @platform android * In Fabric, this prop is used in ios as well. * - * See https://reactnative.dev/docs/view.html#collapsable + * See https://reactnative.dev/docs/view#collapsable */ collapsable?: ?boolean, @@ -450,7 +457,7 @@ export type ViewProps = $ReadOnly<{| * * > This disables the 'layout-only view removal' optimization for this view! * - * See https://reactnative.dev/docs/view.html#testid + * See https://reactnative.dev/docs/view#testid */ testID?: ?string, @@ -459,7 +466,7 @@ export type ViewProps = $ReadOnly<{| * * > This disables the 'layout-only view removal' optimization for this view! * - * See https://reactnative.dev/docs/view.html#nativeid + * See https://reactnative.dev/docs/view#nativeid */ nativeID?: ?string, @@ -472,14 +479,14 @@ export type ViewProps = $ReadOnly<{| * > of sibling views always takes precedence if a touch hits two overlapping * > views. * - * See https://reactnative.dev/docs/view.html#hitslop + * See https://reactnative.dev/docs/view#hitslop */ hitSlop?: ?EdgeInsetsProp, /** * Controls whether the `View` can be the target of touch events. * - * See https://reactnative.dev/docs/view.html#pointerevents + * See https://reactnative.dev/docs/view#pointerevents */ pointerEvents?: ?('auto' | 'box-none' | 'box-only' | 'none'), @@ -491,7 +498,7 @@ export type ViewProps = $ReadOnly<{| * subviews must also have `overflow: hidden`, as should the containing view * (or one of its superviews). * - * See https://reactnative.dev/docs/view.html#removeclippedsubviews + * See https://reactnative.dev/docs/view#removeclippedsubviews */ removeClippedSubviews?: ?boolean, |}>; diff --git a/Libraries/Components/__tests__/Button-test.js b/Libraries/Components/__tests__/Button-test.js index f81f9bc63d22..d2f976371aa9 100644 --- a/Libraries/Components/__tests__/Button-test.js +++ b/Libraries/Components/__tests__/Button-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Components/__tests__/Slider-test.js b/Libraries/Components/__tests__/Slider-test.js index 5e3a9f47f86b..876627fa038d 100644 --- a/Libraries/Components/__tests__/Slider-test.js +++ b/Libraries/Components/__tests__/Slider-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js b/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js index a92172c98761..020af845708b 100644 --- a/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js +++ b/Libraries/Core/Devtools/__tests__/parseErrorStack-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,8 +16,8 @@ function getFakeError() { return new Error('Happy Cat'); } -describe('parseErrorStack', function() { - it('parses error stack', function() { +describe('parseErrorStack', function () { + it('parses error stack', function () { const stack = parseErrorStack(getFakeError().stack); expect(stack.length).toBeGreaterThan(0); @@ -26,7 +26,7 @@ describe('parseErrorStack', function() { expect(firstFrame.file).toMatch(/parseErrorStack-test\.js$/); }); - it('does not support framesToPop', function() { + it('does not support framesToPop', function () { function getWrappedError() { const error = getFakeError(); error.framesToPop = 1; @@ -37,7 +37,7 @@ describe('parseErrorStack', function() { expect(stack[0].methodName).toEqual('getFakeError'); }); - it('ignores bad inputs', function() { + it('ignores bad inputs', function () { expect(parseErrorStack(undefined)).toEqual([]); expect(parseErrorStack(null)).toEqual([]); }); diff --git a/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js b/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js index 8b24b9729465..f821fc1c91ca 100644 --- a/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js +++ b/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Devtools/getDevServer.js b/Libraries/Core/Devtools/getDevServer.js index d820a9ee5dca..a4d886be74c7 100644 --- a/Libraries/Core/Devtools/getDevServer.js +++ b/Libraries/Core/Devtools/getDevServer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Devtools/openFileInEditor.js b/Libraries/Core/Devtools/openFileInEditor.js index 66dca4721b9c..2f4e8b127d27 100644 --- a/Libraries/Core/Devtools/openFileInEditor.js +++ b/Libraries/Core/Devtools/openFileInEditor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Devtools/openURLInBrowser.js b/Libraries/Core/Devtools/openURLInBrowser.js index d4b00663aaf0..986fa5d1f3f4 100644 --- a/Libraries/Core/Devtools/openURLInBrowser.js +++ b/Libraries/Core/Devtools/openURLInBrowser.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Devtools/parseErrorStack.js b/Libraries/Core/Devtools/parseErrorStack.js index 185ddcb7e753..e0039c85d6f1 100644 --- a/Libraries/Core/Devtools/parseErrorStack.js +++ b/Libraries/Core/Devtools/parseErrorStack.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Devtools/parseHermesStack.js b/Libraries/Core/Devtools/parseHermesStack.js index 70d47a0991d5..cd21958d9eeb 100644 --- a/Libraries/Core/Devtools/parseHermesStack.js +++ b/Libraries/Core/Devtools/parseHermesStack.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -58,7 +58,8 @@ export type HermesParsedStack = {| // 4. source URL (filename) // 5. line number (1 based) // 6. column number (1 based) or virtual offset (0 based) -const RE_FRAME = /^ {4}at (.+?)(?: \((native)\)?| \((address at )?(.*?):(\d+):(\d+)\))$/; +const RE_FRAME = + /^ {4}at (.+?)(?: \((native)\)?| \((address at )?(.*?):(\d+):(\d+)\))$/; // Capturing groups: // 1. count of skipped frames diff --git a/Libraries/Core/Devtools/symbolicateStackTrace.js b/Libraries/Core/Devtools/symbolicateStackTrace.js index cfb266c7339c..32ad1c7636fe 100644 --- a/Libraries/Core/Devtools/symbolicateStackTrace.js +++ b/Libraries/Core/Devtools/symbolicateStackTrace.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/ExceptionsManager.js b/Libraries/Core/ExceptionsManager.js index 00caaf92ab9c..7a63a31196aa 100644 --- a/Libraries/Core/ExceptionsManager.js +++ b/Libraries/Core/ExceptionsManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -102,8 +102,8 @@ function reportException( isComponentError: !!e.isComponentError, }); } else if (isFatal || e.type !== 'warn') { - const NativeExceptionsManager = require('./NativeExceptionsManager') - .default; + const NativeExceptionsManager = + require('./NativeExceptionsManager').default; if (NativeExceptionsManager) { NativeExceptionsManager.reportException(data); } diff --git a/Libraries/Core/ExtendedError.js b/Libraries/Core/ExtendedError.js index e6b9a6510317..ced640c5046a 100644 --- a/Libraries/Core/ExtendedError.js +++ b/Libraries/Core/ExtendedError.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index e30baa2eb725..ee7b99f74318 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,8 +8,6 @@ * @flow strict-local */ -/* globals window: true */ - /** * Sets up global variables typical in most JavaScript environments. * diff --git a/Libraries/Core/NativeExceptionsManager.js b/Libraries/Core/NativeExceptionsManager.js index 3716edbd4c7e..566428ab2c23 100644 --- a/Libraries/Core/NativeExceptionsManager.js +++ b/Libraries/Core/NativeExceptionsManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -57,9 +57,8 @@ export interface Spec extends TurboModule { const Platform = require('../Utilities/Platform'); -const NativeModule = TurboModuleRegistry.getEnforcing( - 'ExceptionsManager', -); +const NativeModule = + TurboModuleRegistry.getEnforcing('ExceptionsManager'); const ExceptionsManager = { reportFatalException( diff --git a/Libraries/Core/ReactFiberErrorDialog.js b/Libraries/Core/ReactFiberErrorDialog.js index 28ce55d57565..cb1132b1f88f 100644 --- a/Libraries/Core/ReactFiberErrorDialog.js +++ b/Libraries/Core/ReactFiberErrorDialog.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/ReactNativeVersion.js b/Libraries/Core/ReactNativeVersion.js index 67ca7cd62bcf..40b45a302382 100644 --- a/Libraries/Core/ReactNativeVersion.js +++ b/Libraries/Core/ReactNativeVersion.js @@ -1,17 +1,17 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * @generated by scripts/set-rn-version.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format - * @generated by scripts/bump-oss-version.js * @flow strict */ exports.version = { major: 0, - minor: 0, - patch: 0, + minor: 68, + patch: 3, prerelease: null, }; diff --git a/Libraries/Core/ReactNativeVersionCheck.js b/Libraries/Core/ReactNativeVersionCheck.js index 9536899f7dd2..6b4c0973e571 100644 --- a/Libraries/Core/ReactNativeVersionCheck.js +++ b/Libraries/Core/ReactNativeVersionCheck.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -38,7 +38,17 @@ exports.checkVersions = function checkVersions(): void { } }; -function _formatVersion(version): string { +function _formatVersion( + version: + | {major: number, minor: number, patch: number, prerelease: ?number} + | {major: number, minor: number, patch: number, prerelease: ?string} + | $TEMPORARY$object<{ + major: number, + minor: number, + patch: number, + prerelease: null, + }>, +): string { return ( `${version.major}.${version.minor}.${version.patch}` + // eslint-disable-next-line eqeqeq diff --git a/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js b/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js index e90abdf3aead..32efa714cc60 100644 --- a/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js +++ b/Libraries/Core/SegmentFetcher/NativeSegmentFetcher.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Timers/JSTimers.js b/Libraries/Core/Timers/JSTimers.js index 5c2f0d854e5f..8682a1dcda57 100644 --- a/Libraries/Core/Timers/JSTimers.js +++ b/Libraries/Core/Timers/JSTimers.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -42,7 +42,7 @@ let requestIdleCallbacks: Array = []; const requestIdleCallbackTimeouts: {[number]: number, ...} = {}; let GUID = 1; -let errors: ?Array = null; +const errors: Array = []; let hasEmittedTimeDriftWarning = false; @@ -114,7 +114,7 @@ function _callTimer(timerID: number, frameTime: number, didTimeout: ?boolean) { callback(global.performance.now()); } else if (type === 'requestIdleCallback') { callback({ - timeRemaining: function() { + timeRemaining: function () { // TODO: Optimisation: allow running for longer than one frame if // there are no pending JS calls on the bridge from native. This // would require a way to check the bridge queue synchronously. @@ -130,11 +130,7 @@ function _callTimer(timerID: number, frameTime: number, didTimeout: ?boolean) { } } catch (e) { // Don't rethrow so that we can run all timers. - if (!errors) { - errors = [e]; - } else { - errors.push(e); - } + errors.push(e); } if (__DEV__) { @@ -209,7 +205,11 @@ const JSTimers = { * @param {function} func Callback to be invoked after `duration` ms. * @param {number} duration Number of milliseconds. */ - setTimeout: function(func: Function, duration: number, ...args: any): number { + setTimeout: function ( + func: Function, + duration: number, + ...args: any + ): number { const id = _allocateCallback( () => func.apply(undefined, args), 'setTimeout', @@ -222,7 +222,7 @@ const JSTimers = { * @param {function} func Callback to be invoked every `duration` ms. * @param {number} duration Number of milliseconds. */ - setInterval: function( + setInterval: function ( func: Function, duration: number, ...args: any @@ -243,7 +243,7 @@ const JSTimers = { * @param {function} func Callback to be invoked before the end of the * current JavaScript execution loop. */ - queueReactNativeMicrotask: function(func: Function, ...args: any) { + queueReactNativeMicrotask: function (func: Function, ...args: any) { const id = _allocateCallback( () => func.apply(undefined, args), 'queueReactNativeMicrotask', @@ -255,7 +255,7 @@ const JSTimers = { /** * @param {function} func Callback to be invoked every frame. */ - requestAnimationFrame: function(func: Function) { + requestAnimationFrame: function (func: Function) { const id = _allocateCallback(func, 'requestAnimationFrame'); createTimer(id, 1, Date.now(), /* recurring */ false); return id; @@ -266,7 +266,7 @@ const JSTimers = { * with time remaining in frame. * @param {?object} options */ - requestIdleCallback: function(func: Function, options: ?Object) { + requestIdleCallback: function (func: Function, options: ?Object) { if (requestIdleCallbacks.length === 0) { setSendIdleEvents(true); } @@ -304,7 +304,7 @@ const JSTimers = { return id; }, - cancelIdleCallback: function(timerID: number) { + cancelIdleCallback: function (timerID: number) { _freeCallback(timerID); const index = requestIdleCallbacks.indexOf(timerID); if (index !== -1) { @@ -322,15 +322,15 @@ const JSTimers = { } }, - clearTimeout: function(timerID: number) { + clearTimeout: function (timerID: number) { _freeCallback(timerID); }, - clearInterval: function(timerID: number) { + clearInterval: function (timerID: number) { _freeCallback(timerID); }, - clearReactNativeMicrotask: function(timerID: number) { + clearReactNativeMicrotask: function (timerID: number) { _freeCallback(timerID); const index = reactNativeMicrotasks.indexOf(timerID); if (index !== -1) { @@ -338,7 +338,7 @@ const JSTimers = { } }, - cancelAnimationFrame: function(timerID: number) { + cancelAnimationFrame: function (timerID: number) { _freeCallback(timerID); }, @@ -346,20 +346,19 @@ const JSTimers = { * This is called from the native side. We are passed an array of timerIDs, * and */ - callTimers: function(timersToCall: Array) { + callTimers: function (timersToCall: Array) { invariant( timersToCall.length !== 0, 'Cannot call `callTimers` with an empty list of IDs.', ); - errors = (null: ?Array); + errors.length = 0; for (let i = 0; i < timersToCall.length; i++) { _callTimer(timersToCall[i], 0); } - if (errors) { - // $FlowFixMe[incompatible-use] - const errorCount = errors.length; + const errorCount = errors.length; + if (errorCount > 0) { if (errorCount > 1) { // Throw all the other errors in a setTimeout, which will throw each // error one at a time @@ -367,18 +366,16 @@ const JSTimers = { JSTimers.setTimeout( (error => { throw error; - // $FlowFixMe[incompatible-use] }).bind(null, errors[ii]), 0, ); } } - // $FlowFixMe[incompatible-use] throw errors[0]; } }, - callIdleCallbacks: function(frameTime: number) { + callIdleCallbacks: function (frameTime: number) { if ( FRAME_DURATION - (global.performance.now() - frameTime) < IDLE_CALLBACK_FRAME_DEADLINE @@ -386,7 +383,7 @@ const JSTimers = { return; } - errors = (null: ?Array); + errors.length = 0; if (requestIdleCallbacks.length > 0) { const passIdleCallbacks = requestIdleCallbacks; requestIdleCallbacks = []; @@ -400,13 +397,11 @@ const JSTimers = { setSendIdleEvents(false); } - if (errors) { - errors.forEach(error => - JSTimers.setTimeout(() => { - throw error; - }, 0), - ); - } + errors.forEach(error => + JSTimers.setTimeout(() => { + throw error; + }, 0), + ); }, /** @@ -414,15 +409,13 @@ const JSTimers = { * before we hand control back to native. */ callReactNativeMicrotasks() { - errors = (null: ?Array); + errors.length = 0; while (_callReactNativeMicrotasksPass()) {} - if (errors) { - errors.forEach(error => - JSTimers.setTimeout(() => { - throw error; - }, 0), - ); - } + errors.forEach(error => + JSTimers.setTimeout(() => { + throw error; + }, 0), + ); }, /** diff --git a/Libraries/Core/Timers/NativeTiming.js b/Libraries/Core/Timers/NativeTiming.js index cc487a52a318..fa9b14d6f338 100644 --- a/Libraries/Core/Timers/NativeTiming.js +++ b/Libraries/Core/Timers/NativeTiming.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Timers/__tests__/JSTimers-test.js b/Libraries/Core/Timers/__tests__/JSTimers-test.js index 371e8548a91b..cd33eea71959 100644 --- a/Libraries/Core/Timers/__tests__/JSTimers-test.js +++ b/Libraries/Core/Timers/__tests__/JSTimers-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,9 +26,9 @@ jest const JSTimers = require('../JSTimers'); -describe('JSTimers', function() { - beforeEach(function() { - jest.spyOn(console, 'warn'); +describe('JSTimers', function () { + beforeEach(function () { + jest.spyOn(console, 'warn').mockReturnValue(undefined); global.setTimeout = JSTimers.setTimeout; }); @@ -36,24 +36,24 @@ describe('JSTimers', function() { console.warn.mockRestore(); }); - it('should call function with setTimeout', function() { + it('should call function with setTimeout', function () { let didCall = false; - const id = JSTimers.setTimeout(function() { + const id = JSTimers.setTimeout(function () { didCall = true; }); JSTimers.callTimers([id]); expect(didCall).toBe(true); }); - it('should call nested setTimeout when cleared', function() { + it('should call nested setTimeout when cleared', function () { let id1, id2, id3; let callCount = 0; - id1 = JSTimers.setTimeout(function() { + id1 = JSTimers.setTimeout(function () { JSTimers.clearTimeout(id1); - id2 = JSTimers.setTimeout(function() { + id2 = JSTimers.setTimeout(function () { JSTimers.clearTimeout(id2); - id3 = JSTimers.setTimeout(function() { + id3 = JSTimers.setTimeout(function () { callCount += 1; }); }); @@ -65,15 +65,15 @@ describe('JSTimers', function() { expect(callCount).toBe(1); }); - it('should call nested queueReactNativeMicrotask when cleared', function() { + it('should call nested queueReactNativeMicrotask when cleared', function () { let id1, id2, id3; let callCount = 0; - id1 = JSTimers.queueReactNativeMicrotask(function() { + id1 = JSTimers.queueReactNativeMicrotask(function () { JSTimers.clearReactNativeMicrotask(id1); - id2 = JSTimers.queueReactNativeMicrotask(function() { + id2 = JSTimers.queueReactNativeMicrotask(function () { JSTimers.clearReactNativeMicrotask(id2); - id3 = JSTimers.queueReactNativeMicrotask(function() { + id3 = JSTimers.queueReactNativeMicrotask(function () { callCount += 1; }); }); @@ -85,15 +85,15 @@ describe('JSTimers', function() { expect(callCount).toBe(1); }); - it('should call nested requestAnimationFrame when cleared', function() { + it('should call nested requestAnimationFrame when cleared', function () { let id1, id2, id3; let callCount = 0; - id1 = JSTimers.requestAnimationFrame(function() { + id1 = JSTimers.requestAnimationFrame(function () { JSTimers.cancelAnimationFrame(id1); - id2 = JSTimers.requestAnimationFrame(function() { + id2 = JSTimers.requestAnimationFrame(function () { JSTimers.cancelAnimationFrame(id2); - id3 = JSTimers.requestAnimationFrame(function() { + id3 = JSTimers.requestAnimationFrame(function () { callCount += 1; }); }); @@ -105,15 +105,15 @@ describe('JSTimers', function() { expect(callCount).toBe(1); }); - it('should call nested setInterval when cleared', function() { + it('should call nested setInterval when cleared', function () { let id1, id2, id3; let callCount = 0; - id1 = JSTimers.setInterval(function() { + id1 = JSTimers.setInterval(function () { JSTimers.clearInterval(id1); - id2 = JSTimers.setInterval(function() { + id2 = JSTimers.setInterval(function () { JSTimers.clearInterval(id2); - id3 = JSTimers.setInterval(function() { + id3 = JSTimers.setInterval(function () { callCount += 1; }); }); @@ -125,21 +125,21 @@ describe('JSTimers', function() { expect(callCount).toBe(1); }); - it('should call function with setInterval', function() { + it('should call function with setInterval', function () { const callback = jest.fn(); const id = JSTimers.setInterval(callback); JSTimers.callTimers([id]); expect(callback).toBeCalledTimes(1); }); - it('should call function with queueReactNativeMicrotask', function() { + it('should call function with queueReactNativeMicrotask', function () { const callback = jest.fn(); JSTimers.queueReactNativeMicrotask(callback); JSTimers.callReactNativeMicrotasks(); expect(callback).toBeCalledTimes(1); }); - it('should not call function with clearReactNativeMicrotask', function() { + it('should not call function with clearReactNativeMicrotask', function () { const callback = jest.fn(); const id = JSTimers.queueReactNativeMicrotask(callback); JSTimers.clearReactNativeMicrotask(id); @@ -147,14 +147,14 @@ describe('JSTimers', function() { expect(callback).not.toBeCalled(); }); - it('should call functions in the right order with queueReactNativeMicrotask', function() { + it('should call functions in the right order with queueReactNativeMicrotask', function () { let count = 0; let firstCalled = null; let secondCalled = null; - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { firstCalled = count++; }); - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { secondCalled = count++; }); JSTimers.callReactNativeMicrotasks(); @@ -162,14 +162,14 @@ describe('JSTimers', function() { expect(secondCalled).toBe(1); }); - it('should call functions in the right order with nested queueReactNativeMicrotask', function() { + it('should call functions in the right order with nested queueReactNativeMicrotask', function () { let count = 0; let firstCalled = null; let secondCalled = null; let thirdCalled = null; - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { firstCalled = count++; - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { thirdCalled = count++; }); secondCalled = count++; @@ -180,12 +180,12 @@ describe('JSTimers', function() { expect(thirdCalled).toBe(2); }); - it('should call nested queueReactNativeMicrotask', function() { + it('should call nested queueReactNativeMicrotask', function () { let firstCalled = false; let secondCalled = false; - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { firstCalled = true; - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { secondCalled = true; }); }); @@ -194,14 +194,14 @@ describe('JSTimers', function() { expect(secondCalled).toBe(true); }); - it('should call function with requestAnimationFrame', function() { + it('should call function with requestAnimationFrame', function () { const callback = jest.fn(); const id = JSTimers.requestAnimationFrame(callback); JSTimers.callTimers([id]); expect(callback).toBeCalledTimes(1); }); - it("should not call function if we don't callTimers", function() { + it("should not call function if we don't callTimers", function () { const callback = jest.fn(); JSTimers.setTimeout(callback, 10); expect(callback).not.toBeCalled(); @@ -211,7 +211,7 @@ describe('JSTimers', function() { expect(callback).not.toBeCalled(); }); - it('should call setInterval as many times as callTimers is called', function() { + it('should call setInterval as many times as callTimers is called', function () { const callback = jest.fn(); const id = JSTimers.setInterval(callback, 10); JSTimers.callTimers([id]); @@ -221,13 +221,13 @@ describe('JSTimers', function() { expect(callback).toBeCalledTimes(4); }); - it("should only call the function who's id we pass in", function() { + it("should only call the function who's id we pass in", function () { let firstCalled = false; let secondCalled = false; - JSTimers.setTimeout(function() { + JSTimers.setTimeout(function () { firstCalled = true; }); - const secondID = JSTimers.setTimeout(function() { + const secondID = JSTimers.setTimeout(function () { secondCalled = true; }); JSTimers.callTimers([secondID]); @@ -235,13 +235,13 @@ describe('JSTimers', function() { expect(secondCalled).toBe(true); }); - it('should work with calling multiple timers', function() { + it('should work with calling multiple timers', function () { let firstCalled = false; let secondCalled = false; - const firstID = JSTimers.setTimeout(function() { + const firstID = JSTimers.setTimeout(function () { firstCalled = true; }); - const secondID = JSTimers.setTimeout(function() { + const secondID = JSTimers.setTimeout(function () { secondCalled = true; }); JSTimers.callTimers([firstID, secondID]); @@ -249,27 +249,27 @@ describe('JSTimers', function() { expect(secondCalled).toBe(true); }); - it('should still execute all callbacks even if one throws', function() { - const firstID = JSTimers.setTimeout(function() { + it('should still execute all callbacks even if one throws', function () { + const firstID = JSTimers.setTimeout(function () { throw new Error('error'); }, 10); let secondCalled = false; - const secondID = JSTimers.setTimeout(function() { + const secondID = JSTimers.setTimeout(function () { secondCalled = true; }, 10); expect(JSTimers.callTimers.bind(null, [firstID, secondID])).toThrow(); expect(secondCalled).toBe(true); }); - it('should clear timers even if callback throws', function() { - const timerID = JSTimers.setTimeout(function() { + it('should clear timers even if callback throws', function () { + const timerID = JSTimers.setTimeout(function () { throw new Error('error'); }, 10); expect(JSTimers.callTimers.bind(null, [timerID])).toThrow('error'); JSTimers.callTimers.bind(null, [timerID]); }); - it('should not warn if callback is called on cancelled timer', function() { + it('should not warn if callback is called on cancelled timer', function () { const callback = jest.fn(); const timerID = JSTimers.setTimeout(callback, 10); JSTimers.clearTimeout(timerID); @@ -278,12 +278,12 @@ describe('JSTimers', function() { expect(console.warn).not.toBeCalled(); }); - it('should warn when callTimers is called with garbage timer id', function() { + it('should warn when callTimers is called with garbage timer id', function () { JSTimers.callTimers([1337]); expect(console.warn).toBeCalled(); }); - it('should only call callback once for setTimeout', function() { + it('should only call callback once for setTimeout', function () { const callback = jest.fn(); const timerID = JSTimers.setTimeout(callback, 10); // First time the timer fires, should call callback @@ -295,7 +295,7 @@ describe('JSTimers', function() { expect(console.warn).not.toBeCalled(); }); - it('should only call callback once for requestAnimationFrame', function() { + it('should only call callback once for requestAnimationFrame', function () { const callback = jest.fn(); const timerID = JSTimers.requestAnimationFrame(callback, 10); // First time the timer fires, should call callback @@ -307,11 +307,11 @@ describe('JSTimers', function() { expect(console.warn).not.toBeCalled(); }); - it('should re-throw first exception', function() { - const timerID1 = JSTimers.setTimeout(function() { + it('should re-throw first exception', function () { + const timerID1 = JSTimers.setTimeout(function () { throw new Error('first error'); }); - const timerID2 = JSTimers.setTimeout(function() { + const timerID2 = JSTimers.setTimeout(function () { throw new Error('second error'); }); expect(JSTimers.callTimers.bind(null, [timerID1, timerID2])).toThrowError( @@ -319,8 +319,8 @@ describe('JSTimers', function() { ); }); - it('should pass along errors thrown from queueReactNativeMicrotask', function() { - JSTimers.queueReactNativeMicrotask(function() { + it('should pass along errors thrown from queueReactNativeMicrotask', function () { + JSTimers.queueReactNativeMicrotask(function () { throw new Error('error within queueReactNativeMicrotask'); }); @@ -336,12 +336,12 @@ describe('JSTimers', function() { ); }); - it('should throw all errors from queueReactNativeMicrotask', function() { - JSTimers.queueReactNativeMicrotask(function() { + it('should throw all errors from queueReactNativeMicrotask', function () { + JSTimers.queueReactNativeMicrotask(function () { throw new Error('first error'); }); - JSTimers.queueReactNativeMicrotask(function() { + JSTimers.queueReactNativeMicrotask(function () { throw new Error('second error'); }); @@ -361,8 +361,8 @@ describe('JSTimers', function() { ); }); - it('should pass along errors thrown from setTimeout', function() { - const timerID = JSTimers.setTimeout(function() { + it('should pass along errors thrown from setTimeout', function () { + const timerID = JSTimers.setTimeout(function () { throw new Error('error within setTimeout'); }); @@ -371,11 +371,11 @@ describe('JSTimers', function() { ); }); - it('should throw all errors from setTimeout', function() { - const firstTimerID = JSTimers.setTimeout(function() { + it('should throw all errors from setTimeout', function () { + const firstTimerID = JSTimers.setTimeout(function () { throw new Error('first error'); }); - const secondTimerID = JSTimers.setTimeout(function() { + const secondTimerID = JSTimers.setTimeout(function () { throw new Error('second error'); }); @@ -391,8 +391,8 @@ describe('JSTimers', function() { ); }); - it('should pass along errors thrown from setInterval', function() { - const timerID = JSTimers.setInterval(function() { + it('should pass along errors thrown from setInterval', function () { + const timerID = JSTimers.setInterval(function () { throw new Error('error within setInterval'); }); expect(JSTimers.callTimers.bind(null, [timerID])).toThrowError( @@ -400,7 +400,7 @@ describe('JSTimers', function() { ); }); - it('should not call to native when clearing a null timer', function() { + it('should not call to native when clearing a null timer', function () { const timerID = JSTimers.setTimeout(() => {}); JSTimers.clearTimeout(timerID); NativeTiming.deleteTimer = jest.fn(); diff --git a/Libraries/Core/Timers/immediateShim.js b/Libraries/Core/Timers/immediateShim.js index 6eef9f58f1d8..43915d6df16b 100644 --- a/Libraries/Core/Timers/immediateShim.js +++ b/Libraries/Core/Timers/immediateShim.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/Timers/queueMicrotask.js b/Libraries/Core/Timers/queueMicrotask.js index a131696dcf64..7c33d9f30036 100644 --- a/Libraries/Core/Timers/queueMicrotask.js +++ b/Libraries/Core/Timers/queueMicrotask.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/__mocks__/ErrorUtils.js b/Libraries/Core/__mocks__/ErrorUtils.js index 8505e23dc562..6fd3ce67b408 100644 --- a/Libraries/Core/__mocks__/ErrorUtils.js +++ b/Libraries/Core/__mocks__/ErrorUtils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/__tests__/ExceptionsManager-test.js b/Libraries/Core/__tests__/ExceptionsManager-test.js index d85927d12314..11047221e4bd 100644 --- a/Libraries/Core/__tests__/ExceptionsManager-test.js +++ b/Libraries/Core/__tests__/ExceptionsManager-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js b/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js index dbb5920a7a28..fde28ee223cb 100644 --- a/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js +++ b/Libraries/Core/__tests__/ReactNativeVersionCheck-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/checkNativeVersion.js b/Libraries/Core/checkNativeVersion.js index b70a69bcba83..789dd15015e9 100644 --- a/Libraries/Core/checkNativeVersion.js +++ b/Libraries/Core/checkNativeVersion.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/polyfillPromise.js b/Libraries/Core/polyfillPromise.js index f83fea90248b..857ea8bdb50c 100644 --- a/Libraries/Core/polyfillPromise.js +++ b/Libraries/Core/polyfillPromise.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/setUpAlert.js b/Libraries/Core/setUpAlert.js index f4615ba8c2a5..85bf358c5bc4 100644 --- a/Libraries/Core/setUpAlert.js +++ b/Libraries/Core/setUpAlert.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,7 +15,7 @@ * You can use this module directly, or just require InitializeCore. */ if (!global.alert) { - global.alert = function(text) { + global.alert = function (text) { // Require Alert on demand. Requiring it too early can lead to issues // with things like Platform not being fully initialized. require('../Alert/Alert').alert('Alert', '' + text); diff --git a/Libraries/Core/setUpBatchedBridge.js b/Libraries/Core/setUpBatchedBridge.js index 0f16dd84e74c..5eae68751c24 100644 --- a/Libraries/Core/setUpBatchedBridge.js +++ b/Libraries/Core/setUpBatchedBridge.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,8 +15,20 @@ if (global.RN$Bridgeless === true && global.RN$registerCallableModule) { registerModule = global.RN$registerCallableModule; } else { const BatchedBridge = require('../BatchedBridge/BatchedBridge'); - registerModule = (moduleName, factory) => - BatchedBridge.registerLazyCallableModule(moduleName, factory); + registerModule = ( + moduleName: + | $TEMPORARY$string<'GlobalPerformanceLogger'> + | $TEMPORARY$string<'HMRClient'> + | $TEMPORARY$string<'HeapCapture'> + | $TEMPORARY$string<'JSDevSupportModule'> + | $TEMPORARY$string<'JSTimers'> + | $TEMPORARY$string<'RCTDeviceEventEmitter'> + | $TEMPORARY$string<'RCTLog'> + | $TEMPORARY$string<'RCTNativeAppEventEmitter'> + | $TEMPORARY$string<'SamplingProfiler'> + | $TEMPORARY$string<'Systrace'>, + factory, + ) => BatchedBridge.registerLazyCallableModule(moduleName, factory); } registerModule('Systrace', () => require('../Performance/Systrace')); diff --git a/Libraries/Core/setUpDeveloperTools.js b/Libraries/Core/setUpDeveloperTools.js index 86f2732643ac..9d1a342ada66 100644 --- a/Libraries/Core/setUpDeveloperTools.js +++ b/Libraries/Core/setUpDeveloperTools.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -58,7 +58,7 @@ if (__DEV__) { 'debug', ].forEach(level => { const originalFunction = console[level]; - console[level] = function(...args) { + console[level] = function (...args) { HMRClient.log(level, args); originalFunction.apply(console, args); }; diff --git a/Libraries/Core/setUpErrorHandling.js b/Libraries/Core/setUpErrorHandling.js index 3ac9be0f878e..32846d42f835 100644 --- a/Libraries/Core/setUpErrorHandling.js +++ b/Libraries/Core/setUpErrorHandling.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,7 @@ ExceptionsManager.installConsoleErrorReporter(); // Set up error handler if (!global.__fbDisableExceptionsManager) { - const handleError = (e, isFatal) => { + const handleError = (e: mixed, isFatal: boolean) => { try { ExceptionsManager.handleException(e, isFatal); } catch (ee) { diff --git a/Libraries/Core/setUpGlobals.js b/Libraries/Core/setUpGlobals.js index a571ba52b120..4d740807dd15 100644 --- a/Libraries/Core/setUpGlobals.js +++ b/Libraries/Core/setUpGlobals.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/setUpNavigator.js b/Libraries/Core/setUpNavigator.js index 48cdd45cb1d9..1dbe429aaea2 100644 --- a/Libraries/Core/setUpNavigator.js +++ b/Libraries/Core/setUpNavigator.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/setUpPerformance.js b/Libraries/Core/setUpPerformance.js index 12cace05f812..1d56fff3cc51 100644 --- a/Libraries/Core/setUpPerformance.js +++ b/Libraries/Core/setUpPerformance.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,7 @@ if (!global.performance) { * https://developer.mozilla.org/en-US/docs/Web/API/Performance/now */ if (typeof global.performance.now !== 'function') { - global.performance.now = function() { + global.performance.now = function () { const performanceNow = global.nativePerformanceNow || Date.now; return performanceNow(); }; diff --git a/Libraries/Core/setUpReactDevTools.js b/Libraries/Core/setUpReactDevTools.js index 099f12242bc5..7665ad400207 100644 --- a/Libraries/Core/setUpReactDevTools.js +++ b/Libraries/Core/setUpReactDevTools.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/setUpReactRefresh.js b/Libraries/Core/setUpReactRefresh.js index ccc67ca22398..80ecfa16e043 100644 --- a/Libraries/Core/setUpReactRefresh.js +++ b/Libraries/Core/setUpReactRefresh.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/setUpRegeneratorRuntime.js b/Libraries/Core/setUpRegeneratorRuntime.js index 426e9b3b1604..d5a7dda07b5b 100644 --- a/Libraries/Core/setUpRegeneratorRuntime.js +++ b/Libraries/Core/setUpRegeneratorRuntime.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,7 +22,7 @@ let hasNativeGenerator; try { // If this function was lowered by regenerator-transform, it will try to // access `global.regeneratorRuntime` which doesn't exist yet and will throw. - hasNativeGenerator = hasNativeConstructor(function*() {}, + hasNativeGenerator = hasNativeConstructor(function* () {}, 'GeneratorFunction'); } catch { // In this case, we know generators are not provided natively. diff --git a/Libraries/Core/setUpSegmentFetcher.js b/Libraries/Core/setUpSegmentFetcher.js index d48810ae22ca..05ec6c1f4e8f 100644 --- a/Libraries/Core/setUpSegmentFetcher.js +++ b/Libraries/Core/setUpSegmentFetcher.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,8 +27,8 @@ function __fetchSegment( }>, callback: (?Error) => void, ) { - const SegmentFetcher = require('./SegmentFetcher/NativeSegmentFetcher') - .default; + const SegmentFetcher = + require('./SegmentFetcher/NativeSegmentFetcher').default; SegmentFetcher.fetchSegment( segmentId, options, @@ -61,8 +61,8 @@ function __getSegment( }>, callback: (?Error, ?string) => void, ) { - const SegmentFetcher = require('./SegmentFetcher/NativeSegmentFetcher') - .default; + const SegmentFetcher = + require('./SegmentFetcher/NativeSegmentFetcher').default; if (!SegmentFetcher.getSegment) { throw new Error('SegmentFetcher.getSegment must be defined'); diff --git a/Libraries/Core/setUpSystrace.js b/Libraries/Core/setUpSystrace.js index 610324b440ea..17a2d7bb2eb8 100644 --- a/Libraries/Core/setUpSystrace.js +++ b/Libraries/Core/setUpSystrace.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Core/setUpTimers.js b/Libraries/Core/setUpTimers.js index 7048b32c4fdf..901de90f750e 100644 --- a/Libraries/Core/setUpTimers.js +++ b/Libraries/Core/setUpTimers.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,7 +33,17 @@ if (global.RN$Bridgeless !== true) { * Set up timers. * You can use this module directly, or just require InitializeCore. */ - const defineLazyTimer = name => { + const defineLazyTimer = ( + name: + | $TEMPORARY$string<'cancelAnimationFrame'> + | $TEMPORARY$string<'cancelIdleCallback'> + | $TEMPORARY$string<'clearInterval'> + | $TEMPORARY$string<'clearTimeout'> + | $TEMPORARY$string<'requestAnimationFrame'> + | $TEMPORARY$string<'requestIdleCallback'> + | $TEMPORARY$string<'setInterval'> + | $TEMPORARY$string<'setTimeout'>, + ) => { polyfillGlobal(name, () => require('./Timers/JSTimers')[name]); }; defineLazyTimer('setTimeout'); diff --git a/Libraries/Core/setUpXHR.js b/Libraries/Core/setUpXHR.js index 413fcd7e1f53..a31f22dcb84e 100644 --- a/Libraries/Core/setUpXHR.js +++ b/Libraries/Core/setUpXHR.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js deleted file mode 100644 index caa6858a2001..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedColorPropType.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const normalizeColor = require('../StyleSheet/normalizeColor'); - -const colorPropType = function( - isRequired, - props, - propName, - componentName, - location, - propFullName, -) { - const color = props[propName]; - if (color === undefined || color === null) { - if (isRequired) { - return new Error( - 'Required ' + - location + - ' `' + - (propFullName || propName) + - '` was not specified in `' + - componentName + - '`.', - ); - } - return; - } - - if (typeof color === 'number') { - // Developers should not use a number, but we are using the prop type - // both for user provided colors and for transformed ones. This isn't ideal - // and should be fixed but will do for now... - return; - } - - if (normalizeColor(color) === null) { - return new Error( - 'Invalid ' + - location + - ' `' + - (propFullName || propName) + - '` supplied to `' + - componentName + - '`: ' + - color + - '\n' + - `Valid color formats are - - '#f0f' (#rgb) - - '#f0fc' (#rgba) - - '#ff00ff' (#rrggbb) - - '#ff00ff00' (#rrggbbaa) - - 'rgb(255, 255, 255)' - - 'rgba(255, 255, 255, 1.0)' - - 'hsl(360, 100%, 100%)' - - 'hsla(360, 100%, 100%, 1.0)' - - 'transparent' - - 'red' - - 0xff00ff00 (0xrrggbbaa) -`, - ); - } -}; - -const ColorPropType = colorPropType.bind(null, false /* isRequired */); -ColorPropType.isRequired = colorPropType.bind(null, true /* isRequired */); - -module.exports = ColorPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js deleted file mode 100644 index 6cf238d42e0d..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType.js +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const DeprecatedEdgeInsetsPropType: React$PropType$Primitive<{ - bottom?: number, - left?: number, - right?: number, - top?: number, - ... -}> = PropTypes.shape({ - top: PropTypes.number, - left: PropTypes.number, - bottom: PropTypes.number, - right: PropTypes.number, -}); - -module.exports = DeprecatedEdgeInsetsPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js deleted file mode 100644 index 7df9fbf644cd..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.android.js +++ /dev/null @@ -1,131 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedImageStylePropTypes = require('./DeprecatedImageStylePropTypes'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes'); -const PropTypes = require('prop-types'); - -const DeprecatedImagePropType = { - ...DeprecatedViewPropTypes, - style: (DeprecatedStyleSheetPropType( - DeprecatedImageStylePropTypes, - ): ReactPropsCheckType), - /** - * See https://reactnative.dev/docs/image.html#source - */ - source: (PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - headers: PropTypes.objectOf(PropTypes.string), - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - // Multiple sources - PropTypes.arrayOf( - PropTypes.shape({ - uri: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number, - headers: PropTypes.objectOf(PropTypes.string), - }), - ), - ]): React$PropType$Primitive< - | { - headers?: {[string]: string, ...}, - uri?: string, - ... - } - | number - | Array<{ - headers?: {[string]: string, ...}, - height?: number, - uri?: string, - width?: number, - ... - }>, - >), - /** - * blurRadius: the blur radius of the blur filter added to the image - * - * See https://reactnative.dev/docs/image.html#blurradius - */ - blurRadius: PropTypes.number, - /** - * See https://reactnative.dev/docs/image.html#defaultsource - */ - defaultSource: PropTypes.number, - /** - * See https://reactnative.dev/docs/image.html#loadingindicatorsource - */ - loadingIndicatorSource: (PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - }), - // Opaque type returned by require('./image.jpg') - PropTypes.number, - ]): React$PropType$Primitive<{uri?: string, ...} | number>), - progressiveRenderingEnabled: PropTypes.bool, - fadeDuration: PropTypes.number, - /** - * Analytics Tag used by this Image - */ - internal_analyticTag: PropTypes.string, - /** - * Invoked on load start - */ - onLoadStart: PropTypes.func, - /** - * Invoked on load error - */ - onError: PropTypes.func, - /** - * Invoked when load completes successfully - */ - onLoad: PropTypes.func, - /** - * Invoked when load either succeeds or fails - */ - onLoadEnd: PropTypes.func, - /** - * Used to locate this view in end-to-end tests. - */ - testID: PropTypes.string, - /** - * The mechanism that should be used to resize the image when the image's dimensions - * differ from the image view's dimensions. Defaults to `auto`. - * - * See https://reactnative.dev/docs/image.html#resizemethod - */ - resizeMethod: (PropTypes.oneOf([ - 'auto', - 'resize', - 'scale', - ]): React$PropType$Primitive<'auto' | 'resize' | 'scale'>), - /** - * Determines how to resize the image when the frame doesn't match the raw - * image dimensions. - * - * See https://reactnative.dev/docs/image.html#resizemode - */ - resizeMode: (PropTypes.oneOf([ - 'cover', - 'contain', - 'stretch', - 'repeat', - 'center', - ]): React$PropType$Primitive< - 'cover' | 'contain' | 'stretch' | 'repeat' | 'center', - >), -}; - -module.exports = DeprecatedImagePropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js b/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js deleted file mode 100644 index e01cc42fb269..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImagePropType.ios.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const DeprecatedImageSourcePropType = require('./DeprecatedImageSourcePropType'); -const DeprecatedImageStylePropTypes = require('./DeprecatedImageStylePropTypes'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const PropTypes = require('prop-types'); - -module.exports = { - style: (DeprecatedStyleSheetPropType( - DeprecatedImageStylePropTypes, - ): ReactPropsCheckType), - source: DeprecatedImageSourcePropType, - defaultSource: (PropTypes.oneOfType([ - PropTypes.shape({ - uri: PropTypes.string, - width: PropTypes.number, - height: PropTypes.number, - scale: PropTypes.number, - }), - PropTypes.number, - ]): React$PropType$Primitive< - | { - height?: number, - scale?: number, - uri?: string, - width?: number, - ... - } - | number, - >), - - accessible: PropTypes.bool, - - accessibilityLabel: PropTypes.node, - - blurRadius: PropTypes.number, - - capInsets: DeprecatedEdgeInsetsPropType, - - resizeMethod: (PropTypes.oneOf([ - 'auto', - 'resize', - 'scale', - ]): React$PropType$Primitive<'auto' | 'resize' | 'scale'>), - - resizeMode: (PropTypes.oneOf([ - 'cover', - 'contain', - 'stretch', - 'repeat', - 'center', - ]): React$PropType$Primitive< - 'cover' | 'contain' | 'stretch' | 'repeat' | 'center', - >), - - testID: PropTypes.string, - - onLayout: PropTypes.func, - - onLoadStart: PropTypes.func, - - onProgress: PropTypes.func, - - onError: PropTypes.func, - - onPartialLoad: PropTypes.func, - - onLoad: PropTypes.func, - - onLoadEnd: PropTypes.func, -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js b/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js deleted file mode 100644 index ea00c1b45c67..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImageSourcePropType.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @no-flow - * @format - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const ImageURISourcePropType = PropTypes.shape({ - uri: PropTypes.string, - bundle: PropTypes.string, - method: PropTypes.string, - headers: PropTypes.objectOf(PropTypes.string), - body: PropTypes.string, - cache: PropTypes.oneOf([ - 'default', - 'reload', - 'force-cache', - 'only-if-cached', - ]), - width: PropTypes.number, - height: PropTypes.number, - scale: PropTypes.number, -}); - -const ImageSourcePropType = PropTypes.oneOfType([ - ImageURISourcePropType, - // Opaque type returned by require('./image.jpg') - PropTypes.number, - // Multiple sources - PropTypes.arrayOf(ImageURISourcePropType), -]); - -module.exports = ImageSourcePropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js deleted file mode 100644 index ea6224c81b90..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedImageStylePropTypes.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedLayoutPropTypes = require('./DeprecatedLayoutPropTypes'); -const DeprecatedShadowPropTypesIOS = require('./DeprecatedShadowPropTypesIOS'); -const DeprecatedTransformPropTypes = require('./DeprecatedTransformPropTypes'); -const ReactPropTypes = require('prop-types'); - -const ImageStylePropTypes = { - ...DeprecatedLayoutPropTypes, - ...DeprecatedShadowPropTypesIOS, - ...DeprecatedTransformPropTypes, - resizeMode: (ReactPropTypes.oneOf([ - 'center', - 'contain', - 'cover', - 'repeat', - 'stretch', - ]): React$PropType$Primitive< - 'center' | 'contain' | 'cover' | 'repeat' | 'stretch', - >), - backfaceVisibility: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - ]): React$PropType$Primitive<'visible' | 'hidden'>), - backgroundColor: DeprecatedColorPropType, - borderColor: DeprecatedColorPropType, - borderWidth: ReactPropTypes.number, - borderRadius: ReactPropTypes.number, - overflow: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - ]): React$PropType$Primitive<'visible' | 'hidden'>), - - /** - * Changes the color of all the non-transparent pixels to the tintColor. - */ - tintColor: DeprecatedColorPropType, - opacity: ReactPropTypes.number, - /** - * When the image has rounded corners, specifying an overlayColor will - * cause the remaining space in the corners to be filled with a solid color. - * This is useful in cases which are not supported by the Android - * implementation of rounded corners: - * - Certain resize modes, such as 'contain' - * - Animated GIFs - * - * A typical way to use this prop is with images displayed on a solid - * background and setting the `overlayColor` to the same color - * as the background. - * - * For details of how this works under the hood, see - * http://frescolib.org/docs/rounded-corners-and-circles.html - * - * @platform android - */ - overlayColor: ReactPropTypes.string, - - // Android-Specific styles - borderTopLeftRadius: ReactPropTypes.number, - borderTopRightRadius: ReactPropTypes.number, - borderBottomLeftRadius: ReactPropTypes.number, - borderBottomRightRadius: ReactPropTypes.number, -}; - -module.exports = ImageStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js deleted file mode 100644 index 4d4488a9171f..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedLayoutPropTypes.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const ReactPropTypes = require('prop-types'); - -const LayoutPropTypes = { - display: (ReactPropTypes.oneOf(['none', 'flex']): React$PropType$Primitive< - 'none' | 'flex', - >), - width: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - height: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - start: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - end: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - top: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - left: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - right: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - bottom: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - minWidth: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - maxWidth: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - minHeight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - maxHeight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - margin: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginVertical: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginHorizontal: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginTop: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginBottom: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginLeft: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginRight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginStart: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - marginEnd: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - padding: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingVertical: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingHorizontal: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingTop: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingBottom: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingLeft: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingRight: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingStart: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - paddingEnd: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - borderWidth: ReactPropTypes.number, - borderTopWidth: ReactPropTypes.number, - borderStartWidth: ReactPropTypes.number, - borderEndWidth: ReactPropTypes.number, - borderRightWidth: ReactPropTypes.number, - borderBottomWidth: ReactPropTypes.number, - borderLeftWidth: ReactPropTypes.number, - position: (ReactPropTypes.oneOf([ - 'absolute', - 'relative', - ]): React$PropType$Primitive<'absolute' | 'relative'>), - flexDirection: (ReactPropTypes.oneOf([ - 'row', - 'row-reverse', - 'column', - 'column-reverse', - ]): React$PropType$Primitive< - 'row' | 'row-reverse' | 'column' | 'column-reverse', - >), - flexWrap: (ReactPropTypes.oneOf([ - 'wrap', - 'nowrap', - 'wrap-reverse', - ]): React$PropType$Primitive<'wrap' | 'nowrap' | 'wrap-reverse'>), - justifyContent: (ReactPropTypes.oneOf([ - 'flex-start', - 'flex-end', - 'center', - 'space-between', - 'space-around', - 'space-evenly', - ]): React$PropType$Primitive< - | 'flex-start' - | 'flex-end' - | 'center' - | 'space-between' - | 'space-around' - | 'space-evenly', - >), - alignItems: (ReactPropTypes.oneOf([ - 'flex-start', - 'flex-end', - 'center', - 'stretch', - 'baseline', - ]): React$PropType$Primitive< - 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', - >), - alignSelf: (ReactPropTypes.oneOf([ - 'auto', - 'flex-start', - 'flex-end', - 'center', - 'stretch', - 'baseline', - ]): React$PropType$Primitive< - 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline', - >), - alignContent: (ReactPropTypes.oneOf([ - 'flex-start', - 'flex-end', - 'center', - 'stretch', - 'space-between', - 'space-around', - ]): React$PropType$Primitive< - | 'flex-start' - | 'flex-end' - | 'center' - | 'stretch' - | 'space-between' - | 'space-around', - >), - overflow: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - 'scroll', - ]): React$PropType$Primitive<'visible' | 'hidden' | 'scroll'>), - flex: ReactPropTypes.number, - flexGrow: ReactPropTypes.number, - flexShrink: ReactPropTypes.number, - flexBasis: (ReactPropTypes.oneOfType([ - ReactPropTypes.number, - ReactPropTypes.string, - ]): React$PropType$Primitive), - aspectRatio: ReactPropTypes.number, - zIndex: ReactPropTypes.number, - direction: (ReactPropTypes.oneOf([ - 'inherit', - 'ltr', - 'rtl', - ]): React$PropType$Primitive<'inherit' | 'ltr' | 'rtl'>), -}; - -module.exports = LayoutPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js deleted file mode 100644 index ef60608bd0e2..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedPointPropType.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -const PropTypes = require('prop-types'); - -const PointPropType: React$PropType$Primitive<{ - x?: number, - y?: number, - ... -}> = PropTypes.shape({ - x: PropTypes.number, - y: PropTypes.number, -}); - -module.exports = PointPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js b/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js deleted file mode 100644 index d8e468359e2d..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedShadowPropTypesIOS.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const ReactPropTypes = require('prop-types'); - -const DeprecatedShadowPropTypesIOS = { - shadowColor: DeprecatedColorPropType, - shadowOffset: (ReactPropTypes.shape({ - width: ReactPropTypes.number, - height: ReactPropTypes.number, - }): React$PropType$Primitive<{ - height?: number, - width?: number, - ... - }>), - shadowOpacity: ReactPropTypes.number, - shadowRadius: ReactPropTypes.number, -}; - -module.exports = DeprecatedShadowPropTypesIOS; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js b/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js deleted file mode 100644 index f692187a6789..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedStyleSheetPropType.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const deprecatedCreateStrictShapeTypeChecker = require('./deprecatedCreateStrictShapeTypeChecker'); -const flattenStyle = require('../StyleSheet/flattenStyle'); - -function DeprecatedStyleSheetPropType(shape: { - [key: string]: ReactPropsCheckType, - ..., -}): ReactPropsCheckType { - const shapePropType = deprecatedCreateStrictShapeTypeChecker(shape); - return function(props, propName, componentName, location?, ...rest) { - let newProps = props; - if (props[propName]) { - // Just make a dummy prop object with only the flattened style - newProps = {}; - newProps[propName] = flattenStyle(props[propName]); - } - return shapePropType(newProps, propName, componentName, location, ...rest); - }; -} - -module.exports = DeprecatedStyleSheetPropType; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js deleted file mode 100644 index 937e1c7a73e7..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextInputPropTypes.js +++ /dev/null @@ -1,622 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedTextPropTypes = require('./DeprecatedTextPropTypes'); -const DeprecatedViewPropTypes = require('./DeprecatedViewPropTypes'); -const PropTypes = require('prop-types'); - -const DataDetectorTypes = [ - 'phoneNumber', - 'link', - 'address', - 'calendarEvent', - 'none', - 'all', -]; - -module.exports = { - ...DeprecatedViewPropTypes, - /** - * Can tell `TextInput` to automatically capitalize certain characters. - * - * - `characters`: all characters. - * - `words`: first letter of each word. - * - `sentences`: first letter of each sentence (*default*). - * - `none`: don't auto capitalize anything. - */ - autoCapitalize: (PropTypes.oneOf([ - 'none', - 'sentences', - 'words', - 'characters', - ]): React$PropType$Primitive<'none' | 'sentences' | 'words' | 'characters'>), - /** - * Determines which content to suggest on auto complete, e.g.`username`. - * To disable auto complete, use `off`. - * - * *Android Only* - * - * The following values work on Android only: - * - * - `username` - * - `password` - * - `email` - * - `name` - * - `tel` - * - `street-address` - * - `postal-code` - * - `cc-number` - * - `cc-csc` - * - `cc-exp` - * - `cc-exp-month` - * - `cc-exp-year` - * - `off` - * - * @platform android - */ - autoComplete: (PropTypes.oneOf([ - 'cc-csc', - 'cc-exp', - 'cc-exp-month', - 'cc-exp-year', - 'cc-number', - 'email', - 'name', - 'password', - 'postal-code', - 'street-address', - 'tel', - 'username', - 'off', - ]): React$PropType$Primitive< - | 'cc-csc' - | 'cc-exp' - | 'cc-exp-month' - | 'cc-exp-year' - | 'cc-number' - | 'email' - | 'name' - | 'password' - | 'postal-code' - | 'street-address' - | 'tel' - | 'username' - | 'off', - >), - /** - * If `false`, disables auto-correct. The default value is `true`. - */ - autoCorrect: PropTypes.bool, - /** - * If `false`, disables spell-check style (i.e. red underlines). - * The default value is inherited from `autoCorrect`. - * @platform ios - */ - spellCheck: PropTypes.bool, - /** - * If `true`, focuses the input on `componentDidMount`. - * The default value is `false`. - */ - autoFocus: PropTypes.bool, - /** - * Specifies whether fonts should scale to respect Text Size accessibility settings. The - * default is `true`. - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * If `false`, text is not editable. The default value is `true`. - */ - editable: PropTypes.bool, - /** - * Determines which keyboard to open, e.g.`numeric`. - * - * The following values work across platforms: - * - * - `default` - * - `numeric` - * - `number-pad` - * - `decimal-pad` - * - `email-address` - * - `phone-pad` - * - `url` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `ascii-capable` - * - `numbers-and-punctuation` - * - `name-phone-pad` - * - `twitter` - * - `web-search` - * - `ascii-capable-number-pad` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `visible-password` - */ - keyboardType: (PropTypes.oneOf([ - // Cross-platform - 'default', - 'email-address', - 'numeric', - 'phone-pad', - 'number-pad', - 'url', - // iOS-only - 'ascii-capable', - 'numbers-and-punctuation', - 'name-phone-pad', - 'decimal-pad', - 'twitter', - 'web-search', - // iOS 10+ only - 'ascii-capable-number-pad', - // Android-only - 'visible-password', - ]): React$PropType$Primitive< - | 'default' - | 'email-address' - | 'numeric' - | 'phone-pad' - | 'number-pad' - | 'ascii-capable' - | 'numbers-and-punctuation' - | 'url' - | 'name-phone-pad' - | 'decimal-pad' - | 'twitter' - | 'web-search' - | 'ascii-capable-number-pad' - | 'visible-password', - >), - /** - * Determines the color of the keyboard. - * @platform ios - */ - keyboardAppearance: (PropTypes.oneOf([ - 'default', - 'light', - 'dark', - ]): React$PropType$Primitive<'default' | 'light' | 'dark'>), - /** - * Determines how the return key should look. On Android you can also use - * `returnKeyLabel`. - * - * *Cross platform* - * - * The following values work across platforms: - * - * - `done` - * - `go` - * - `next` - * - `search` - * - `send` - * - * *Android Only* - * - * The following values work on Android only: - * - * - `none` - * - `previous` - * - * *iOS Only* - * - * The following values work on iOS only: - * - * - `default` - * - `emergency-call` - * - `google` - * - `join` - * - `route` - * - `yahoo` - */ - returnKeyType: (PropTypes.oneOf([ - // Cross-platform - 'done', - 'go', - 'next', - 'search', - 'send', - // Android-only - 'none', - 'previous', - // iOS-only - 'default', - 'emergency-call', - 'google', - 'join', - 'route', - 'yahoo', - ]): React$PropType$Primitive< - | 'done' - | 'go' - | 'next' - | 'search' - | 'send' - | 'none' - | 'previous' - | 'default' - | 'emergency-call' - | 'google' - | 'join' - | 'route' - | 'yahoo', - >), - /** - * Sets the return key to the label. Use it instead of `returnKeyType`. - * @platform android - */ - returnKeyLabel: PropTypes.string, - /** - * Limits the maximum number of characters that can be entered. Use this - * instead of implementing the logic in JS to avoid flicker. - */ - maxLength: PropTypes.number, - /** - * Sets the number of lines for a `TextInput`. Use it with multiline set to - * `true` to be able to fill the lines. - * @platform android - */ - numberOfLines: PropTypes.number, - /** - * When `false`, if there is a small amount of space available around a text input - * (e.g. landscape orientation on a phone), the OS may choose to have the user edit - * the text inside of a full screen text input mode. When `true`, this feature is - * disabled and users will always edit the text directly inside of the text input. - * Defaults to `false`. - * @platform android - */ - disableFullscreenUI: PropTypes.bool, - /** - * If `true`, the keyboard disables the return key when there is no text and - * automatically enables it when there is text. The default value is `false`. - * @platform ios - */ - enablesReturnKeyAutomatically: PropTypes.bool, - /** - * If `true`, the text input can be multiple lines. - * The default value is `false`. - */ - multiline: PropTypes.bool, - /** - * Set text break strategy on Android API Level 23+, possible values are `simple`, `highQuality`, `balanced` - * The default value is `simple`. - * @platform android - */ - textBreakStrategy: (PropTypes.oneOf([ - 'simple', - 'highQuality', - 'balanced', - ]): React$PropType$Primitive<'simple' | 'highQuality' | 'balanced'>), - /** - * Callback that is called when the text input is blurred. - */ - onBlur: PropTypes.func, - /** - * Callback that is called when the text input is focused. - */ - onFocus: PropTypes.func, - /** - * Callback that is called when the text input's text changes. - */ - onChange: PropTypes.func, - /** - * Callback that is called when the text input's text changes. - * Changed text is passed as an argument to the callback handler. - */ - onChangeText: PropTypes.func, - /** - * Callback that is called when the text input's content size changes. - * This will be called with - * `{ nativeEvent: { contentSize: { width, height } } }`. - * - * Only called for multiline text inputs. - */ - onContentSizeChange: PropTypes.func, - onTextInput: PropTypes.func, - /** - * Callback that is called when text input ends. - */ - onEndEditing: PropTypes.func, - /** - * Callback that is called when the text input selection is changed. - * This will be called with - * `{ nativeEvent: { selection: { start, end } } }`. - */ - onSelectionChange: PropTypes.func, - /** - * Callback that is called when the text input's submit button is pressed. - * Invalid if `multiline={true}` is specified. - */ - onSubmitEditing: PropTypes.func, - /** - * Callback that is called when a key is pressed. - * This will be called with `{ nativeEvent: { key: keyValue } }` - * where `keyValue` is `'Enter'` or `'Backspace'` for respective keys and - * the typed-in character otherwise including `' '` for space. - * Fires before `onChange` callbacks. - */ - onKeyPress: PropTypes.func, - /** - * Invoked on mount and layout changes with `{x, y, width, height}`. - */ - onLayout: PropTypes.func, - /** - * Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`. - * May also contain other properties from ScrollEvent but on Android contentSize - * is not provided for performance reasons. - */ - onScroll: PropTypes.func, - /** - * The string that will be rendered before text input has been entered. - */ - placeholder: PropTypes.string, - /** - * The text color of the placeholder string. - */ - placeholderTextColor: DeprecatedColorPropType, - /** - * If `false`, scrolling of the text view will be disabled. - * The default value is `true`. Does only work with 'multiline={true}'. - * @platform ios - */ - scrollEnabled: PropTypes.bool, - /** - * If `true`, the text input obscures the text entered so that sensitive text - * like passwords stay secure. The default value is `false`. Does not work with 'multiline={true}'. - */ - secureTextEntry: PropTypes.bool, - /** - * The highlight and cursor color of the text input. - */ - selectionColor: DeprecatedColorPropType, - /** - * The start and end of the text input's selection. Set start and end to - * the same value to position the cursor. - */ - selection: (PropTypes.shape({ - start: PropTypes.number.isRequired, - end: PropTypes.number, - }): React$PropType$Primitive<{ - end?: number, - start: number, - ... - }>), - /** - * The value to show for the text input. `TextInput` is a controlled - * component, which means the native value will be forced to match this - * value prop if provided. For most uses, this works great, but in some - * cases this may cause flickering - one common cause is preventing edits - * by keeping value the same. In addition to simply setting the same value, - * either set `editable={false}`, or set/update `maxLength` to prevent - * unwanted edits without flicker. - */ - value: PropTypes.string, - /** - * Provides an initial value that will change when the user starts typing. - * Useful for simple use-cases where you do not want to deal with listening - * to events and updating the value prop to keep the controlled state in sync. - */ - defaultValue: PropTypes.string, - /** - * When the clear button should appear on the right side of the text view. - * This property is supported only for single-line TextInput component. - * @platform ios - */ - clearButtonMode: (PropTypes.oneOf([ - 'never', - 'while-editing', - 'unless-editing', - 'always', - ]): React$PropType$Primitive< - 'never' | 'while-editing' | 'unless-editing' | 'always', - >), - /** - * If `true`, clears the text field automatically when editing begins. - * @platform ios - */ - clearTextOnFocus: PropTypes.bool, - /** - * If `true`, all text will automatically be selected on focus. - */ - selectTextOnFocus: PropTypes.bool, - /** - * If `true`, the text field will blur when submitted. - * The default value is true for single-line fields and false for - * multiline fields. Note that for multiline fields, setting `blurOnSubmit` - * to `true` means that pressing return will blur the field and trigger the - * `onSubmitEditing` event instead of inserting a newline into the field. - */ - blurOnSubmit: PropTypes.bool, - /** - * Note that not all Text styles are supported, an incomplete list of what is not supported includes: - * - * - `borderLeftWidth` - * - `borderTopWidth` - * - `borderRightWidth` - * - `borderBottomWidth` - * - `borderTopLeftRadius` - * - `borderTopRightRadius` - * - `borderBottomRightRadius` - * - `borderBottomLeftRadius` - * - * see [Issue#7070](https://github.com/facebook/react-native/issues/7070) - * for more detail. - * - * [Styles](docs/style.html) - */ - // $FlowFixMe[incompatible-use] - style: DeprecatedTextPropTypes.style, - /** - * The color of the `TextInput` underline. - * @platform android - */ - underlineColorAndroid: DeprecatedColorPropType, - - /** - * If defined, the provided image resource will be rendered on the left. - * The image resource must be inside `/android/app/src/main/res/drawable` and referenced - * like - * ``` - * - * ``` - * @platform android - */ - inlineImageLeft: PropTypes.string, - - /** - * Padding between the inline image, if any, and the text input itself. - * @platform android - */ - inlineImagePadding: PropTypes.number, - - /** - * If `true`, allows TextInput to pass touch events to the parent component. - * This allows components such as SwipeableListView to be swipeable from the TextInput on iOS, - * as is the case on Android by default. - * If `false`, TextInput always asks to handle the input (except when disabled). - * @platform ios - */ - rejectResponderTermination: PropTypes.bool, - - /** - * Determines the types of data converted to clickable URLs in the text input. - * Only valid if `multiline={true}` and `editable={false}`. - * By default no data types are detected. - * - * You can provide one type or an array of many types. - * - * Possible values for `dataDetectorTypes` are: - * - * - `'phoneNumber'` - * - `'link'` - * - `'address'` - * - `'calendarEvent'` - * - `'none'` - * - `'all'` - * - * @platform ios - */ - dataDetectorTypes: (PropTypes.oneOfType([ - PropTypes.oneOf(DataDetectorTypes), - PropTypes.arrayOf(PropTypes.oneOf(DataDetectorTypes)), - ]): React$PropType$Primitive< - | 'phoneNumber' - | 'link' - | 'address' - | 'calendarEvent' - | 'none' - | 'all' - | Array< - 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'none' | 'all', - >, - >), - /** - * If `true`, caret is hidden. The default value is `false`. - * This property is supported only for single-line TextInput component on iOS. - */ - caretHidden: PropTypes.bool, - /* - * If `true`, contextMenuHidden is hidden. The default value is `false`. - */ - contextMenuHidden: PropTypes.bool, - /** - * An optional identifier which links a custom InputAccessoryView to - * this text input. The InputAccessoryView is rendered above the - * keyboard when this text input is focused. - * @platform ios - */ - inputAccessoryViewID: PropTypes.string, - /** - * Give the keyboard and the system information about the - * expected semantic meaning for the content that users enter. - * @platform ios - */ - textContentType: (PropTypes.oneOf([ - 'none', - 'URL', - 'addressCity', - 'addressCityAndState', - 'addressState', - 'countryName', - 'creditCardNumber', - 'emailAddress', - 'familyName', - 'fullStreetAddress', - 'givenName', - 'jobTitle', - 'location', - 'middleName', - 'name', - 'namePrefix', - 'nameSuffix', - 'nickname', - 'organizationName', - 'postalCode', - 'streetAddressLine1', - 'streetAddressLine2', - 'sublocality', - 'telephoneNumber', - 'username', - 'password', - 'newPassword', - 'oneTimeCode', - ]): React$PropType$Primitive< - | 'none' - | 'URL' - | 'addressCity' - | 'addressCityAndState' - | 'addressState' - | 'countryName' - | 'creditCardNumber' - | 'emailAddress' - | 'familyName' - | 'fullStreetAddress' - | 'givenName' - | 'jobTitle' - | 'location' - | 'middleName' - | 'name' - | 'namePrefix' - | 'nameSuffix' - | 'nickname' - | 'organizationName' - | 'postalCode' - | 'streetAddressLine1' - | 'streetAddressLine2' - | 'sublocality' - | 'telephoneNumber' - | 'username' - | 'password' - | 'newPassword' - | 'oneTimeCode', - >), - /** - * When `false`, it will prevent the soft keyboard from showing when the field is focused. - * Defaults to `true`. - */ - showSoftInputOnFocus: PropTypes.bool, -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js deleted file mode 100644 index f14635ab3a8c..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextPropTypes.js +++ /dev/null @@ -1,158 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const PropTypes = require('prop-types'); -const DeprecatedTextStylePropTypes = require('./DeprecatedTextStylePropTypes'); - -const stylePropType: ReactPropsCheckType = DeprecatedStyleSheetPropType( - DeprecatedTextStylePropTypes, -); - -const DataDetectorTypes = ['phoneNumber', 'link', 'email', 'none', 'all']; - -module.exports = { - /** - * When `numberOfLines` is set, this prop defines how text will be - * truncated. - * - * See https://reactnative.dev/docs/text.html#ellipsizemode - */ - ellipsizeMode: (PropTypes.oneOf([ - 'head', - 'middle', - 'tail', - 'clip', - ]): React$PropType$Primitive<'head' | 'middle' | 'tail' | 'clip'>), - /** - * Used to truncate the text with an ellipsis. - * - * See https://reactnative.dev/docs/text.html#numberoflines - */ - numberOfLines: PropTypes.number, - /** - * Set text break strategy on Android. - * - * See https://reactnative.dev/docs/text.html#textbreakstrategy - */ - textBreakStrategy: (PropTypes.oneOf([ - 'simple', - 'highQuality', - 'balanced', - ]): React$PropType$Primitive<'simple' | 'highQuality' | 'balanced'>), - /** - * Invoked on mount and layout changes. - * - * See https://reactnative.dev/docs/text.html#onlayout - */ - onLayout: PropTypes.func, - /** - * This function is called on press. - * - * See https://reactnative.dev/docs/text.html#onpress - */ - onPress: PropTypes.func, - /** - * This function is called on long press. - * - * See https://reactnative.dev/docs/text.html#onlongpress - */ - onLongPress: PropTypes.func, - /** - * Defines how far your touch may move off of the button, before - * deactivating the button. - * - * See https://reactnative.dev/docs/text.html#pressretentionoffset - */ - pressRetentionOffset: DeprecatedEdgeInsetsPropType, - /** - * Lets the user select text. - * - * See https://reactnative.dev/docs/text.html#selectable - */ - selectable: PropTypes.bool, - /** - * The highlight color of the text. - * - * See https://reactnative.dev/docs/text.html#selectioncolor - */ - selectionColor: DeprecatedColorPropType, - /** - * When `true`, no visual change is made when text is pressed down. - * - * See https://reactnative.dev/docs/text.html#supperhighlighting - */ - suppressHighlighting: PropTypes.bool, - style: stylePropType, - /** - * Used to locate this view in end-to-end tests. - * - * See https://reactnative.dev/docs/text.html#testid - */ - testID: PropTypes.string, - /** - * Used to locate this view from native code. - * - * See https://reactnative.dev/docs/text.html#nativeid - */ - nativeID: PropTypes.string, - /** - * Whether fonts should scale to respect Text Size accessibility settings. - * - * See https://reactnative.dev/docs/text.html#allowfontscaling - */ - allowFontScaling: PropTypes.bool, - /** - * Specifies largest possible scale a font can reach when `allowFontScaling` is enabled. - * Possible values: - * `null/undefined` (default): inherit from the parent node or the global default (0) - * `0`: no max, ignore parent/global default - * `>= 1`: sets the maxFontSizeMultiplier of this node to this value - */ - maxFontSizeMultiplier: PropTypes.number, - /** - * Indicates whether the view is an accessibility element. - * - * See https://reactnative.dev/docs/text.html#accessible - */ - accessible: PropTypes.bool, - /** - * Whether font should be scaled down automatically. - * - * See https://reactnative.dev/docs/text.html#adjustsfontsizetofit - */ - adjustsFontSizeToFit: PropTypes.bool, - /** - * Smallest possible scale a font can reach. - * - * See https://reactnative.dev/docs/text.html#minimumfontscale - */ - minimumFontScale: PropTypes.number, - /** - * Specifies the disabled state of the text view for testing purposes. - * - * See https://reactnative.dev/docs/text.html#disabled - */ - disabled: PropTypes.bool, - /** - * Determines the types of data converted to clickable URLs in text. - * - * See https://reactnative.dev/docs/text.html#dataDetectorType - */ - dataDetectorType: (PropTypes.oneOf( - DataDetectorTypes, - ): React$PropType$Primitive< - 'phoneNumber' | 'link' | 'email' | 'none' | 'all', - >), -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js deleted file mode 100644 index 1c41ff46259c..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTextStylePropTypes.js +++ /dev/null @@ -1,157 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes'); -const ReactPropTypes = require('prop-types'); - -const DeprecatedTextStylePropTypes = { - ...DeprecatedViewStylePropTypes, - - color: DeprecatedColorPropType, - fontFamily: ReactPropTypes.string, - fontSize: ReactPropTypes.number, - fontStyle: (ReactPropTypes.oneOf([ - 'normal', - 'italic', - ]): React$PropType$Primitive<'normal' | 'italic'>), - /** - * Specifies font weight. The values 'normal' and 'bold' are supported for - * most fonts. Not all fonts have a variant for each of the numeric values, - * in that case the closest one is chosen. - */ - fontWeight: (ReactPropTypes.oneOf([ - 'normal' /*default*/, - 'bold', - '100', - '200', - '300', - '400', - '500', - '600', - '700', - '800', - '900', - ]): React$PropType$Primitive< - | 'normal' - | 'bold' - | '100' - | '200' - | '300' - | '400' - | '500' - | '600' - | '700' - | '800' - | '900', - >), - fontVariant: (ReactPropTypes.arrayOf( - ReactPropTypes.oneOf([ - 'small-caps', - 'oldstyle-nums', - 'lining-nums', - 'tabular-nums', - 'proportional-nums', - ]), - ): React$PropType$Primitive< - Array< - | 'small-caps' - | 'oldstyle-nums' - | 'lining-nums' - | 'tabular-nums' - | 'proportional-nums', - >, - >), - textShadowOffset: (ReactPropTypes.shape({ - width: ReactPropTypes.number, - height: ReactPropTypes.number, - }): React$PropType$Primitive<{ - height?: number, - width?: number, - ... - }>), - textShadowRadius: ReactPropTypes.number, - textShadowColor: DeprecatedColorPropType, - /** - * @platform ios - */ - letterSpacing: ReactPropTypes.number, - lineHeight: ReactPropTypes.number, - /** - * Specifies text alignment. The value 'justify' is only supported on iOS and - * fallbacks to `left` on Android. - */ - textAlign: (ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'left', - 'right', - 'center', - 'justify', - ]): React$PropType$Primitive< - 'auto' | 'left' | 'right' | 'center' | 'justify', - >), - /** - * @platform android - */ - textAlignVertical: (ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'top', - 'bottom', - 'center', - ]): React$PropType$Primitive<'auto' | 'top' | 'bottom' | 'center'>), - /** - * Set to `false` to remove extra font padding intended to make space for certain ascenders / descenders. - * With some fonts, this padding can make text look slightly misaligned when centered vertically. - * For best results also set `textAlignVertical` to `center`. Default is true. - * @platform android - */ - includeFontPadding: ReactPropTypes.bool, - textDecorationLine: (ReactPropTypes.oneOf([ - 'none' /*default*/, - 'underline', - 'line-through', - 'underline line-through', - ]): React$PropType$Primitive< - 'none' | 'underline' | 'line-through' | 'underline line-through', - >), - /** - * @platform ios - */ - textDecorationStyle: (ReactPropTypes.oneOf([ - 'solid' /*default*/, - 'double', - 'dotted', - 'dashed', - ]): React$PropType$Primitive<'solid' | 'double' | 'dotted' | 'dashed'>), - /** - * @platform ios - */ - textDecorationColor: DeprecatedColorPropType, - textTransform: (ReactPropTypes.oneOf([ - 'none' /*default*/, - 'capitalize', - 'uppercase', - 'lowercase', - ]): React$PropType$Primitive< - 'none' | 'capitalize' | 'uppercase' | 'lowercase', - >), - /** - * @platform ios - */ - writingDirection: (ReactPropTypes.oneOf([ - 'auto' /*default*/, - 'ltr', - 'rtl', - ]): React$PropType$Primitive<'auto' | 'ltr' | 'rtl'>), -}; - -module.exports = DeprecatedTextStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js deleted file mode 100644 index daba0d83676c..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedTransformPropTypes.js +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const ReactPropTypes = require('prop-types'); - -const deprecatedPropType = require('../Utilities/deprecatedPropType'); - -const TransformMatrixPropType = function( - props: Object, - propName: string, - componentName: string, -): ?Error { - if (props[propName]) { - return new Error( - 'The transformMatrix style property is deprecated. ' + - 'Use `transform: [{ matrix: ... }]` instead.', - ); - } -}; - -const DecomposedMatrixPropType = function( - props: Object, - propName: string, - componentName: string, -): ?Error { - if (props[propName]) { - return new Error( - 'The decomposedMatrix style property is deprecated. ' + - 'Use `transform: [...]` instead.', - ); - } -}; - -const DeprecatedTransformPropTypes = { - transform: (ReactPropTypes.arrayOf( - ReactPropTypes.oneOfType([ - ReactPropTypes.shape({perspective: ReactPropTypes.number}), - ReactPropTypes.shape({rotate: ReactPropTypes.string}), - ReactPropTypes.shape({rotateX: ReactPropTypes.string}), - ReactPropTypes.shape({rotateY: ReactPropTypes.string}), - ReactPropTypes.shape({rotateZ: ReactPropTypes.string}), - ReactPropTypes.shape({scale: ReactPropTypes.number}), - ReactPropTypes.shape({scaleX: ReactPropTypes.number}), - ReactPropTypes.shape({scaleY: ReactPropTypes.number}), - ReactPropTypes.shape({translateX: ReactPropTypes.number}), - ReactPropTypes.shape({translateY: ReactPropTypes.number}), - ReactPropTypes.shape({skewX: ReactPropTypes.string}), - ReactPropTypes.shape({skewY: ReactPropTypes.string}), - ]), - ): React$PropType$Primitive< - Array< - | {perspective?: number, ...} - | {rotate?: string, ...} - | {rotateX?: string, ...} - | {rotateY?: string, ...} - | {rotateZ?: string, ...} - | {scale?: number, ...} - | {scaleX?: number, ...} - | {scaleY?: number, ...} - | {translateX?: number, ...} - | {translateY?: number, ...} - | {skewX?: string, ...} - | {skewY?: string, ...}, - >, - >), - transformMatrix: TransformMatrixPropType, - decomposedMatrix: DecomposedMatrixPropType, - scaleX: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - scaleY: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - rotation: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - translateX: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), - translateY: (deprecatedPropType( - ReactPropTypes.number, - 'Use the transform prop instead.', - ): ReactPropsCheckType), -}; - -module.exports = DeprecatedTransformPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js b/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js deleted file mode 100644 index 2ba6f3115c98..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewAccessibility.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict - */ - -'use strict'; - -module.exports = { - // This must be kept in sync with the AccessibilityRolesMask in RCTViewManager.m - DeprecatedAccessibilityRoles: [ - 'none', - 'button', - 'togglebutton', - 'link', - 'search', - 'image', - 'keyboardkey', - 'text', - 'adjustable', - 'imagebutton', - 'header', - 'summary', - 'alert', - 'checkbox', - 'combobox', - 'menu', - 'menubar', - 'menuitem', - 'progressbar', - 'radio', - 'radiogroup', - 'scrollbar', - 'spinbutton', - 'switch', - 'tab', - 'tablist', - 'timer', - 'list', - 'toolbar', - ], -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js deleted file mode 100644 index c008361311a7..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes.js +++ /dev/null @@ -1,408 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -'use strict'; - -const DeprecatedEdgeInsetsPropType = require('./DeprecatedEdgeInsetsPropType'); -const DeprecatedStyleSheetPropType = require('./DeprecatedStyleSheetPropType'); -const DeprecatedViewStylePropTypes = require('./DeprecatedViewStylePropTypes'); -const PropTypes = require('prop-types'); - -const {DeprecatedAccessibilityRoles} = require('./DeprecatedViewAccessibility'); - -const stylePropType: ReactPropsCheckType = DeprecatedStyleSheetPropType( - DeprecatedViewStylePropTypes, -); - -module.exports = { - /** - * When `true`, indicates that the view is an accessibility element. - * By default, all the touchable elements are accessible. - * - * See https://reactnative.dev/docs/view.html#accessible - */ - accessible: PropTypes.bool, - - /** - * Overrides the text that's read by the screen reader when the user interacts - * with the element. By default, the label is constructed by traversing all - * the children and accumulating all the `Text` nodes separated by space. - * - * See https://reactnative.dev/docs/view.html#accessibilitylabel - */ - accessibilityLabel: PropTypes.node, - - /** - * An accessibility hint helps users understand what will happen when they perform - * an action on the accessibility element when that result is not obvious from the - * accessibility label. - * - * - * See https://reactnative.dev/docs/view.html#accessibilityHint - */ - accessibilityHint: PropTypes.string, - - /** - * Provides an array of custom actions available for accessibility. - * - * @platform ios - */ - accessibilityActions: (PropTypes.arrayOf( - PropTypes.string, - ): React$PropType$Primitive>), - - /** - * Prevents view from being inverted if set to true and color inversion is turned on. - * - * @platform ios - */ - accessibilityIgnoresInvertColors: PropTypes.bool, - - /** - * Indicates to accessibility services to treat UI component like a specific role. - */ - accessibilityRole: (PropTypes.oneOf( - DeprecatedAccessibilityRoles, - ): React$PropType$Primitive< - | 'none' - | 'button' - | 'link' - | 'search' - | 'image' - | 'keyboardkey' - | 'text' - | 'adjustable' - | 'imagebutton' - | 'header' - | 'summary' - | 'alert' - | 'checkbox' - | 'combobox' - | 'menu' - | 'menubar' - | 'menuitem' - | 'progressbar' - | 'radio' - | 'radiogroup' - | 'scrollbar' - | 'spinbutton' - | 'switch' - | 'tab' - | 'tablist' - | 'timer' - | 'toolbar', - >), - - accessibilityState: PropTypes.object, - accessibilityValue: PropTypes.object, - /** - * Indicates to accessibility services whether the user should be notified - * when this view changes. Works for Android API >= 19 only. - * - * @platform android - * - * See https://reactnative.dev/docs/view.html#accessibilityliveregion - */ - accessibilityLiveRegion: (PropTypes.oneOf([ - 'none', - 'polite', - 'assertive', - ]): React$PropType$Primitive<'none' | 'polite' | 'assertive'>), - - /** - * Controls how view is important for accessibility which is if it - * fires accessibility events and if it is reported to accessibility services - * that query the screen. Works for Android only. - * - * @platform android - * - * See https://reactnative.dev/docs/view.html#importantforaccessibility - */ - importantForAccessibility: (PropTypes.oneOf([ - 'auto', - 'yes', - 'no', - 'no-hide-descendants', - ]): React$PropType$Primitive<'auto' | 'yes' | 'no' | 'no-hide-descendants'>), - - /** - * A value indicating whether VoiceOver should ignore the elements - * within views that are siblings of the receiver. - * Default is `false`. - * - * @platform ios - * - * See https://reactnative.dev/docs/view.html#accessibilityviewismodal - */ - accessibilityViewIsModal: PropTypes.bool, - - /** - * A value indicating whether the accessibility elements contained within - * this accessibility element are hidden. - * - * @platform ios - * - * See https://reactnative.dev/docs/view.html#accessibilityElementsHidden - */ - accessibilityElementsHidden: PropTypes.bool, - - /** - * When `accessible` is true, the system will try to invoke this function - * when the user performs an accessibility custom action. - * - * @platform ios - */ - onAccessibilityAction: PropTypes.func, - - /** - * When `accessible` is true, the system will try to invoke this function - * when the user performs accessibility tap gesture. - * - * See https://reactnative.dev/docs/view.html#onaccessibilitytap - */ - onAccessibilityTap: PropTypes.func, - - /** - * When `accessible` is `true`, the system will invoke this function when the - * user performs the magic tap gesture. - * - * See https://reactnative.dev/docs/view.html#onmagictap - */ - onMagicTap: PropTypes.func, - - /** - * Used to locate this view in end-to-end tests. - * - * > This disables the 'layout-only view removal' optimization for this view! - * - * See https://reactnative.dev/docs/view.html#testid - */ - testID: PropTypes.string, - - /** - * Used to locate this view from native classes. - * - * > This disables the 'layout-only view removal' optimization for this view! - * - * See https://reactnative.dev/docs/view.html#nativeid - */ - nativeID: PropTypes.string, - - /** - * For most touch interactions, you'll simply want to wrap your component in - * `TouchableHighlight` or `TouchableOpacity`. Check out `Touchable.js`, - * `ScrollResponder.js` and `ResponderEventPlugin.js` for more discussion. - */ - - /** - * The View is now responding for touch events. This is the time to highlight - * and show the user what is happening. - * - * `View.props.onResponderGrant: (event) => {}`, where `event` is a synthetic - * touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onrespondergrant - */ - onResponderGrant: PropTypes.func, - - /** - * The user is moving their finger. - * - * `View.props.onResponderMove: (event) => {}`, where `event` is a synthetic - * touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onrespondermove - */ - onResponderMove: PropTypes.func, - - /** - * Another responder is already active and will not release it to that `View` - * asking to be the responder. - * - * `View.props.onResponderReject: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onresponderreject - */ - onResponderReject: PropTypes.func, - - /** - * Fired at the end of the touch. - * - * `View.props.onResponderRelease: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onresponderrelease - */ - onResponderRelease: PropTypes.func, - - /** - * The responder has been taken from the `View`. Might be taken by other - * views after a call to `onResponderTerminationRequest`, or might be taken - * by the OS without asking (e.g., happens with control center/ notification - * center on iOS) - * - * `View.props.onResponderTerminate: (event) => {}`, where `event` is a - * synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onresponderterminate - */ - onResponderTerminate: PropTypes.func, - - /** - * Some other `View` wants to become responder and is asking this `View` to - * release its responder. Returning `true` allows its release. - * - * `View.props.onResponderTerminationRequest: (event) => {}`, where `event` - * is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onresponderterminationrequest - */ - onResponderTerminationRequest: PropTypes.func, - - /** - * Does this view want to become responder on the start of a touch? - * - * `View.props.onStartShouldSetResponder: (event) => [true | false]`, where - * `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onstartshouldsetresponder - */ - onStartShouldSetResponder: PropTypes.func, - - /** - * If a parent `View` wants to prevent a child `View` from becoming responder - * on a touch start, it should have this handler which returns `true`. - * - * `View.props.onStartShouldSetResponderCapture: (event) => [true | false]`, - * where `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onstartshouldsetrespondercapture - */ - onStartShouldSetResponderCapture: PropTypes.func, - - /** - * Does this view want to "claim" touch responsiveness? This is called for - * every touch move on the `View` when it is not the responder. - * - * `View.props.onMoveShouldSetResponder: (event) => [true | false]`, where - * `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onmoveshouldsetresponder - */ - onMoveShouldSetResponder: PropTypes.func, - - /** - * If a parent `View` wants to prevent a child `View` from becoming responder - * on a move, it should have this handler which returns `true`. - * - * `View.props.onMoveShouldSetResponderCapture: (event) => [true | false]`, - * where `event` is a synthetic touch event as described above. - * - * See https://reactnative.dev/docs/view.html#onMoveShouldsetrespondercapture - */ - onMoveShouldSetResponderCapture: PropTypes.func, - - /** - * This defines how far a touch event can start away from the view. - * Typical interface guidelines recommend touch targets that are at least - * 30 - 40 points/density-independent pixels. - * - * > The touch area never extends past the parent view bounds and the Z-index - * > of sibling views always takes precedence if a touch hits two overlapping - * > views. - * - * See https://reactnative.dev/docs/view.html#hitslop - */ - hitSlop: DeprecatedEdgeInsetsPropType, - - /** - * Invoked on mount and layout changes with: - * - * `{nativeEvent: { layout: {x, y, width, height}}}` - * - * This event is fired immediately once the layout has been calculated, but - * the new layout may not yet be reflected on the screen at the time the - * event is received, especially if a layout animation is in progress. - * - * See https://reactnative.dev/docs/view.html#onlayout - */ - onLayout: PropTypes.func, - - /** - * Controls whether the `View` can be the target of touch events. - * - * See https://reactnative.dev/docs/view.html#pointerevents - */ - pointerEvents: (PropTypes.oneOf([ - 'box-none', - 'none', - 'box-only', - 'auto', - ]): React$PropType$Primitive<'box-none' | 'none' | 'box-only' | 'auto'>), - - /** - * See https://reactnative.dev/docs/style.html - */ - style: stylePropType, - - /** - * This is a special performance property exposed by `RCTView` and is useful - * for scrolling content when there are many subviews, most of which are - * offscreen. For this property to be effective, it must be applied to a - * view that contains many subviews that extend outside its bound. The - * subviews must also have `overflow: hidden`, as should the containing view - * (or one of its superviews). - * - * See https://reactnative.dev/docs/view.html#removeclippedsubviews - */ - removeClippedSubviews: PropTypes.bool, - - /** - * Whether this `View` should render itself (and all of its children) into a - * single hardware texture on the GPU. - * - * @platform android - * - * See https://reactnative.dev/docs/view.html#rendertohardwaretextureandroid - */ - renderToHardwareTextureAndroid: PropTypes.bool, - - /** - * Whether this `View` should be rendered as a bitmap before compositing. - * - * @platform ios - * - * See https://reactnative.dev/docs/view.html#shouldrasterizeios - */ - shouldRasterizeIOS: PropTypes.bool, - - /** - * Views that are only used to layout their children or otherwise don't draw - * anything may be automatically removed from the native hierarchy as an - * optimization. Set this property to `false` to disable this optimization and - * ensure that this `View` exists in the native view hierarchy. - * - * @platform android - * - * See https://reactnative.dev/docs/view.html#collapsable - */ - collapsable: PropTypes.bool, - - /** - * Whether this `View` needs to rendered offscreen and composited with an - * alpha in order to preserve 100% correct colors and blending behavior. - * - * @platform android - * - * See https://reactnative.dev/docs/view.html#needsoffscreenalphacompositing - */ - needsOffscreenAlphaCompositing: PropTypes.bool, -}; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js deleted file mode 100644 index 8b7036bd6076..000000000000 --- a/Libraries/DeprecatedPropTypes/DeprecatedViewStylePropTypes.js +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const DeprecatedColorPropType = require('./DeprecatedColorPropType'); -const DeprecatedLayoutPropTypes = require('./DeprecatedLayoutPropTypes'); -const DeprecatedShadowPropTypesIOS = require('./DeprecatedShadowPropTypesIOS'); -const DeprecatedTransformPropTypes = require('./DeprecatedTransformPropTypes'); -const ReactPropTypes = require('prop-types'); - -/** - * Warning: Some of these properties may not be supported in all releases. - */ -const DeprecatedViewStylePropTypes = { - ...DeprecatedLayoutPropTypes, - ...DeprecatedShadowPropTypesIOS, - ...DeprecatedTransformPropTypes, - backfaceVisibility: (ReactPropTypes.oneOf([ - 'visible', - 'hidden', - ]): React$PropType$Primitive<'visible' | 'hidden'>), - backgroundColor: DeprecatedColorPropType, - borderColor: DeprecatedColorPropType, - borderTopColor: DeprecatedColorPropType, - borderRightColor: DeprecatedColorPropType, - borderBottomColor: DeprecatedColorPropType, - borderLeftColor: DeprecatedColorPropType, - borderStartColor: DeprecatedColorPropType, - borderEndColor: DeprecatedColorPropType, - borderRadius: ReactPropTypes.number, - borderTopLeftRadius: ReactPropTypes.number, - borderTopRightRadius: ReactPropTypes.number, - borderTopStartRadius: ReactPropTypes.number, - borderTopEndRadius: ReactPropTypes.number, - borderBottomLeftRadius: ReactPropTypes.number, - borderBottomRightRadius: ReactPropTypes.number, - borderBottomStartRadius: ReactPropTypes.number, - borderBottomEndRadius: ReactPropTypes.number, - borderStyle: (ReactPropTypes.oneOf([ - 'solid', - 'dotted', - 'dashed', - ]): React$PropType$Primitive<'solid' | 'dotted' | 'dashed'>), - borderWidth: ReactPropTypes.number, - borderTopWidth: ReactPropTypes.number, - borderRightWidth: ReactPropTypes.number, - borderBottomWidth: ReactPropTypes.number, - borderLeftWidth: ReactPropTypes.number, - opacity: ReactPropTypes.number, - /** - * (Android-only) Sets the elevation of a view, using Android's underlying - * [elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation). - * This adds a drop shadow to the item and affects z-order for overlapping views. - * Only supported on Android 5.0+, has no effect on earlier versions. - * @platform android - */ - elevation: ReactPropTypes.number, -}; - -module.exports = DeprecatedViewStylePropTypes; diff --git a/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js b/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js deleted file mode 100644 index b9249abab95e..000000000000 --- a/Libraries/DeprecatedPropTypes/deprecatedCreateStrictShapeTypeChecker.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const invariant = require('invariant'); - -function deprecatedCreateStrictShapeTypeChecker(shapeTypes: { - [key: string]: ReactPropsCheckType, - ..., -}): ReactPropsChainableTypeChecker { - function checkType( - isRequired, - props, - propName, - componentName, - location?, - ...rest - ) { - if (!props[propName]) { - if (isRequired) { - invariant( - false, - `Required object \`${propName}\` was not specified in ` + - `\`${componentName}\`.`, - ); - } - return; - } - const propValue = props[propName]; - const propType = typeof propValue; - const locationName = location || '(unknown)'; - if (propType !== 'object') { - invariant( - false, - `Invalid ${locationName} \`${propName}\` of type \`${propType}\` ` + - `supplied to \`${componentName}\`, expected \`object\`.`, - ); - } - // We need to check all keys in case some are required but missing from - // props. - const allKeys = {...props[propName], ...shapeTypes}; - for (const key in allKeys) { - const checker = shapeTypes[key]; - if (!checker) { - invariant( - false, - `Invalid props.${propName} key \`${key}\` supplied to \`${componentName}\`.` + - '\nBad object: ' + - JSON.stringify(props[propName], null, ' ') + - '\nValid keys: ' + - JSON.stringify(Object.keys(shapeTypes), null, ' '), - ); - } - const error = checker(propValue, key, componentName, location, ...rest); - if (error) { - invariant( - false, - error.message + - '\nBad object: ' + - JSON.stringify(props[propName], null, ' '), - ); - } - } - } - function chainedCheckType( - props: {[key: string]: any, ...}, - propName: string, - componentName: string, - location?: string, - ...rest - ): ?Error { - return checkType(false, props, propName, componentName, location, ...rest); - } - chainedCheckType.isRequired = checkType.bind(null, true); - return chainedCheckType; -} - -module.exports = deprecatedCreateStrictShapeTypeChecker; diff --git a/Libraries/EventEmitter/NativeEventEmitter.js b/Libraries/EventEmitter/NativeEventEmitter.js index f999dddf3e44..1a615a0ee7f5 100644 --- a/Libraries/EventEmitter/NativeEventEmitter.js +++ b/Libraries/EventEmitter/NativeEventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +36,8 @@ export type {EventSubscription}; * can theoretically listen to `RCTDeviceEventEmitter` (although discouraged). */ export default class NativeEventEmitter - implements IEventEmitter { + implements IEventEmitter +{ _nativeModule: ?NativeModule; constructor(nativeModule: ?NativeModule) { diff --git a/Libraries/EventEmitter/RCTDeviceEventEmitter.js b/Libraries/EventEmitter/RCTDeviceEventEmitter.js index f4e57ef40f76..4b41b2fa7c7f 100644 --- a/Libraries/EventEmitter/RCTDeviceEventEmitter.js +++ b/Libraries/EventEmitter/RCTDeviceEventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/EventEmitter/RCTEventEmitter.js b/Libraries/EventEmitter/RCTEventEmitter.js index fd0ac72eaf99..27519d2d9559 100644 --- a/Libraries/EventEmitter/RCTEventEmitter.js +++ b/Libraries/EventEmitter/RCTEventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/EventEmitter/RCTNativeAppEventEmitter.js b/Libraries/EventEmitter/RCTNativeAppEventEmitter.js index 9e7f4918450c..bae9fa70f147 100644 --- a/Libraries/EventEmitter/RCTNativeAppEventEmitter.js +++ b/Libraries/EventEmitter/RCTNativeAppEventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js b/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js index 6863f81ef5f6..136be278eef7 100644 --- a/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js +++ b/Libraries/EventEmitter/__mocks__/NativeEventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,8 @@ import RCTDeviceEventEmitter from '../RCTDeviceEventEmitter'; * Mock `NativeEventEmitter` to ignore Native Modules. */ export default class NativeEventEmitter - implements IEventEmitter { + implements IEventEmitter +{ addListener>( eventType: TEvent, listener: (...args: $ElementType) => mixed, diff --git a/Libraries/FBLazyVector/FBLazyVector.podspec b/Libraries/FBLazyVector/FBLazyVector.podspec index d78d17e2b02d..c4e844ece07b 100644 --- a/Libraries/FBLazyVector/FBLazyVector.podspec +++ b/Libraries/FBLazyVector/FBLazyVector.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h b/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h index 3b6d27bbb9e9..bbeff166a11e 100644 --- a/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h +++ b/Libraries/FBLazyVector/FBLazyVector/FBLazyIterator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h b/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h index a7eee0ca350e..ddd64bb2e774 100644 --- a/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h +++ b/Libraries/FBLazyVector/FBLazyVector/FBLazyVector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/HeapCapture/HeapCapture.js b/Libraries/HeapCapture/HeapCapture.js index 1e76fd2cb1b6..0c9be9caf215 100644 --- a/Libraries/HeapCapture/HeapCapture.js +++ b/Libraries/HeapCapture/HeapCapture.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,7 +11,7 @@ import NativeJSCHeapCapture from './NativeJSCHeapCapture'; const HeapCapture = { - captureHeap: function(path: string) { + captureHeap: function (path: string) { let error = null; try { global.nativeCaptureHeap(path); diff --git a/Libraries/HeapCapture/NativeJSCHeapCapture.js b/Libraries/HeapCapture/NativeJSCHeapCapture.js index 9a9b7abb0f0e..21347dac036e 100644 --- a/Libraries/HeapCapture/NativeJSCHeapCapture.js +++ b/Libraries/HeapCapture/NativeJSCHeapCapture.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/AssetRegistry.js b/Libraries/Image/AssetRegistry.js index 436195f76f77..78613fbe5be0 100644 --- a/Libraries/Image/AssetRegistry.js +++ b/Libraries/Image/AssetRegistry.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/AssetSourceResolver.js b/Libraries/Image/AssetSourceResolver.js index ee81537631cc..6953ae1d0404 100644 --- a/Libraries/Image/AssetSourceResolver.js +++ b/Libraries/Image/AssetSourceResolver.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -159,10 +159,8 @@ class AssetSourceResolver { }; } - static pickScale: ( - scales: Array, - deviceScale?: number, - ) => number = pickScale; + static pickScale: (scales: Array, deviceScale?: number) => number = + pickScale; } module.exports = AssetSourceResolver; diff --git a/Libraries/Image/AssetUtils.js b/Libraries/Image/AssetUtils.js index a2f85473ffc4..fd370621f0c0 100644 --- a/Libraries/Image/AssetUtils.js +++ b/Libraries/Image/AssetUtils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/Image.android.js b/Libraries/Image/Image.android.js index e878ad5dbeb6..2dd43e4dfb77 100644 --- a/Libraries/Image/Image.android.js +++ b/Libraries/Image/Image.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,6 @@ * @format */ -import DeprecatedImagePropType from '../DeprecatedPropTypes/DeprecatedImagePropType'; import ImageViewNativeComponent from './ImageViewNativeComponent'; import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; @@ -33,7 +32,7 @@ function generateRequestId() { /** * Retrieve the width and height (in pixels) of an image prior to displaying it * - * See https://reactnative.dev/docs/image.html#getsize + * See https://reactnative.dev/docs/image#getsize */ function getSize( url: string, @@ -41,12 +40,12 @@ function getSize( failure?: (error: any) => void, ): any { return NativeImageLoaderAndroid.getSize(url) - .then(function(sizes) { + .then(function (sizes) { success(sizes.width, sizes.height); }) .catch( failure || - function() { + function () { console.warn('Failed to get size for image: ' + url); }, ); @@ -56,7 +55,7 @@ function getSize( * Retrieve the width and height (in pixels) of an image prior to displaying it * with the ability to provide the headers for the request * - * See https://reactnative.dev/docs/image.html#getsizewithheaders + * See https://reactnative.dev/docs/image#getsizewithheaders */ function getSizeWithHeaders( url: string, @@ -65,12 +64,12 @@ function getSizeWithHeaders( failure?: (error: any) => void, ): any { return NativeImageLoaderAndroid.getSizeWithHeaders(url, headers) - .then(function(sizes) { + .then(function (sizes) { success(sizes.width, sizes.height); }) .catch( failure || - function() { + function () { console.warn('Failed to get size for image: ' + url); }, ); @@ -99,7 +98,7 @@ function abortPrefetch(requestId: number) { /** * Perform cache interrogation. * - * See https://reactnative.dev/docs/image.html#querycache + * See https://reactnative.dev/docs/image#querycache */ async function queryCache( urls: Array, @@ -107,7 +106,7 @@ async function queryCache( return await NativeImageLoaderAndroid.queryCache(urls); } -type ImageComponentStatics = $ReadOnly<{| +export type ImageComponentStatics = $ReadOnly<{| getSize: typeof getSize, getSizeWithHeaders: typeof getSizeWithHeaders, prefetch: typeof prefetch, @@ -115,7 +114,6 @@ type ImageComponentStatics = $ReadOnly<{| abortPrefetch: typeof abortPrefetch, queryCache: typeof queryCache, resolveAssetSource: typeof resolveAssetSource, - propTypes: typeof DeprecatedImagePropType, |}>; /** @@ -123,7 +121,7 @@ type ImageComponentStatics = $ReadOnly<{| * including network images, static resources, temporary local images, and * images from local disk, such as the camera roll. * - * See https://reactnative.dev/docs/image.html + * See https://reactnative.dev/docs/image */ let Image = (props: ImagePropsType, forwardedRef) => { let source = resolveAssetSource(props.source); @@ -200,13 +198,22 @@ let Image = (props: ImagePropsType, forwardedRef) => { : nativeProps; return ( - {hasTextAncestor => - hasTextAncestor ? ( - - ) : ( - - ) - } + {hasTextAncestor => { + if (hasTextAncestor) { + let src = Array.isArray(sources) ? sources : [sources]; + return ( + + ); + } + + return ; + }} ); }} @@ -229,7 +236,7 @@ Image.displayName = 'Image'; /** * Retrieve the width and height (in pixels) of an image prior to displaying it * - * See https://reactnative.dev/docs/image.html#getsize + * See https://reactnative.dev/docs/image#getsize */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this @@ -240,7 +247,7 @@ Image.getSize = getSize; * Retrieve the width and height (in pixels) of an image prior to displaying it * with the ability to provide the headers for the request * - * See https://reactnative.dev/docs/image.html#getsizewithheaders + * See https://reactnative.dev/docs/image#getsizewithheaders */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this @@ -251,7 +258,7 @@ Image.getSizeWithHeaders = getSizeWithHeaders; * Prefetches a remote image for later use by downloading it to the disk * cache * - * See https://reactnative.dev/docs/image.html#prefetch + * See https://reactnative.dev/docs/image#prefetch */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this @@ -262,7 +269,7 @@ Image.prefetch = prefetch; * Prefetches a remote image for later use by downloading it to the disk * cache, and adds metadata for queryRootName and rootTag. * - * See https://reactnative.dev/docs/image.html#prefetch + * See https://reactnative.dev/docs/image#prefetch */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this @@ -272,7 +279,7 @@ Image.prefetchWithMetadata = prefetchWithMetadata; /** * Abort prefetch request. * - * See https://reactnative.dev/docs/image.html#abortprefetch + * See https://reactnative.dev/docs/image#abortprefetch */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this @@ -282,7 +289,7 @@ Image.abortPrefetch = abortPrefetch; /** * Perform cache interrogation. * - * See https://reactnative.dev/docs/image.html#querycache + * See https://reactnative.dev/docs/image#querycache */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this @@ -292,17 +299,18 @@ Image.queryCache = queryCache; /** * Resolves an asset reference into an object. * - * See https://reactnative.dev/docs/image.html#resolveassetsource + * See https://reactnative.dev/docs/image#resolveassetsource */ /* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an * error found when Flow v0.89 was deployed. To see the error, delete this * comment and run Flow. */ Image.resolveAssetSource = resolveAssetSource; -/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an - * error found when Flow v0.89 was deployed. To see the error, delete this - * comment and run Flow. */ -Image.propTypes = DeprecatedImagePropType; +/** + * Switch to `deprecated-react-native-prop-types` for compatibility with future + * releases. This is deprecated and will be removed in the future. + */ +Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes; const styles = StyleSheet.create({ base: { diff --git a/Libraries/Image/Image.ios.js b/Libraries/Image/Image.ios.js index 3dab5cc8c1f7..652017ec4986 100644 --- a/Libraries/Image/Image.ios.js +++ b/Libraries/Image/Image.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,6 @@ * @format */ -import DeprecatedImagePropType from '../DeprecatedPropTypes/DeprecatedImagePropType'; import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; @@ -34,7 +33,7 @@ function getSize( .then(([width, height]) => success(width, height)) .catch( failure || - function() { + function () { console.warn('Failed to get size for image ' + uri); }, ); @@ -47,12 +46,12 @@ function getSizeWithHeaders( failure?: (error: any) => void, ): any { return NativeImageLoaderIOS.getSizeWithHeaders(uri, headers) - .then(function(sizes) { + .then(function (sizes) { success(sizes.width, sizes.height); }) .catch( failure || - function() { + function () { console.warn('Failed to get size for image: ' + uri); }, ); @@ -87,14 +86,13 @@ async function queryCache( return await NativeImageLoaderIOS.queryCache(urls); } -type ImageComponentStatics = $ReadOnly<{| +export type ImageComponentStatics = $ReadOnly<{| getSize: typeof getSize, getSizeWithHeaders: typeof getSizeWithHeaders, prefetch: typeof prefetch, prefetchWithMetadata: typeof prefetchWithMetadata, queryCache: typeof queryCache, resolveAssetSource: typeof resolveAssetSource, - propTypes: typeof DeprecatedImagePropType, |}>; /** @@ -102,7 +100,7 @@ type ImageComponentStatics = $ReadOnly<{| * including network images, static resources, temporary local images, and * images from local disk, such as the camera roll. * - * See https://reactnative.dev/docs/image.html + * See https://reactnative.dev/docs/image */ let Image = (props: ImagePropsType, forwardedRef) => { const source = resolveAssetSource(props.source) || { @@ -126,11 +124,7 @@ let Image = (props: ImagePropsType, forwardedRef) => { } } - // $FlowFixMe[incompatible-use] - // $FlowFixMe[incompatible-type] const resizeMode = props.resizeMode || style.resizeMode || 'cover'; - // $FlowFixMe[prop-missing] - // $FlowFixMe[incompatible-use] const tintColor = style.tintColor; if (props.src != null) { @@ -153,7 +147,6 @@ let Image = (props: ImagePropsType, forwardedRef) => { {...props} ref={forwardedRef} style={style} - // $FlowFixMe[incompatible-type] resizeMode={resizeMode} tintColor={tintColor} source={sources} @@ -179,7 +172,7 @@ Image.displayName = 'Image'; /** * Retrieve the width and height (in pixels) of an image prior to displaying it. * - * See https://reactnative.dev/docs/image.html#getsize + * See https://reactnative.dev/docs/image#getsize */ /* $FlowFixMe[prop-missing] (>=0.89.0 site=react_native_ios_fb) This comment * suppresses an error found when Flow v0.89 was deployed. To see the error, @@ -190,7 +183,7 @@ Image.getSize = getSize; * Retrieve the width and height (in pixels) of an image prior to displaying it * with the ability to provide the headers for the request. * - * See https://reactnative.dev/docs/image.html#getsizewithheaders + * See https://reactnative.dev/docs/image#getsizewithheaders */ /* $FlowFixMe[prop-missing] (>=0.89.0 site=react_native_ios_fb) This comment * suppresses an error found when Flow v0.89 was deployed. To see the error, @@ -201,7 +194,7 @@ Image.getSizeWithHeaders = getSizeWithHeaders; * Prefetches a remote image for later use by downloading it to the disk * cache. * - * See https://reactnative.dev/docs/image.html#prefetch + * See https://reactnative.dev/docs/image#prefetch */ /* $FlowFixMe[prop-missing] (>=0.89.0 site=react_native_ios_fb) This comment * suppresses an error found when Flow v0.89 was deployed. To see the error, @@ -212,7 +205,7 @@ Image.prefetch = prefetch; * Prefetches a remote image for later use by downloading it to the disk * cache, and adds metadata for queryRootName and rootTag. * - * See https://reactnative.dev/docs/image.html#prefetch + * See https://reactnative.dev/docs/image#prefetch */ /* $FlowFixMe[prop-missing] (>=0.89.0 site=react_native_ios_fb) This comment * suppresses an error found when Flow v0.89 was deployed. To see the error, @@ -222,7 +215,7 @@ Image.prefetchWithMetadata = prefetchWithMetadata; /** * Performs cache interrogation. * - * See https://reactnative.dev/docs/image.html#querycache + * See https://reactnative.dev/docs/image#querycache */ /* $FlowFixMe[prop-missing] (>=0.89.0 site=react_native_ios_fb) This comment * suppresses an error found when Flow v0.89 was deployed. To see the error, @@ -232,14 +225,18 @@ Image.queryCache = queryCache; /** * Resolves an asset reference into an object. * - * See https://reactnative.dev/docs/image.html#resolveassetsource + * See https://reactnative.dev/docs/image#resolveassetsource */ /* $FlowFixMe[prop-missing] (>=0.89.0 site=react_native_ios_fb) This comment * suppresses an error found when Flow v0.89 was deployed. To see the error, * delete this comment and run Flow. */ Image.resolveAssetSource = resolveAssetSource; -Image.propTypes = DeprecatedImagePropType; +/** + * Switch to `deprecated-react-native-prop-types` for compatibility with future + * releases. This is deprecated and will be removed in the future. + */ +Image.propTypes = require('deprecated-react-native-prop-types').ImagePropTypes; const styles = StyleSheet.create({ base: { diff --git a/Libraries/Image/ImageAnalyticsTagContext.js b/Libraries/Image/ImageAnalyticsTagContext.js index 54d8b65a26b2..81ecba24da5e 100644 --- a/Libraries/Image/ImageAnalyticsTagContext.js +++ b/Libraries/Image/ImageAnalyticsTagContext.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,9 +12,8 @@ import * as React from 'react'; type ContextType = ?string; -const Context: React.Context = React.createContext( - null, -); +const Context: React.Context = + React.createContext(null); if (__DEV__) { Context.displayName = 'ImageAnalyticsTagContext'; diff --git a/Libraries/Image/ImageBackground.js b/Libraries/Image/ImageBackground.js index 5d0de1ca1ac2..30ac413552af 100644 --- a/Libraries/Image/ImageBackground.js +++ b/Libraries/Image/ImageBackground.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,7 +15,9 @@ import * as React from 'react'; import StyleSheet from '../StyleSheet/StyleSheet'; import flattenStyle from '../StyleSheet/flattenStyle'; import View from '../Components/View/View'; +import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; import type {ImageBackgroundProps} from './ImageProps'; +import type {ViewProps} from '../Components/View/ViewPropTypes'; /** * Very simple drop-in replacement for which supports nesting views. @@ -52,7 +54,14 @@ class ImageBackground extends React.Component { _viewRef: ?React.ElementRef = null; - _captureRef = ref => { + _captureRef = ( + ref: null | React$ElementRef< + React$AbstractComponent< + ViewProps, + React.ElementRef>, + >, + >, + ) => { this._viewRef = ref; }; diff --git a/Libraries/Image/ImageInjection.js b/Libraries/Image/ImageInjection.js index 43723fa37566..9a32ef3fd0a2 100644 --- a/Libraries/Image/ImageInjection.js +++ b/Libraries/Image/ImageInjection.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/ImagePickerIOS.js b/Libraries/Image/ImagePickerIOS.js index 1d7438f2b53d..e94cd646e9a1 100644 --- a/Libraries/Image/ImagePickerIOS.js +++ b/Libraries/Image/ImagePickerIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,15 +12,15 @@ import NativeImagePickerIOS from './NativeImagePickerIOS'; import invariant from 'invariant'; const ImagePickerIOS = { - canRecordVideos: function(callback: (result: boolean) => void): void { + canRecordVideos: function (callback: (result: boolean) => void): void { invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); return NativeImagePickerIOS.canRecordVideos(callback); }, - canUseCamera: function(callback: (result: boolean) => void): void { + canUseCamera: function (callback: (result: boolean) => void): void { invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); return NativeImagePickerIOS.canUseCamera(callback); }, - openCameraDialog: function( + openCameraDialog: function ( config: $ReadOnly<{| unmirrorFrontFacingCamera?: boolean, videoMode?: boolean, @@ -49,7 +49,7 @@ const ImagePickerIOS = { cancelCallback, ); }, - openSelectDialog: function( + openSelectDialog: function ( config: $ReadOnly<{| showImages?: boolean, showVideos?: boolean, @@ -86,7 +86,7 @@ const ImagePickerIOS = { * It is safe to call this method for urlsthat aren't video URLs; * it will be a no-op. */ - removePendingVideo: function(url: string): void { + removePendingVideo: function (url: string): void { invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); NativeImagePickerIOS.removePendingVideo(url); }, @@ -94,7 +94,7 @@ const ImagePickerIOS = { * WARNING: In most cases, removePendingVideo should be used instead because * clearAllPendingVideos could clear out pending videos made by other callers. */ - clearAllPendingVideos: function(): void { + clearAllPendingVideos: function (): void { invariant(NativeImagePickerIOS, 'ImagePickerIOS is not available'); NativeImagePickerIOS.clearAllPendingVideos(); }, diff --git a/Libraries/Image/ImageProps.js b/Libraries/Image/ImageProps.js index ed3349c2b247..6bb36fedb5d4 100644 --- a/Libraries/Image/ImageProps.js +++ b/Libraries/Image/ImageProps.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -32,19 +32,19 @@ type IOSImageProps = $ReadOnly<{| /** * A static image to display while loading the image source. * - * See https://reactnative.dev/docs/image.html#defaultsource + * See https://reactnative.dev/docs/image#defaultsource */ defaultSource?: ?ImageSource, /** * Invoked when a partial load of the image is complete. * - * See https://reactnative.dev/docs/image.html#onpartialload + * See https://reactnative.dev/docs/image#onpartialload */ onPartialLoad?: ?() => void, /** * Invoked on download progress with `{nativeEvent: {loaded, total}}`. * - * See https://reactnative.dev/docs/image.html#onprogress + * See https://reactnative.dev/docs/image#onprogress */ onProgress?: ?( event: SyntheticEvent<$ReadOnly<{|loaded: number, total: number|}>>, @@ -65,7 +65,7 @@ export type ImageProps = {| /** * When true, indicates the image is an accessibility element. * - * See https://reactnative.dev/docs/image.html#accessible + * See https://reactnative.dev/docs/image#accessible */ accessible?: ?boolean, @@ -78,26 +78,26 @@ export type ImageProps = {| * The text that's read by the screen reader when the user interacts with * the image. * - * See https://reactnative.dev/docs/image.html#accessibilitylabel + * See https://reactnative.dev/docs/image#accessibilitylabel */ accessibilityLabel?: ?Stringish, /** * blurRadius: the blur radius of the blur filter added to the image * - * See https://reactnative.dev/docs/image.html#blurradius + * See https://reactnative.dev/docs/image#blurradius */ blurRadius?: ?number, /** - * See https://reactnative.dev/docs/image.html#capinsets + * See https://reactnative.dev/docs/image#capinsets */ capInsets?: ?EdgeInsetsProp, /** * Invoked on load error with `{nativeEvent: {error}}`. * - * See https://reactnative.dev/docs/image.html#onerror + * See https://reactnative.dev/docs/image#onerror */ onError?: ?( event: SyntheticEvent< @@ -111,7 +111,7 @@ export type ImageProps = {| * Invoked on mount and layout changes with * `{nativeEvent: {layout: {x, y, width, height}}}`. * - * See https://reactnative.dev/docs/image.html#onlayout + * See https://reactnative.dev/docs/image#onlayout */ onLayout?: ?(event: LayoutEvent) => mixed, @@ -119,38 +119,38 @@ export type ImageProps = {| /** * Invoked when load completes successfully. * - * See https://reactnative.dev/docs/image.html#onload + * See https://reactnative.dev/docs/image#onload */ onLoad?: ?(event: ImageLoadEvent) => void, /** * Invoked when load either succeeds or fails. * - * See https://reactnative.dev/docs/image.html#onloadend + * See https://reactnative.dev/docs/image#onloadend */ onLoadEnd?: ?() => void, /** * Invoked on load start. * - * See https://reactnative.dev/docs/image.html#onloadstart + * See https://reactnative.dev/docs/image#onloadstart */ onLoadStart?: ?() => void, /** - * See https://reactnative.dev/docs/image.html#resizemethod + * See https://reactnative.dev/docs/image#resizemethod */ resizeMethod?: ?('auto' | 'resize' | 'scale'), /** * The image source (either a remote URL or a local file resource). * - * See https://reactnative.dev/docs/image.html#source + * See https://reactnative.dev/docs/image#source */ source?: ?ImageSource, /** - * See https://reactnative.dev/docs/image.html#style + * See https://reactnative.dev/docs/image#style */ style?: ?ImageStyleProp, @@ -158,7 +158,7 @@ export type ImageProps = {| * Determines how to resize the image when the frame doesn't match the raw * image dimensions. * - * See https://reactnative.dev/docs/image.html#resizemode + * See https://reactnative.dev/docs/image#resizemode */ resizeMode?: ?('cover' | 'contain' | 'stretch' | 'repeat' | 'center'), @@ -166,7 +166,7 @@ export type ImageProps = {| * A unique identifier for this element to be used in UI Automation * testing scripts. * - * See https://reactnative.dev/docs/image.html#testid + * See https://reactnative.dev/docs/image#testid */ testID?: ?string, diff --git a/Libraries/Image/ImageResizeMode.js b/Libraries/Image/ImageResizeMode.js index 1dad3309b158..b63627b793bd 100644 --- a/Libraries/Image/ImageResizeMode.js +++ b/Libraries/Image/ImageResizeMode.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/ImageSource.js b/Libraries/Image/ImageSource.js index 903b144b9ac8..b38e9926f1c0 100644 --- a/Libraries/Image/ImageSource.js +++ b/Libraries/Image/ImageSource.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/ImageViewNativeComponent.js b/Libraries/Image/ImageViewNativeComponent.js index 7f26d89dcff4..d0e02068270a 100644 --- a/Libraries/Image/ImageViewNativeComponent.js +++ b/Libraries/Image/ImageViewNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,6 +18,7 @@ import type { DangerouslyImpreciseStyle, ImageStyleProp, } from '../StyleSheet/StyleSheet'; +import Platform from '../Utilities/Platform'; type Props = $ReadOnly<{ ...ImageProps, @@ -31,69 +32,103 @@ type Props = $ReadOnly<{ // Android native props shouldNotifyLoadEvents?: boolean, src?: ?ResolvedAssetSource | $ReadOnlyArray<{uri: string, ...}>, - headers?: ?string, + headers?: ?{[string]: string}, defaultSrc?: ?string, loadingIndicatorSrc?: ?string, }>; -const ImageViewNativeComponent: HostComponent = NativeComponentRegistry.get( - 'RCTImageView', - () => ({ - uiViewClassName: 'RCTImageView', - bubblingEventTypes: {}, - directEventTypes: { - topLoadStart: { - registrationName: 'onLoadStart', - }, - topProgress: { - registrationName: 'onProgress', - }, - topError: { - registrationName: 'onError', - }, - topPartialLoad: { - registrationName: 'onPartialLoad', - }, - topLoad: { - registrationName: 'onLoad', - }, - topLoadEnd: { - registrationName: 'onLoadEnd', - }, - }, - validAttributes: { - blurRadius: true, - capInsets: { - diff: require('../Utilities/differ/insetsDiffer'), - }, - defaultSource: { - process: require('./resolveAssetSource'), - }, - defaultSrc: true, - fadeDuration: true, - headers: true, - internal_analyticTag: true, - loadingIndicatorSrc: true, - onError: true, - onLoad: true, - onLoadEnd: true, - onLoadStart: true, - onPartialLoad: true, - onProgress: true, - overlayColor: { - process: require('../StyleSheet/processColor'), - }, - progressiveRenderingEnabled: true, - resizeMethod: true, - resizeMode: true, - shouldNotifyLoadEvents: true, - source: true, - src: true, - tintColor: { - process: require('../StyleSheet/processColor'), - }, - }, - }), -); +const ImageViewViewConfig = + Platform.OS === 'android' + ? { + uiViewClassName: 'RCTImageView', + bubblingEventTypes: {}, + directEventTypes: { + topLoadStart: { + registrationName: 'onLoadStart', + }, + topProgress: { + registrationName: 'onProgress', + }, + topError: { + registrationName: 'onError', + }, + topLoad: { + registrationName: 'onLoad', + }, + topLoadEnd: { + registrationName: 'onLoadEnd', + }, + }, + validAttributes: { + blurRadius: true, + internal_analyticTag: true, + resizeMode: true, + tintColor: { + process: require('../StyleSheet/processColor'), + }, + borderBottomLeftRadius: true, + borderTopLeftRadius: true, + resizeMethod: true, + src: true, + borderRadius: true, + headers: true, + shouldNotifyLoadEvents: true, + defaultSrc: true, + overlayColor: { + process: require('../StyleSheet/processColor'), + }, + borderColor: { + process: require('../StyleSheet/processColor'), + }, + accessible: true, + progressiveRenderingEnabled: true, + fadeDuration: true, + borderBottomRightRadius: true, + borderTopRightRadius: true, + loadingIndicatorSrc: true, + }, + } + : { + uiViewClassName: 'RCTImageView', + bubblingEventTypes: {}, + directEventTypes: { + topLoadStart: { + registrationName: 'onLoadStart', + }, + topProgress: { + registrationName: 'onProgress', + }, + topError: { + registrationName: 'onError', + }, + topPartialLoad: { + registrationName: 'onPartialLoad', + }, + topLoad: { + registrationName: 'onLoad', + }, + topLoadEnd: { + registrationName: 'onLoadEnd', + }, + }, + validAttributes: { + blurRadius: true, + capInsets: { + diff: require('../Utilities/differ/insetsDiffer'), + }, + defaultSource: { + process: require('./resolveAssetSource'), + }, + internal_analyticTag: true, + resizeMode: true, + source: true, + tintColor: { + process: require('../StyleSheet/processColor'), + }, + }, + }; + +const ImageViewNativeComponent: HostComponent = + NativeComponentRegistry.get('RCTImageView', () => ImageViewViewConfig); export default ImageViewNativeComponent; diff --git a/Libraries/Image/NativeImageEditor.js b/Libraries/Image/NativeImageEditor.js index 726bf2b0b9e1..e17f836e3a1d 100644 --- a/Libraries/Image/NativeImageEditor.js +++ b/Libraries/Image/NativeImageEditor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/NativeImageLoaderAndroid.js b/Libraries/Image/NativeImageLoaderAndroid.js index c55fe6eb9d6c..dcc3db261573 100644 --- a/Libraries/Image/NativeImageLoaderAndroid.js +++ b/Libraries/Image/NativeImageLoaderAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,9 +14,7 @@ import * as TurboModuleRegistry from '../TurboModule/TurboModuleRegistry'; export interface Spec extends TurboModule { +abortRequest: (requestId: number) => void; +getConstants: () => {||}; - +getSize: ( - uri: string, - ) => Promise< + +getSize: (uri: string) => Promise< $ReadOnly<{ width: number, height: number, diff --git a/Libraries/Image/NativeImageLoaderIOS.js b/Libraries/Image/NativeImageLoaderIOS.js index 91c65a6e245c..18a4703d886b 100644 --- a/Libraries/Image/NativeImageLoaderIOS.js +++ b/Libraries/Image/NativeImageLoaderIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/NativeImagePickerIOS.js b/Libraries/Image/NativeImagePickerIOS.js index 8db58d407e21..9e641f206a95 100644 --- a/Libraries/Image/NativeImagePickerIOS.js +++ b/Libraries/Image/NativeImagePickerIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/NativeImageStoreAndroid.js b/Libraries/Image/NativeImageStoreAndroid.js index 4f870f6c0678..7dc4ed58e05c 100644 --- a/Libraries/Image/NativeImageStoreAndroid.js +++ b/Libraries/Image/NativeImageStoreAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/NativeImageStoreIOS.js b/Libraries/Image/NativeImageStoreIOS.js index 4b30843e9cab..7a057f0ad377 100644 --- a/Libraries/Image/NativeImageStoreIOS.js +++ b/Libraries/Image/NativeImageStoreIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTAnimatedImage.h b/Libraries/Image/RCTAnimatedImage.h index 933a49232bf8..34911498aa20 100644 --- a/Libraries/Image/RCTAnimatedImage.h +++ b/Libraries/Image/RCTAnimatedImage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTAnimatedImage.m b/Libraries/Image/RCTAnimatedImage.m index 85bf09e05d37..158d7a2b657e 100644 --- a/Libraries/Image/RCTAnimatedImage.m +++ b/Libraries/Image/RCTAnimatedImage.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -65,7 +65,7 @@ - (BOOL)scanAndCheckFramesValidWithSource:(CGImageSourceRef)imageSource NSMutableArray *frames = [NSMutableArray array]; for (size_t i = 0; i < frameCount; i++) { - RCTGIFCoderFrame *frame = [[RCTGIFCoderFrame alloc] init]; + RCTGIFCoderFrame *frame = [RCTGIFCoderFrame new]; frame.index = i; frame.duration = [self frameDurationAtIndex:i source:imageSource]; [frames addObject:frame]; diff --git a/Libraries/Image/RCTDisplayWeakRefreshable.h b/Libraries/Image/RCTDisplayWeakRefreshable.h index c1ea105a6294..3e1548be146e 100644 --- a/Libraries/Image/RCTDisplayWeakRefreshable.h +++ b/Libraries/Image/RCTDisplayWeakRefreshable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTDisplayWeakRefreshable.m b/Libraries/Image/RCTDisplayWeakRefreshable.m index c84e54053e77..20631dd53cbe 100644 --- a/Libraries/Image/RCTDisplayWeakRefreshable.m +++ b/Libraries/Image/RCTDisplayWeakRefreshable.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTGIFImageDecoder.h b/Libraries/Image/RCTGIFImageDecoder.h index 2d5663799c66..8c397484e4bc 100644 --- a/Libraries/Image/RCTGIFImageDecoder.h +++ b/Libraries/Image/RCTGIFImageDecoder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTGIFImageDecoder.mm b/Libraries/Image/RCTGIFImageDecoder.mm index 2dd15a576ac4..a7d101b0825c 100644 --- a/Libraries/Image/RCTGIFImageDecoder.mm +++ b/Libraries/Image/RCTGIFImageDecoder.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageBlurUtils.h b/Libraries/Image/RCTImageBlurUtils.h index 18a286e65ed5..4edcf3f2fa26 100644 --- a/Libraries/Image/RCTImageBlurUtils.h +++ b/Libraries/Image/RCTImageBlurUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageBlurUtils.m b/Libraries/Image/RCTImageBlurUtils.m index 3ba8c64eac85..4dc2c7654fc2 100644 --- a/Libraries/Image/RCTImageBlurUtils.m +++ b/Libraries/Image/RCTImageBlurUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageCache.h b/Libraries/Image/RCTImageCache.h index a4d15b4403c7..9425e9c405dc 100644 --- a/Libraries/Image/RCTImageCache.h +++ b/Libraries/Image/RCTImageCache.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageCache.m b/Libraries/Image/RCTImageCache.m index e485e806e770..86a86c1848a6 100644 --- a/Libraries/Image/RCTImageCache.m +++ b/Libraries/Image/RCTImageCache.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -39,7 +39,7 @@ - (instancetype)init if (self = [super init]) { _decodedImageCache = [NSCache new]; _decodedImageCache.totalCostLimit = 20 * 1024 * 1024; // 20 MB - _cacheStaleTimes = [[NSMutableDictionary alloc] init]; + _cacheStaleTimes = [NSMutableDictionary new]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(clearCache) @@ -151,7 +151,7 @@ - (NSDate *)dateWithHeaderString:(NSString *)headerDateString { static NSDateFormatter *formatter; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - formatter = [[NSDateFormatter alloc] init]; + formatter = [NSDateFormatter new]; formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]; formatter.dateFormat = @"EEE',' dd MMM yyyy HH':'mm':'ss 'GMT'"; formatter.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; diff --git a/Libraries/Image/RCTImageDataDecoder.h b/Libraries/Image/RCTImageDataDecoder.h index b7fbb00d877a..1d126aab5f89 100644 --- a/Libraries/Image/RCTImageDataDecoder.h +++ b/Libraries/Image/RCTImageDataDecoder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageEditingManager.h b/Libraries/Image/RCTImageEditingManager.h index 216b622ac28b..a155cbdfee00 100644 --- a/Libraries/Image/RCTImageEditingManager.h +++ b/Libraries/Image/RCTImageEditingManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageEditingManager.mm b/Libraries/Image/RCTImageEditingManager.mm index 47b2f60f8497..1f75fe3006f8 100644 --- a/Libraries/Image/RCTImageEditingManager.mm +++ b/Libraries/Image/RCTImageEditingManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageLoader.h b/Libraries/Image/RCTImageLoader.h index da0df284e6f6..c24d5ad384b3 100644 --- a/Libraries/Image/RCTImageLoader.h +++ b/Libraries/Image/RCTImageLoader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageLoader.mm b/Libraries/Image/RCTImageLoader.mm index 90bdfbb01296..d0e3d9c1cffd 100644 --- a/Libraries/Image/RCTImageLoader.mm +++ b/Libraries/Image/RCTImageLoader.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageLoaderLoggable.h b/Libraries/Image/RCTImageLoaderLoggable.h index 3b78c482bb5f..08507e7f6422 100644 --- a/Libraries/Image/RCTImageLoaderLoggable.h +++ b/Libraries/Image/RCTImageLoaderLoggable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageLoaderProtocol.h b/Libraries/Image/RCTImageLoaderProtocol.h index f1bb2689607e..5e8f4f8b16fd 100644 --- a/Libraries/Image/RCTImageLoaderProtocol.h +++ b/Libraries/Image/RCTImageLoaderProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -34,7 +34,7 @@ NS_ASSUME_NONNULL_BEGIN * Use PriorityPrefetch to prefetch images at a lower priority. * The priority logic is up to each @RCTImageLoaderProtocol implementation */ -typedef NS_ENUM(NSUInteger, RCTImageLoaderPriority) { +typedef NS_ENUM(NSInteger, RCTImageLoaderPriority) { RCTImageLoaderPriorityImmediate, RCTImageLoaderPriorityPrefetch }; diff --git a/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h b/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h index 07aab9d79544..1bdbe2eb87db 100644 --- a/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h +++ b/Libraries/Image/RCTImageLoaderWithAttributionProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImagePlugins.h b/Libraries/Image/RCTImagePlugins.h index 1e943d835606..fb782692764c 100644 --- a/Libraries/Image/RCTImagePlugins.h +++ b/Libraries/Image/RCTImagePlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImagePlugins.mm b/Libraries/Image/RCTImagePlugins.mm index 1e03e76066e2..e928330b6119 100644 --- a/Libraries/Image/RCTImagePlugins.mm +++ b/Libraries/Image/RCTImagePlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageShadowView.h b/Libraries/Image/RCTImageShadowView.h index 30571186c0fd..8333da31521b 100644 --- a/Libraries/Image/RCTImageShadowView.h +++ b/Libraries/Image/RCTImageShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageShadowView.m b/Libraries/Image/RCTImageShadowView.m index 3438c68b89ce..bfdad70f342d 100644 --- a/Libraries/Image/RCTImageShadowView.m +++ b/Libraries/Image/RCTImageShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageStoreManager.h b/Libraries/Image/RCTImageStoreManager.h index 00733812725c..389f613ea8af 100644 --- a/Libraries/Image/RCTImageStoreManager.h +++ b/Libraries/Image/RCTImageStoreManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageStoreManager.mm b/Libraries/Image/RCTImageStoreManager.mm index 22ea6547c81f..c62ad0927537 100644 --- a/Libraries/Image/RCTImageStoreManager.mm +++ b/Libraries/Image/RCTImageStoreManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageURLLoader.h b/Libraries/Image/RCTImageURLLoader.h index e49ed1118f32..e8ceb26121a1 100644 --- a/Libraries/Image/RCTImageURLLoader.h +++ b/Libraries/Image/RCTImageURLLoader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageURLLoaderWithAttribution.h b/Libraries/Image/RCTImageURLLoaderWithAttribution.h index 118bed138057..f417cdc79899 100644 --- a/Libraries/Image/RCTImageURLLoaderWithAttribution.h +++ b/Libraries/Image/RCTImageURLLoaderWithAttribution.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageURLLoaderWithAttribution.mm b/Libraries/Image/RCTImageURLLoaderWithAttribution.mm index 61baa4aafee9..1ba2d8964a05 100644 --- a/Libraries/Image/RCTImageURLLoaderWithAttribution.mm +++ b/Libraries/Image/RCTImageURLLoaderWithAttribution.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageUtils.h b/Libraries/Image/RCTImageUtils.h index df04a2c3bb69..5763b04dfbfa 100644 --- a/Libraries/Image/RCTImageUtils.h +++ b/Libraries/Image/RCTImageUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageUtils.m b/Libraries/Image/RCTImageUtils.m index 899bfe4fc61b..d75b6f12d92c 100644 --- a/Libraries/Image/RCTImageUtils.m +++ b/Libraries/Image/RCTImageUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageView.h b/Libraries/Image/RCTImageView.h index c895a538e4da..c5057fc8db15 100644 --- a/Libraries/Image/RCTImageView.h +++ b/Libraries/Image/RCTImageView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageView.mm b/Libraries/Image/RCTImageView.mm index 42a01adb205c..c807372d1938 100644 --- a/Libraries/Image/RCTImageView.mm +++ b/Libraries/Image/RCTImageView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -87,7 +87,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge { if ((self = [super initWithFrame:CGRectZero])) { _bridge = bridge; - _imageView = [[RCTUIImageViewAnimated alloc] init]; + _imageView = [RCTUIImageViewAnimated new]; _imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; [self addSubview:_imageView]; @@ -234,7 +234,7 @@ - (void)cancelAndClearImageLoad [_imageLoader trackURLImageRequestDidDestroy:_loaderRequest]; _loaderRequest = nil; - + if (!self.image) { self.image = _defaultImage; } @@ -313,9 +313,10 @@ - (void)reloadImage } RCTImageLoaderProgressBlock progressHandler = nil; - if (_onProgress) { + if (self.onProgress) { + RCTDirectEventBlock onProgress = self.onProgress; progressHandler = ^(int64_t loaded, int64_t total) { - self->_onProgress(@{ + onProgress(@{ @"loaded": @((double)loaded), @"total": @((double)total), }); @@ -371,8 +372,9 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for } if (error) { + __weak RCTImageView *weakSelf = self; RCTExecuteOnMainQueue(^{ - self.image = nil; + weakSelf.image = nil; }); if (_onError) { @@ -384,33 +386,39 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for return; } + __weak RCTImageView *weakSelf = self; void (^setImageBlock)(UIImage *) = ^(UIImage *image) { + RCTImageView *strongSelf = weakSelf; + if (!strongSelf) { + return; + } if (!isPartialLoad) { - self->_imageSource = source; - self->_pendingImageSource = nil; + strongSelf->_imageSource = source; + strongSelf->_pendingImageSource = nil; } - self.image = image; + strongSelf.image = image; if (isPartialLoad) { - if (self->_onPartialLoad) { - self->_onPartialLoad(nil); + if (strongSelf->_onPartialLoad) { + strongSelf->_onPartialLoad(nil); } } else { - if (self->_onLoad) { + if (strongSelf->_onLoad) { RCTImageSource *sourceLoaded = [source imageSourceWithSize:image.size scale:source.scale]; - self->_onLoad(onLoadParamsForSource(sourceLoaded)); + strongSelf->_onLoad(onLoadParamsForSource(sourceLoaded)); } - if (self->_onLoadEnd) { - self->_onLoadEnd(nil); + if (strongSelf->_onLoadEnd) { + strongSelf->_onLoadEnd(nil); } } }; if (_blurRadius > __FLT_EPSILON__) { // Blur on a background thread to avoid blocking interaction + CGFloat blurRadius = self.blurRadius; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - UIImage *blurredImage = RCTBlurredImageWithRadius(loadedImage, self->_blurRadius); + UIImage *blurredImage = RCTBlurredImageWithRadius(loadedImage, blurRadius); RCTExecuteOnMainQueue(^{ setImageBlock(blurredImage); }); diff --git a/Libraries/Image/RCTImageViewManager.h b/Libraries/Image/RCTImageViewManager.h index 9431f355d0c1..8202aab1d38c 100644 --- a/Libraries/Image/RCTImageViewManager.h +++ b/Libraries/Image/RCTImageViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTImageViewManager.mm b/Libraries/Image/RCTImageViewManager.mm index 320252346888..cbf0d4eee953 100644 --- a/Libraries/Image/RCTImageViewManager.mm +++ b/Libraries/Image/RCTImageViewManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTLocalAssetImageLoader.h b/Libraries/Image/RCTLocalAssetImageLoader.h index c04f21e12953..453accef355c 100644 --- a/Libraries/Image/RCTLocalAssetImageLoader.h +++ b/Libraries/Image/RCTLocalAssetImageLoader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTLocalAssetImageLoader.mm b/Libraries/Image/RCTLocalAssetImageLoader.mm index 9cb0d46b1b00..ec1527c6fbbd 100644 --- a/Libraries/Image/RCTLocalAssetImageLoader.mm +++ b/Libraries/Image/RCTLocalAssetImageLoader.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTResizeMode.h b/Libraries/Image/RCTResizeMode.h index 468a58a84c42..322ce53d0b93 100644 --- a/Libraries/Image/RCTResizeMode.h +++ b/Libraries/Image/RCTResizeMode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTResizeMode.m b/Libraries/Image/RCTResizeMode.m index fccbd6378662..75d7ecefa867 100644 --- a/Libraries/Image/RCTResizeMode.m +++ b/Libraries/Image/RCTResizeMode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTUIImageViewAnimated.h b/Libraries/Image/RCTUIImageViewAnimated.h index 9af8d4e943e1..1215e21b2d64 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.h +++ b/Libraries/Image/RCTUIImageViewAnimated.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/RCTUIImageViewAnimated.m b/Libraries/Image/RCTUIImageViewAnimated.m index 4ab99406a3c6..481c9eef46c6 100644 --- a/Libraries/Image/RCTUIImageViewAnimated.m +++ b/Libraries/Image/RCTUIImageViewAnimated.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -130,7 +130,7 @@ - (void)setImage:(UIImage *)image - (NSOperationQueue *)fetchQueue { if (!_fetchQueue) { - _fetchQueue = [[NSOperationQueue alloc] init]; + _fetchQueue = [NSOperationQueue new]; _fetchQueue.maxConcurrentOperationCount = 1; } return _fetchQueue; diff --git a/Libraries/Image/React-RCTImage.podspec b/Libraries/Image/React-RCTImage.podspec index a3d6622cb970..c0326e9859cc 100644 --- a/Libraries/Image/React-RCTImage.podspec +++ b/Libraries/Image/React-RCTImage.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -36,11 +36,11 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.dependency "RCT-Folly", folly_version - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version diff --git a/Libraries/Image/RelativeImageStub.js b/Libraries/Image/RelativeImageStub.js index 3303143d9337..c8cf0f4da441 100644 --- a/Libraries/Image/RelativeImageStub.js +++ b/Libraries/Image/RelativeImageStub.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/TextInlineImageNativeComponent.js b/Libraries/Image/TextInlineImageNativeComponent.js index c17de2581f0c..b3b14037689a 100644 --- a/Libraries/Image/TextInlineImageNativeComponent.js +++ b/Libraries/Image/TextInlineImageNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,93 +10,33 @@ 'use strict'; -import type {ResolvedAssetSource} from './AssetSourceResolver'; import type {HostComponent} from '../Renderer/shims/ReactNativeTypes'; -import type {ImageProps} from './ImageProps'; import type {ViewProps} from '../Components/View/ViewPropTypes'; +import type {ImageResizeMode} from './ImageResizeMode'; import * as NativeComponentRegistry from '../NativeComponent/NativeComponentRegistry'; -import type { - ColorValue, - DangerouslyImpreciseStyle, - ImageStyleProp, -} from '../StyleSheet/StyleSheet'; +import type {ColorValue} from '../StyleSheet/StyleSheet'; -type Props = $ReadOnly<{ - ...ImageProps, +type NativeProps = $ReadOnly<{ ...ViewProps, - - style?: ImageStyleProp | DangerouslyImpreciseStyle, - - // iOS native props - tintColor?: ColorValue, - - // Android native props - shouldNotifyLoadEvents?: boolean, - src?: ?ResolvedAssetSource | $ReadOnlyArray<{uri: string, ...}>, - headers?: ?string, - defaultSrc?: ?string, - loadingIndicatorSrc?: ?string, - internal_analyticTag?: ?string, + resizeMode?: ?ImageResizeMode, + src?: ?$ReadOnlyArray>, + tintColor?: ?ColorValue, + headers?: ?{[string]: string}, }>; -const TextInlineImage: HostComponent = NativeComponentRegistry.get( - 'RCTTextInlineImage', - () => ({ - uiViewClassName: 'RCTImageView', +const TextInlineImage: HostComponent = + NativeComponentRegistry.get('RCTTextInlineImage', () => ({ + uiViewClassName: 'RCTTextInlineImage', bubblingEventTypes: {}, - directEventTypes: { - topLoadStart: { - registrationName: 'onLoadStart', - }, - topProgress: { - registrationName: 'onProgress', - }, - topError: { - registrationName: 'onError', - }, - topPartialLoad: { - registrationName: 'onPartialLoad', - }, - topLoad: { - registrationName: 'onLoad', - }, - topLoadEnd: { - registrationName: 'onLoadEnd', - }, - }, + directEventTypes: {}, validAttributes: { - blurRadius: true, - capInsets: { - diff: require('../Utilities/differ/insetsDiffer'), - }, - defaultSource: { - process: require('./resolveAssetSource'), - }, - defaultSrc: true, - fadeDuration: true, - headers: true, - internal_analyticTag: true, - loadingIndicatorSrc: true, - onError: true, - onLoad: true, - onLoadEnd: true, - onLoadStart: true, - onPartialLoad: true, - onProgress: true, - overlayColor: { - process: require('../StyleSheet/processColor'), - }, - progressiveRenderingEnabled: true, - resizeMethod: true, resizeMode: true, - shouldNotifyLoadEvents: true, - source: true, src: true, tintColor: { process: require('../StyleSheet/processColor'), }, + headers: true, }, - }), -); + })); module.exports = TextInlineImage; diff --git a/Libraries/Image/__tests__/AssetUtils-test.js b/Libraries/Image/__tests__/AssetUtils-test.js index a5315293b9c3..4da66686a28d 100644 --- a/Libraries/Image/__tests__/AssetUtils-test.js +++ b/Libraries/Image/__tests__/AssetUtils-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,7 @@ describe('AssetUtils', () => { }); it('should return empty string and warn once if no cacheBreaker set (DEV)', () => { - const mockWarn = jest.spyOn(console, 'warn'); + const mockWarn = jest.spyOn(console, 'warn').mockReturnValue(undefined); global.__DEV__ = true; expect(getUrlCacheBreaker()).toEqual(''); expect(getUrlCacheBreaker()).toEqual(''); diff --git a/Libraries/Image/__tests__/Image-test.js b/Libraries/Image/__tests__/Image-test.js index 3e9302d7c820..eec7d4b3c6bb 100644 --- a/Libraries/Image/__tests__/Image-test.js +++ b/Libraries/Image/__tests__/Image-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/__tests__/assetRelativePathInSnapshot-test.js b/Libraries/Image/__tests__/assetRelativePathInSnapshot-test.js index 618d706123c2..a3b6ae47b93b 100644 --- a/Libraries/Image/__tests__/assetRelativePathInSnapshot-test.js +++ b/Libraries/Image/__tests__/assetRelativePathInSnapshot-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Image/__tests__/resolveAssetSource-test.js b/Libraries/Image/__tests__/resolveAssetSource-test.js index c9fa18374bbf..364fb779a547 100644 --- a/Libraries/Image/__tests__/resolveAssetSource-test.js +++ b/Libraries/Image/__tests__/resolveAssetSource-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,8 +21,8 @@ describe('resolveAssetSource', () => { AssetRegistry = require('@react-native/assets/registry'); resolveAssetSource = require('../resolveAssetSource'); - NativeSourceCode = require('../../NativeModules/specs/NativeSourceCode') - .default; + NativeSourceCode = + require('../../NativeModules/specs/NativeSourceCode').default; Platform = require('../../Utilities/Platform'); }); @@ -81,8 +81,7 @@ describe('resolveAssetSource', () => { __packager_asset: true, width: 100, height: 200, - uri: - 'http://10.0.0.1:8081/assets/module/a/logo.png?platform=ios&hash=5b6f00f', + uri: 'http://10.0.0.1:8081/assets/module/a/logo.png?platform=ios&hash=5b6f00f', scale: 1, }, ); @@ -105,8 +104,7 @@ describe('resolveAssetSource', () => { __packager_asset: true, width: 100, height: 200, - uri: - 'http://10.0.0.1:8081/assets/module/a/logo@2x.png?platform=ios&hash=5b6f00f', + uri: 'http://10.0.0.1:8081/assets/module/a/logo@2x.png?platform=ios&hash=5b6f00f', scale: 2, }, ); @@ -248,8 +246,7 @@ describe('resolveAssetSource', () => { __packager_asset: true, width: 100, height: 200, - uri: - 'file:///sdcard/Path/To/Simulator/drawable-mdpi/awesomemodule_subdir_logo1_.png', + uri: 'file:///sdcard/Path/To/Simulator/drawable-mdpi/awesomemodule_subdir_logo1_.png', scale: 1, }, ); @@ -281,8 +278,7 @@ describe('resolveAssetSource', () => { __packager_asset: true, width: 100, height: 200, - uri: - 'file:///sdcard/Path/To/Simulator/drawable-mdpi/awesomemodule_subdir_logo1_.png', + uri: 'file:///sdcard/Path/To/Simulator/drawable-mdpi/awesomemodule_subdir_logo1_.png', scale: 1, }, ); diff --git a/Libraries/Image/nativeImageSource.js b/Libraries/Image/nativeImageSource.js index 65a3169c50c9..c6272c8e43ab 100644 --- a/Libraries/Image/nativeImageSource.js +++ b/Libraries/Image/nativeImageSource.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,7 @@ type NativeImageSourceSpec = $ReadOnly<{| default?: string, // For more details on width and height, see - // https://reactnative.dev/docs/images.html#why-not-automatically-size-everything + // https://reactnative.dev/docs/images#why-not-automatically-size-everything height: number, width: number, |}>; @@ -36,7 +36,7 @@ type NativeImageSourceSpec = $ReadOnly<{| * automates measurements and allows adding new images without rebuilding the * native app. For more details visit: * - * https://reactnative.dev/docs/images.html + * https://reactnative.dev/docs/images * */ function nativeImageSource(spec: NativeImageSourceSpec): ImageURISource { diff --git a/Libraries/Image/resolveAssetSource.js b/Libraries/Image/resolveAssetSource.js index fe8e543e1ff9..40ea0f0f9e9a 100644 --- a/Libraries/Image/resolveAssetSource.js +++ b/Libraries/Image/resolveAssetSource.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/BorderBox.js b/Libraries/Inspector/BorderBox.js index 886beb784d59..c178f25ff51a 100644 --- a/Libraries/Inspector/BorderBox.js +++ b/Libraries/Inspector/BorderBox.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/BoxInspector.js b/Libraries/Inspector/BoxInspector.js index e1002f568ca0..1cc41c173800 100644 --- a/Libraries/Inspector/BoxInspector.js +++ b/Libraries/Inspector/BoxInspector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/ElementBox.js b/Libraries/Inspector/ElementBox.js index 07684d2204d1..8c12ca73ebd4 100644 --- a/Libraries/Inspector/ElementBox.js +++ b/Libraries/Inspector/ElementBox.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/ElementProperties.js b/Libraries/Inspector/ElementProperties.js index a97ef83370fd..fea53f9327a9 100644 --- a/Libraries/Inspector/ElementProperties.js +++ b/Libraries/Inspector/ElementProperties.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/Inspector.js b/Libraries/Inspector/Inspector.js index 3ed92c07e6ea..cc239e484627 100644 --- a/Libraries/Inspector/Inspector.js +++ b/Libraries/Inspector/Inspector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -167,7 +167,7 @@ class Inspector extends React.Component< }, 100); }; - _onAgentShowNativeHighlight = node => { + _onAgentShowNativeHighlight = (node: any) => { clearTimeout(this._hideTimeoutID); // Shape of `node` is different in Fabric. diff --git a/Libraries/Inspector/InspectorOverlay.js b/Libraries/Inspector/InspectorOverlay.js index 19fcfd93ba77..d0e8401045b4 100644 --- a/Libraries/Inspector/InspectorOverlay.js +++ b/Libraries/Inspector/InspectorOverlay.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/InspectorPanel.js b/Libraries/Inspector/InspectorPanel.js index 145fc4a77fcc..b708912a9fd1 100644 --- a/Libraries/Inspector/InspectorPanel.js +++ b/Libraries/Inspector/InspectorPanel.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/NetworkOverlay.js b/Libraries/Inspector/NetworkOverlay.js index 45e6bdadcbf0..aa31087bdbfe 100644 --- a/Libraries/Inspector/NetworkOverlay.js +++ b/Libraries/Inspector/NetworkOverlay.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -397,11 +397,8 @@ class NetworkOverlay extends React.Component { _indicateAdditionalRequests = (): void => { if (this._requestsListView) { const distanceFromEndThreshold = LISTVIEW_CELL_HEIGHT * 2; - const { - offset, - visibleLength, - contentLength, - } = this._requestsListViewScrollMetrics; + const {offset, visibleLength, contentLength} = + this._requestsListViewScrollMetrics; const distanceFromEnd = contentLength - visibleLength - offset; const isCloseToEnd = distanceFromEnd <= distanceFromEndThreshold; if (isCloseToEnd) { diff --git a/Libraries/Inspector/PerformanceOverlay.js b/Libraries/Inspector/PerformanceOverlay.js index 128abb430993..ddd87c49cc59 100644 --- a/Libraries/Inspector/PerformanceOverlay.js +++ b/Libraries/Inspector/PerformanceOverlay.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/StyleInspector.js b/Libraries/Inspector/StyleInspector.js index 820224b3bc66..0380be173df8 100644 --- a/Libraries/Inspector/StyleInspector.js +++ b/Libraries/Inspector/StyleInspector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Inspector/resolveBoxStyle.js b/Libraries/Inspector/resolveBoxStyle.js index 1f013ed064ba..4a8711f5e922 100644 --- a/Libraries/Inspector/resolveBoxStyle.js +++ b/Libraries/Inspector/resolveBoxStyle.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/Batchinator.js b/Libraries/Interaction/Batchinator.js index 5193c40d3352..2ca2d7986d1a 100644 --- a/Libraries/Interaction/Batchinator.js +++ b/Libraries/Interaction/Batchinator.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/BridgeSpyStallHandler.js b/Libraries/Interaction/BridgeSpyStallHandler.js index e90777d41528..5162d799e4a5 100644 --- a/Libraries/Interaction/BridgeSpyStallHandler.js +++ b/Libraries/Interaction/BridgeSpyStallHandler.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +16,7 @@ const MessageQueue = require('../BatchedBridge/MessageQueue'); const infoLog = require('../Utilities/infoLog'); const BridgeSpyStallHandler = { - register: function() { + register: function () { let spyBuffer = []; MessageQueue.spy(data => { spyBuffer.push(data); diff --git a/Libraries/Interaction/FrameRateLogger.js b/Libraries/Interaction/FrameRateLogger.js index cad15c2cac71..7f6d35d72f4b 100644 --- a/Libraries/Interaction/FrameRateLogger.js +++ b/Libraries/Interaction/FrameRateLogger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,7 +33,7 @@ const FrameRateLogger = { * Enable `debug` to see local logs of what's going on. `reportStackTraces` will grab stack traces * during UI thread stalls and upload them if the native module supports it. */ - setGlobalOptions: function(options: { + setGlobalOptions: function (options: { debug?: boolean, reportStackTraces?: boolean, ... @@ -58,7 +58,7 @@ const FrameRateLogger = { * Must call `setContext` before any events can be properly tracked, which is done automatically * in `AppRegistry`, but navigation is also a common place to hook in. */ - setContext: function(context: string) { + setContext: function (context: string) { NativeFrameRateLogger && NativeFrameRateLogger.setContext(context); }, diff --git a/Libraries/Interaction/InteractionManager.js b/Libraries/Interaction/InteractionManager.js index b5a84145d502..887fa8728d68 100644 --- a/Libraries/Interaction/InteractionManager.js +++ b/Libraries/Interaction/InteractionManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -86,9 +86,7 @@ const InteractionManager = { * Schedule a function to run after all interactions have completed. Returns a cancellable * "promise". */ - runAfterInteractions( - task: ?Task, - ): { + runAfterInteractions(task: ?Task): { then: ( onFulfill?: ?(void) => ?(Promise | U), onReject?: ?(error: mixed) => ?(Promise | U), @@ -122,7 +120,7 @@ const InteractionManager = { ); } }, - cancel: function() { + cancel: function () { _taskQueue.cancelTasks(tasks); }, }; diff --git a/Libraries/Interaction/InteractionStallDebugger.js b/Libraries/Interaction/InteractionStallDebugger.js index 78c6bc4258a9..f932ddc2e24c 100644 --- a/Libraries/Interaction/InteractionStallDebugger.js +++ b/Libraries/Interaction/InteractionStallDebugger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/JSEventLoopWatchdog.js b/Libraries/Interaction/JSEventLoopWatchdog.js index 9d9f6cc05b07..3eae297b7418 100644 --- a/Libraries/Interaction/JSEventLoopWatchdog.js +++ b/Libraries/Interaction/JSEventLoopWatchdog.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,20 +35,20 @@ type Handler = { * queried with `getStats`. */ const JSEventLoopWatchdog = { - getStats: function(): Object { + getStats: function (): Object { return {stallCount, totalStallTime, longestStall, acceptableBusyTime}; }, - reset: function() { + reset: function () { infoLog('JSEventLoopWatchdog: reset'); totalStallTime = 0; stallCount = 0; longestStall = 0; lastInterval = global.performance.now(); }, - addHandler: function(handler: Handler) { + addHandler: function (handler: Handler) { handlers.push(handler); }, - install: function({thresholdMS}: {thresholdMS: number, ...}) { + install: function ({thresholdMS}: {thresholdMS: number, ...}) { acceptableBusyTime = thresholdMS; if (installed) { return; diff --git a/Libraries/Interaction/NativeFrameRateLogger.js b/Libraries/Interaction/NativeFrameRateLogger.js index 363294aed75e..16ac155bfb6c 100644 --- a/Libraries/Interaction/NativeFrameRateLogger.js +++ b/Libraries/Interaction/NativeFrameRateLogger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/PanResponder.js b/Libraries/Interaction/PanResponder.js index a41d34e01856..6c807a46e8df 100644 --- a/Libraries/Interaction/PanResponder.js +++ b/Libraries/Interaction/PanResponder.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -383,9 +383,7 @@ const PanResponder = { * accordingly. (numberActiveTouches) may not be totally accurate unless you * are the responder. */ - create( - config: PanResponderConfig, - ): $TEMPORARY$object<{| + create(config: PanResponderConfig): $TEMPORARY$object<{| getInteractionHandle: () => ?number, panHandlers: $TEMPORARY$object<{| onMoveShouldSetResponder: (event: PressEvent) => boolean, @@ -462,7 +460,8 @@ const PanResponder = { onResponderGrant(event: PressEvent): boolean { if (!interactionState.handle) { - interactionState.handle = InteractionManager.createInteractionHandle(); + interactionState.handle = + InteractionManager.createInteractionHandle(); } gestureState.x0 = currentCentroidX(event.touchHistory); gestureState.y0 = currentCentroidY(event.touchHistory); diff --git a/Libraries/Interaction/TaskQueue.js b/Libraries/Interaction/TaskQueue.js index 3fad71ae0a0d..c7f690481ed1 100644 --- a/Libraries/Interaction/TaskQueue.js +++ b/Libraries/Interaction/TaskQueue.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/TouchHistoryMath.js b/Libraries/Interaction/TouchHistoryMath.js index 19cf76a9f1b8..cbcbe2606de9 100644 --- a/Libraries/Interaction/TouchHistoryMath.js +++ b/Libraries/Interaction/TouchHistoryMath.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,7 +24,7 @@ const TouchHistoryMath = { * touches vs. previous centroid of now actively moving touches. * @return {number} value of centroid in specified dimension. */ - centroidDimension: function( + centroidDimension: function ( touchHistory, touchesChangedAfter, isXAxis, @@ -81,7 +81,7 @@ const TouchHistoryMath = { return count > 0 ? total / count : TouchHistoryMath.noCentroid; }, - currentCentroidXOfTouchesChangedAfter: function( + currentCentroidXOfTouchesChangedAfter: function ( touchHistory, touchesChangedAfter, ) { @@ -93,7 +93,7 @@ const TouchHistoryMath = { ); }, - currentCentroidYOfTouchesChangedAfter: function( + currentCentroidYOfTouchesChangedAfter: function ( touchHistory, touchesChangedAfter, ) { @@ -105,7 +105,7 @@ const TouchHistoryMath = { ); }, - previousCentroidXOfTouchesChangedAfter: function( + previousCentroidXOfTouchesChangedAfter: function ( touchHistory, touchesChangedAfter, ) { @@ -117,7 +117,7 @@ const TouchHistoryMath = { ); }, - previousCentroidYOfTouchesChangedAfter: function( + previousCentroidYOfTouchesChangedAfter: function ( touchHistory, touchesChangedAfter, ) { @@ -129,7 +129,7 @@ const TouchHistoryMath = { ); }, - currentCentroidX: function(touchHistory) { + currentCentroidX: function (touchHistory) { return TouchHistoryMath.centroidDimension( touchHistory, 0, // touchesChangedAfter @@ -138,7 +138,7 @@ const TouchHistoryMath = { ); }, - currentCentroidY: function(touchHistory) { + currentCentroidY: function (touchHistory) { return TouchHistoryMath.centroidDimension( touchHistory, 0, // touchesChangedAfter diff --git a/Libraries/Interaction/__tests__/Batchinator-test.js b/Libraries/Interaction/__tests__/Batchinator-test.js index 0c6e8448ff07..8c49e3888a30 100644 --- a/Libraries/Interaction/__tests__/Batchinator-test.js +++ b/Libraries/Interaction/__tests__/Batchinator-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/__tests__/InteractionManager-test.js b/Libraries/Interaction/__tests__/InteractionManager-test.js index a9abd62f5c67..3b551e84b3f9 100644 --- a/Libraries/Interaction/__tests__/InteractionManager-test.js +++ b/Libraries/Interaction/__tests__/InteractionManager-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Interaction/__tests__/TaskQueue-test.js b/Libraries/Interaction/__tests__/TaskQueue-test.js index aeed06ca0aea..9f52942b0366 100644 --- a/Libraries/Interaction/__tests__/TaskQueue-test.js +++ b/Libraries/Interaction/__tests__/TaskQueue-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/JSInspector/InspectorAgent.js b/Libraries/JSInspector/InspectorAgent.js index 8c12d695293c..833a143247f7 100644 --- a/Libraries/JSInspector/InspectorAgent.js +++ b/Libraries/JSInspector/InspectorAgent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/JSInspector/JSInspector.js b/Libraries/JSInspector/JSInspector.js index d4c8815ebe1c..00bce964f3d9 100644 --- a/Libraries/JSInspector/JSInspector.js +++ b/Libraries/JSInspector/JSInspector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/JSInspector/NetworkAgent.js b/Libraries/JSInspector/NetworkAgent.js index f1811978709e..4782c6e24504 100644 --- a/Libraries/JSInspector/NetworkAgent.js +++ b/Libraries/JSInspector/NetworkAgent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -275,12 +275,7 @@ class NetworkAgent extends InspectorAgent { this._interceptor = null; } - getResponseBody({ - requestId, - }: { - requestId: RequestId, - ... - }): { + getResponseBody({requestId}: {requestId: RequestId, ...}): { body: ?string, base64Encoded: boolean, ... diff --git a/Libraries/LayoutAnimation/LayoutAnimation.js b/Libraries/LayoutAnimation/LayoutAnimation.js index efb12afa5dc7..97126be4dbdb 100644 --- a/Libraries/LayoutAnimation/LayoutAnimation.js +++ b/Libraries/LayoutAnimation/LayoutAnimation.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -70,7 +70,7 @@ function configureNext( config, onAnimationComplete, onAnimationDidFail ?? - function() {} /* this will only be called if configuration parsing fails */, + function () {} /* this will only be called if configuration parsing fails */, ); return; } @@ -81,9 +81,9 @@ function configureNext( if (UIManager?.configureNextLayoutAnimation) { UIManager.configureNextLayoutAnimation( config, - onAnimationComplete ?? function() {}, + onAnimationComplete ?? function () {}, onAnimationDidFail ?? - function() {} /* this should never be called in Non-Fabric */, + function () {} /* this should never be called in Non-Fabric */, ); } } diff --git a/Libraries/Linking/Linking.js b/Libraries/Linking/Linking.js index e69e07a4c53b..662e1e58bcbd 100644 --- a/Libraries/Linking/Linking.js +++ b/Libraries/Linking/Linking.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ type LinkingEventDefinitions = { * `Linking` gives you a general interface to interact with both incoming * and outgoing app links. * - * See https://reactnative.dev/docs/linking.html + * See https://reactnative.dev/docs/linking */ class Linking extends NativeEventEmitter { constructor() { @@ -36,7 +36,7 @@ class Linking extends NativeEventEmitter { * Add a handler to Linking changes by listening to the `url` event type * and providing the handler * - * See https://reactnative.dev/docs/linking.html#addeventlistener + * See https://reactnative.dev/docs/linking#addeventlistener */ addEventListener>( eventType: K, @@ -60,7 +60,7 @@ class Linking extends NativeEventEmitter { /** * Try to open the given `url` with any of the installed apps. * - * See https://reactnative.dev/docs/linking.html#openurl + * See https://reactnative.dev/docs/linking#openurl */ openURL(url: string): Promise { this._validateURL(url); @@ -74,7 +74,7 @@ class Linking extends NativeEventEmitter { /** * Determine whether or not an installed app can handle a given URL. * - * See https://reactnative.dev/docs/linking.html#canopenurl + * See https://reactnative.dev/docs/linking#canopenurl */ canOpenURL(url: string): Promise { this._validateURL(url); @@ -88,7 +88,7 @@ class Linking extends NativeEventEmitter { /** * Open app settings. * - * See https://reactnative.dev/docs/linking.html#opensettings + * See https://reactnative.dev/docs/linking#opensettings */ openSettings(): Promise { if (Platform.OS === 'android') { @@ -102,7 +102,7 @@ class Linking extends NativeEventEmitter { * If the app launch was triggered by an app link, * it will give the link url, otherwise it will give `null` * - * See https://reactnative.dev/docs/linking.html#getinitialurl + * See https://reactnative.dev/docs/linking#getinitialurl */ getInitialURL(): Promise { return Platform.OS === 'android' @@ -117,7 +117,7 @@ class Linking extends NativeEventEmitter { * * @platform android * - * See https://reactnative.dev/docs/linking.html#sendintent + * See https://reactnative.dev/docs/linking#sendintent */ sendIntent( action: string, diff --git a/Libraries/Linking/NativeIntentAndroid.js b/Libraries/Linking/NativeIntentAndroid.js index 7f045fd8f9c1..0fb643f379c4 100644 --- a/Libraries/Linking/NativeIntentAndroid.js +++ b/Libraries/Linking/NativeIntentAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Linking/NativeLinkingManager.js b/Libraries/Linking/NativeLinkingManager.js index 2626ce0d3bcd..79350c661ba1 100644 --- a/Libraries/Linking/NativeLinkingManager.js +++ b/Libraries/Linking/NativeLinkingManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LinkingIOS/RCTLinkingManager.h b/Libraries/LinkingIOS/RCTLinkingManager.h index 02de12252edc..4eea247f440e 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.h +++ b/Libraries/LinkingIOS/RCTLinkingManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LinkingIOS/RCTLinkingManager.mm b/Libraries/LinkingIOS/RCTLinkingManager.mm index 2d96001cb520..dc45866b7a01 100644 --- a/Libraries/LinkingIOS/RCTLinkingManager.mm +++ b/Libraries/LinkingIOS/RCTLinkingManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LinkingIOS/RCTLinkingPlugins.h b/Libraries/LinkingIOS/RCTLinkingPlugins.h index 17e3d6ca229a..4cf0a9b4ec48 100644 --- a/Libraries/LinkingIOS/RCTLinkingPlugins.h +++ b/Libraries/LinkingIOS/RCTLinkingPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LinkingIOS/RCTLinkingPlugins.mm b/Libraries/LinkingIOS/RCTLinkingPlugins.mm index b5993a9b306f..d8b3a0c7fa1c 100644 --- a/Libraries/LinkingIOS/RCTLinkingPlugins.mm +++ b/Libraries/LinkingIOS/RCTLinkingPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LinkingIOS/React-RCTLinking.podspec b/Libraries/LinkingIOS/React-RCTLinking.podspec index 48877f4acefe..1a905e6d0f12 100644 --- a/Libraries/LinkingIOS/React-RCTLinking.podspec +++ b/Libraries/LinkingIOS/React-RCTLinking.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -36,10 +36,10 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "React-Core/RCTLinkingHeaders", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version diff --git a/Libraries/Lists/CellRenderMask.js b/Libraries/Lists/CellRenderMask.js index 786ae7b00bad..ddcb96d21c46 100644 --- a/Libraries/Lists/CellRenderMask.js +++ b/Libraries/Lists/CellRenderMask.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Lists/FillRateHelper.js b/Libraries/Lists/FillRateHelper.js index 6e18000b48f7..1a13a1933b1a 100644 --- a/Libraries/Lists/FillRateHelper.js +++ b/Libraries/Lists/FillRateHelper.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -54,9 +54,10 @@ class FillRateHelper { _mostlyBlankStartTime = (null: ?number); _samplesStartTime = (null: ?number); - static addListener( - callback: FillRateInfo => void, - ): {remove: () => void, ...} { + static addListener(callback: FillRateInfo => void): { + remove: () => void, + ... + } { if (_sampleRate === null) { console.warn('Call `FillRateHelper.setSampleRate` before `addListener`.'); } diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 5e49715a8e71..f78ca22968c7 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -408,14 +408,13 @@ class FlatList extends React.PureComponent, void> { super(props); this._checkProps(this.props); if (this.props.viewabilityConfigCallbackPairs) { - this._virtualizedListPairs = this.props.viewabilityConfigCallbackPairs.map( - pair => ({ + this._virtualizedListPairs = + this.props.viewabilityConfigCallbackPairs.map(pair => ({ viewabilityConfig: pair.viewabilityConfig, onViewableItemsChanged: this._createOnViewableItemsChanged( pair.onViewableItemsChanged, ), - }), - ); + })); } else if (this.props.onViewableItemsChanged) { this._virtualizedListPairs.push({ /* $FlowFixMe[incompatible-call] (>=0.63.0 site=react_native_fb) This diff --git a/Libraries/Lists/SectionList.js b/Libraries/Lists/SectionList.js index 723c7051a0a5..e99675ad1456 100644 --- a/Libraries/Lists/SectionList.js +++ b/Libraries/Lists/SectionList.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,7 +27,7 @@ export type SectionBase = _SectionBase; type RequiredProps> = {| /** - * The actual data to render, akin to the `data` prop in [``](https://reactnative.dev/docs/flatlist.html). + * The actual data to render, akin to the `data` prop in [``](https://reactnative.dev/docs/flatlist). * * General shape: * @@ -131,7 +131,7 @@ export type Props = {| * - Scroll loading. * * If you don't need section support and want a simpler interface, use - * [``](https://reactnative.dev/docs/flatlist.html). + * [``](https://reactnative.dev/docs/flatlist). * * Simple Examples: * @@ -153,7 +153,7 @@ export type Props = {| * ]} * /> * - * This is a convenience wrapper around [``](docs/virtualizedlist.html), + * This is a convenience wrapper around [``](docs/virtualizedlist), * and thus inherits its props (as well as those of `ScrollView`) that aren't explicitly listed * here, along with the following caveats: * diff --git a/Libraries/Lists/SectionListModern.js b/Libraries/Lists/SectionListModern.js index e0eca61209b0..f2c400c6db9f 100644 --- a/Libraries/Lists/SectionListModern.js +++ b/Libraries/Lists/SectionListModern.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -28,7 +28,7 @@ export type SectionBase = _SectionBase; type RequiredProps> = {| /** - * The actual data to render, akin to the `data` prop in [``](https://reactnative.dev/docs/flatlist.html). + * The actual data to render, akin to the `data` prop in [``](https://reactnative.dev/docs/flatlist). * * General shape: * @@ -132,7 +132,7 @@ export type Props = {| * - Scroll loading. * * If you don't need section support and want a simpler interface, use - * [``](https://reactnative.dev/docs/flatlist.html). + * [``](https://reactnative.dev/docs/flatlist). * * Simple Examples: * @@ -154,7 +154,7 @@ export type Props = {| * ]} * /> * - * This is a convenience wrapper around [``](docs/virtualizedlist.html), + * This is a convenience wrapper around [``](docs/virtualizedlist), * and thus inherits its props (as well as those of `ScrollView`) that aren't explicitly listed * here, along with the following caveats: * diff --git a/Libraries/Lists/ViewabilityHelper.js b/Libraries/Lists/ViewabilityHelper.js index 8b1d49fd8ba1..2e000c8f01ff 100644 --- a/Libraries/Lists/ViewabilityHelper.js +++ b/Libraries/Lists/ViewabilityHelper.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -102,9 +102,7 @@ class ViewabilityHelper { itemCount: number, scrollOffset: number, viewportHeight: number, - getFrameMetrics: ( - index: number, - ) => ?{ + getFrameMetrics: (index: number) => ?{ length: number, offset: number, ... @@ -116,10 +114,8 @@ class ViewabilityHelper { ... }, ): Array { - const { - itemVisiblePercentThreshold, - viewAreaCoveragePercentThreshold, - } = this._config; + const {itemVisiblePercentThreshold, viewAreaCoveragePercentThreshold} = + this._config; const viewAreaMode = viewAreaCoveragePercentThreshold != null; const viewablePercentThreshold = viewAreaMode ? viewAreaCoveragePercentThreshold @@ -179,9 +175,7 @@ class ViewabilityHelper { itemCount: number, scrollOffset: number, viewportHeight: number, - getFrameMetrics: ( - index: number, - ) => ?{ + getFrameMetrics: (index: number) => ?{ length: number, offset: number, ... diff --git a/Libraries/Lists/VirtualizeUtils.js b/Libraries/Lists/VirtualizeUtils.js index 1d80b378aa8d..6e50e62b9cab 100644 --- a/Libraries/Lists/VirtualizeUtils.js +++ b/Libraries/Lists/VirtualizeUtils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,9 +20,7 @@ import invariant from 'invariant'; export function elementsThatOverlapOffsets( offsets: Array, itemCount: number, - getFrameMetrics: ( - index: number, - ) => { + getFrameMetrics: (index: number) => { length: number, offset: number, ... @@ -96,9 +94,7 @@ export function computeWindowedRenderLimits( last: number, ... }, - getFrameMetricsApprox: ( - index: number, - ) => { + getFrameMetricsApprox: (index: number) => { length: number, offset: number, ... diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 2648cc3e4bb0..6de43b77c468 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -349,8 +349,8 @@ function windowSizeOrDefault(windowSize: ?number) { } /** - * Base implementation for the more convenient [``](https://reactnative.dev/docs/flatlist.html) - * and [``](https://reactnative.dev/docs/sectionlist.html) components, which are also better + * Base implementation for the more convenient [``](https://reactnative.dev/docs/flatlist) + * and [``](https://reactnative.dev/docs/sectionlist) components, which are also better * documented. In general, this should only really be used if you need more flexibility than * `FlatList` provides, e.g. for use with immutable data instead of plain arrays. * @@ -441,9 +441,9 @@ class VirtualizedList extends React.PureComponent { ); invariant( index < getItemCount(data), - `scrollToIndex out of range: requested index ${index} is out of 0 to ${getItemCount( - data, - ) - 1}`, + `scrollToIndex out of range: requested index ${index} is out of 0 to ${ + getItemCount(data) - 1 + }`, ); if (!getItemLayout && index > this._highestMeasuredFrameIndex) { invariant( @@ -703,12 +703,14 @@ class VirtualizedList extends React.PureComponent { onViewableItemsChanged: pair.onViewableItemsChanged, }), ); - } else if (this.props.onViewableItemsChanged) { - this._viewabilityTuples.push({ - viewabilityHelper: new ViewabilityHelper(this.props.viewabilityConfig), - // $FlowFixMe[incompatible-call] - onViewableItemsChanged: this.props.onViewableItemsChanged, - }); + } else { + const {onViewableItemsChanged, viewabilityConfig} = this.props; + if (onViewableItemsChanged) { + this._viewabilityTuples.push({ + viewabilityHelper: new ViewabilityHelper(viewabilityConfig), + onViewableItemsChanged: onViewableItemsChanged, + }); + } } let initialState = { @@ -882,11 +884,8 @@ class VirtualizedList extends React.PureComponent { ); } } - const { - ListEmptyComponent, - ListFooterComponent, - ListHeaderComponent, - } = this.props; + const {ListEmptyComponent, ListFooterComponent, ListHeaderComponent} = + this.props; const {data, horizontal} = this.props; const isVirtualizationDisabled = this._isVirtualizationDisabled(); const inversionStyle = this.props.inverted @@ -1496,12 +1495,8 @@ class VirtualizedList extends React.PureComponent { } _maybeCallOnEndReached() { - const { - data, - getItemCount, - onEndReached, - onEndReachedThreshold, - } = this.props; + const {data, getItemCount, onEndReached, onEndReachedThreshold} = + this.props; const {contentLength, visibleLength, offset} = this._scrollMetrics; const distanceFromEnd = contentLength - visibleLength - offset; const threshold = @@ -1588,15 +1583,11 @@ class VirtualizedList extends React.PureComponent { // know our offset from our offset from our parent return; } - ({ - visibleLength, - contentLength, - offset, - dOffset, - } = this._convertParentScrollMetrics({ - visibleLength, - offset, - })); + ({visibleLength, contentLength, offset, dOffset} = + this._convertParentScrollMetrics({ + visibleLength, + offset, + })); } const dt = this._scrollMetrics.timestamp @@ -1802,7 +1793,6 @@ class VirtualizedList extends React.PureComponent { } } if (someChildHasMore) { - // $FlowFixMe[incompatible-use] newState.last = ii; break; } diff --git a/Libraries/Lists/VirtualizedListContext.js b/Libraries/Lists/VirtualizedListContext.js index b2f8d063dca0..dec07c75f31b 100644 --- a/Libraries/Lists/VirtualizedListContext.js +++ b/Libraries/Lists/VirtualizedListContext.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -64,9 +64,8 @@ type Context = $ReadOnly<{ debugInfo: ListDebugInfo, }>; -export const VirtualizedListContext: React.Context = React.createContext( - null, -); +export const VirtualizedListContext: React.Context = + React.createContext(null); if (__DEV__) { VirtualizedListContext.displayName = 'VirtualizedListContext'; } diff --git a/Libraries/Lists/VirtualizedSectionList.js b/Libraries/Lists/VirtualizedSectionList.js index 977fa3a0d785..be818e4ae76e 100644 --- a/Libraries/Lists/VirtualizedSectionList.js +++ b/Libraries/Lists/VirtualizedSectionList.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -240,9 +240,7 @@ class VirtualizedSectionList< return (info && info.key) || String(index); }; - _subExtractor( - index: number, - ): ?{ + _subExtractor(index: number): ?{ section: SectionT, // Key of the section or combined key for section + item key: string, @@ -339,63 +337,58 @@ class VirtualizedSectionList< } }; - _renderItem = (listItemCount: number) => ({ - item, - index, - }: { - item: Item, - index: number, - ... - }) => { - const info = this._subExtractor(index); - if (!info) { - return null; - } - const infoIndex = info.index; - if (infoIndex == null) { - const {section} = info; - if (info.header === true) { - const {renderSectionHeader} = this.props; - return renderSectionHeader ? renderSectionHeader({section}) : null; + _renderItem = + (listItemCount: number) => + ({item, index}: {item: Item, index: number, ...}) => { + const info = this._subExtractor(index); + if (!info) { + return null; + } + const infoIndex = info.index; + if (infoIndex == null) { + const {section} = info; + if (info.header === true) { + const {renderSectionHeader} = this.props; + return renderSectionHeader ? renderSectionHeader({section}) : null; + } else { + const {renderSectionFooter} = this.props; + return renderSectionFooter ? renderSectionFooter({section}) : null; + } } else { - const {renderSectionFooter} = this.props; - return renderSectionFooter ? renderSectionFooter({section}) : null; + const renderItem = info.section.renderItem || this.props.renderItem; + const SeparatorComponent = this._getSeparatorComponent( + index, + info, + listItemCount, + ); + invariant(renderItem, 'no renderItem!'); + return ( + + ); } - } else { - const renderItem = info.section.renderItem || this.props.renderItem; - const SeparatorComponent = this._getSeparatorComponent( - index, - info, - listItemCount, - ); - invariant(renderItem, 'no renderItem!'); - return ( - - ); - } - }; + }; _updatePropsFor = (cellKey, value) => { const updateProps = this._updatePropsMap[cellKey]; @@ -506,10 +499,8 @@ function ItemWithSeparator(props: ItemWithSeparatorProps): React.Node { inverted, } = props; - const [ - leadingSeparatorHiglighted, - setLeadingSeparatorHighlighted, - ] = React.useState(false); + const [leadingSeparatorHiglighted, setLeadingSeparatorHighlighted] = + React.useState(false); const [separatorHighlighted, setSeparatorHighlighted] = React.useState(false); diff --git a/Libraries/Lists/__flowtests__/FlatList-flowtest.js b/Libraries/Lists/__flowtests__/FlatList-flowtest.js index 912289cbf004..fb62a18ca4f4 100644 --- a/Libraries/Lists/__flowtests__/FlatList-flowtest.js +++ b/Libraries/Lists/__flowtests__/FlatList-flowtest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Lists/__flowtests__/SectionList-flowtest.js b/Libraries/Lists/__flowtests__/SectionList-flowtest.js index 38dac9cb6fb3..da9eb38f9fcc 100644 --- a/Libraries/Lists/__flowtests__/SectionList-flowtest.js +++ b/Libraries/Lists/__flowtests__/SectionList-flowtest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Lists/__tests__/CellRenderMask-test.js b/Libraries/Lists/__tests__/CellRenderMask-test.js index 702cf65ab976..bef5cc3fa3e3 100644 --- a/Libraries/Lists/__tests__/CellRenderMask-test.js +++ b/Libraries/Lists/__tests__/CellRenderMask-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Lists/__tests__/FillRateHelper-test.js b/Libraries/Lists/__tests__/FillRateHelper-test.js index a0b0b3b4f48d..63d0d0f4ba7a 100644 --- a/Libraries/Lists/__tests__/FillRateHelper-test.js +++ b/Libraries/Lists/__tests__/FillRateHelper-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -40,13 +40,13 @@ function computeResult({helper, props, state, scroll}): number { ); } -describe('computeBlankness', function() { +describe('computeBlankness', function () { beforeEach(() => { FillRateHelper.setSampleRate(1); FillRateHelper.setMinSampleCount(0); }); - it('computes correct blankness of viewport', function() { + it('computes correct blankness of viewport', function () { const helper = new FillRateHelper(getFrameMetrics); rowFramesGlobal = { header: {y: 0, height: 0, inLayout: true}, @@ -65,7 +65,7 @@ describe('computeBlankness', function() { expect(blankness).toBe(1); }); - it('skips frames that are not in layout', function() { + it('skips frames that are not in layout', function () { const helper = new FillRateHelper(getFrameMetrics); rowFramesGlobal = { header: {y: 0, height: 0, inLayout: false}, @@ -79,7 +79,7 @@ describe('computeBlankness', function() { expect(blankness).toBe(0.3); }); - it('sampling rate can disable', function() { + it('sampling rate can disable', function () { let helper = new FillRateHelper(getFrameMetrics); rowFramesGlobal = { header: {y: 0, height: 0, inLayout: true}, @@ -96,7 +96,7 @@ describe('computeBlankness', function() { expect(blankness).toBe(0); }); - it('can handle multiple listeners and unsubscribe', function() { + it('can handle multiple listeners and unsubscribe', function () { const listeners = [jest.fn(), jest.fn(), jest.fn()]; const subscriptions = listeners.map(listener => FillRateHelper.addListener(listener), diff --git a/Libraries/Lists/__tests__/FlatList-test.js b/Libraries/Lists/__tests__/FlatList-test.js index eb7e648d258e..d8b523fd2203 100644 --- a/Libraries/Lists/__tests__/FlatList-test.js +++ b/Libraries/Lists/__tests__/FlatList-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Lists/__tests__/SectionList-test.js b/Libraries/Lists/__tests__/SectionList-test.js index 8b414b64800c..34ee7e9a4f43 100644 --- a/Libraries/Lists/__tests__/SectionList-test.js +++ b/Libraries/Lists/__tests__/SectionList-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Lists/__tests__/ViewabilityHelper-test.js b/Libraries/Lists/__tests__/ViewabilityHelper-test.js index 6240824b68c0..3f0a1cedad5c 100644 --- a/Libraries/Lists/__tests__/ViewabilityHelper-test.js +++ b/Libraries/Lists/__tests__/ViewabilityHelper-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,8 +22,8 @@ function createViewToken(index: number, isViewable: boolean) { return {key: data[index].key, isViewable}; } -describe('computeViewableItems', function() { - it('returns all 4 entirely visible rows as viewable', function() { +describe('computeViewableItems', function () { + it('returns all 4 entirely visible rows as viewable', function () { const helper = new ViewabilityHelper({ viewAreaCoveragePercentThreshold: 50, }); @@ -39,7 +39,7 @@ describe('computeViewableItems', function() { ).toEqual([0, 1, 2, 3]); }); - it('returns top 2 rows as viewable (1. entirely visible and 2. majority)', function() { + it('returns top 2 rows as viewable (1. entirely visible and 2. majority)', function () { const helper = new ViewabilityHelper({ viewAreaCoveragePercentThreshold: 50, }); @@ -55,7 +55,7 @@ describe('computeViewableItems', function() { ).toEqual([0, 1]); }); - it('returns only 2nd row as viewable (majority)', function() { + it('returns only 2nd row as viewable (majority)', function () { const helper = new ViewabilityHelper({ viewAreaCoveragePercentThreshold: 50, }); @@ -71,7 +71,7 @@ describe('computeViewableItems', function() { ).toEqual([1]); }); - it('handles empty input', function() { + it('handles empty input', function () { const helper = new ViewabilityHelper({ viewAreaCoveragePercentThreshold: 50, }); @@ -82,7 +82,7 @@ describe('computeViewableItems', function() { ).toEqual([]); }); - it('handles different view area coverage percent thresholds', function() { + it('handles different view area coverage percent thresholds', function () { rowFrames = { a: {y: 0, height: 50}, b: {y: 50, height: 150}, @@ -128,7 +128,7 @@ describe('computeViewableItems', function() { ).toEqual([1, 2]); }); - it('handles different item visible percent thresholds', function() { + it('handles different item visible percent thresholds', function () { rowFrames = { a: {y: 0, height: 50}, b: {y: 50, height: 150}, @@ -165,8 +165,8 @@ describe('computeViewableItems', function() { }); }); -describe('onUpdate', function() { - it('returns 1 visible row as viewable then scrolls away', function() { +describe('onUpdate', function () { + it('returns 1 visible row as viewable then scrolls away', function () { const helper = new ViewabilityHelper(); rowFrames = { a: {y: 0, height: 50}, @@ -212,7 +212,7 @@ describe('onUpdate', function() { }); }); - it('returns 1st visible row then 1st and 2nd then just 2nd', function() { + it('returns 1st visible row then 1st and 2nd then just 2nd', function () { const helper = new ViewabilityHelper(); rowFrames = { a: {y: 0, height: 200}, @@ -268,7 +268,7 @@ describe('onUpdate', function() { }); }); - it('minimumViewTime delays callback', function() { + it('minimumViewTime delays callback', function () { const helper = new ViewabilityHelper({ minimumViewTime: 350, viewAreaCoveragePercentThreshold: 0, @@ -302,7 +302,7 @@ describe('onUpdate', function() { }); }); - it('minimumViewTime skips briefly visible items', function() { + it('minimumViewTime skips briefly visible items', function () { const helper = new ViewabilityHelper({ minimumViewTime: 350, viewAreaCoveragePercentThreshold: 0, @@ -343,7 +343,7 @@ describe('onUpdate', function() { }); }); - it('waitForInteraction blocks callback until interaction', function() { + it('waitForInteraction blocks callback until interaction', function () { const helper = new ViewabilityHelper({ waitForInteraction: true, viewAreaCoveragePercentThreshold: 0, @@ -385,7 +385,7 @@ describe('onUpdate', function() { }); }); - it('returns the right visible row after the underlying data changed', function() { + it('returns the right visible row after the underlying data changed', function () { const helper = new ViewabilityHelper(); rowFrames = { a: {y: 0, height: 200}, diff --git a/Libraries/Lists/__tests__/VirtualizeUtils-test.js b/Libraries/Lists/__tests__/VirtualizeUtils-test.js index 389f4f537583..88eb4f068c46 100644 --- a/Libraries/Lists/__tests__/VirtualizeUtils-test.js +++ b/Libraries/Lists/__tests__/VirtualizeUtils-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,35 +12,35 @@ import {elementsThatOverlapOffsets, newRangeCount} from '../VirtualizeUtils'; -describe('newRangeCount', function() { - it('handles subset', function() { +describe('newRangeCount', function () { + it('handles subset', function () { expect(newRangeCount({first: 1, last: 4}, {first: 2, last: 3})).toBe(0); }); - it('handles forward disjoint set', function() { + it('handles forward disjoint set', function () { expect(newRangeCount({first: 1, last: 4}, {first: 6, last: 9})).toBe(4); }); - it('handles reverse disjoint set', function() { + it('handles reverse disjoint set', function () { expect(newRangeCount({first: 6, last: 8}, {first: 1, last: 4})).toBe(4); }); - it('handles superset', function() { + it('handles superset', function () { expect(newRangeCount({first: 1, last: 4}, {first: 0, last: 5})).toBe(2); }); - it('handles end extension', function() { + it('handles end extension', function () { expect(newRangeCount({first: 1, last: 4}, {first: 1, last: 8})).toBe(4); }); - it('handles front extension', function() { + it('handles front extension', function () { expect(newRangeCount({first: 1, last: 4}, {first: 0, last: 4})).toBe(1); }); - it('handles forward intersect', function() { + it('handles forward intersect', function () { expect(newRangeCount({first: 1, last: 4}, {first: 3, last: 6})).toBe(2); }); - it('handles reverse intersect', function() { + it('handles reverse intersect', function () { expect(newRangeCount({first: 3, last: 6}, {first: 1, last: 4})).toBe(2); }); }); -describe('elementsThatOverlapOffsets', function() { - it('handles fixed length', function() { +describe('elementsThatOverlapOffsets', function () { + it('handles fixed length', function () { const offsets = [0, 250, 350, 450]; function getFrameMetrics(index: number) { return { @@ -49,13 +49,10 @@ describe('elementsThatOverlapOffsets', function() { }; } expect(elementsThatOverlapOffsets(offsets, 100, getFrameMetrics)).toEqual([ - 0, - 2, - 3, - 4, + 0, 2, 3, 4, ]); }); - it('handles variable length', function() { + it('handles variable length', function () { const offsets = [150, 250, 900]; const frames = [ {offset: 0, length: 50}, @@ -68,7 +65,7 @@ describe('elementsThatOverlapOffsets', function() { elementsThatOverlapOffsets(offsets, frames.length, ii => frames[ii]), ).toEqual([1, 1, 3]); }); - it('handles out of bounds', function() { + it('handles out of bounds', function () { const offsets = [150, 900]; const frames = [ {offset: 0, length: 50}, @@ -79,7 +76,7 @@ describe('elementsThatOverlapOffsets', function() { elementsThatOverlapOffsets(offsets, frames.length, ii => frames[ii]), ).toEqual([1]); }); - it('errors on non-increasing offsets', function() { + it('errors on non-increasing offsets', function () { const offsets = [150, 50]; const frames = [ {offset: 0, length: 50}, diff --git a/Libraries/Lists/__tests__/VirtualizedList-test.js b/Libraries/Lists/__tests__/VirtualizedList-test.js index 6fd9d915f479..1efb5e53fb38 100644 --- a/Libraries/Lists/__tests__/VirtualizedList-test.js +++ b/Libraries/Lists/__tests__/VirtualizedList-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -362,7 +362,7 @@ describe('VirtualizedList', () => { const layout = {width: 300, height: 600}; let data = Array(20) .fill() - .map((_, key) => ({key: String(key)})); + .map((_, index) => ({key: `key-${index}`})); const onEndReached = jest.fn(); const props = { data, diff --git a/Libraries/Lists/__tests__/VirtualizedSectionList-test.js b/Libraries/Lists/__tests__/VirtualizedSectionList-test.js index f4760ec5563f..dbba7f9b3eb7 100644 --- a/Libraries/Lists/__tests__/VirtualizedSectionList-test.js +++ b/Libraries/Lists/__tests__/VirtualizedSectionList-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -169,7 +169,9 @@ describe('VirtualizedSectionList', () => { describe('scrollToLocation', () => { const ITEM_HEIGHT = 100; - const createVirtualizedSectionList = props => { + const createVirtualizedSectionList = ( + props: void | $TEMPORARY$object<{stickySectionHeadersEnabled: boolean}>, + ) => { const component = ReactTestRenderer.create( ]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u; -const METRO_ERROR_FORMAT = /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u; +const BABEL_TRANSFORM_ERROR_FORMAT = + /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/; +const BABEL_CODE_FRAME_ERROR_FORMAT = + /^(?:TransformError )?(?:.*):? (?:.*?)(\/.*): ([\s\S]+?)\n([ >]{2}[\d\s]+ \|[\s\S]+|\u{001b}[\s\S]+)/u; +const METRO_ERROR_FORMAT = + /^(?:InternalError Metro has encountered an error:) (.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/u; export type ExtendedExceptionData = ExceptionData & { isComponentError: boolean, @@ -51,9 +54,7 @@ export type ComponentStack = $ReadOnlyArray; const SUBSTITUTION = UTFSequence.BOM + '%s'; -export function parseInterpolation( - args: $ReadOnlyArray, -): $ReadOnly<{| +export function parseInterpolation(args: $ReadOnlyArray): $ReadOnly<{| category: Category, message: Message, |}> { @@ -186,13 +187,8 @@ export function parseLogBoxException( const metroInternalError = message.match(METRO_ERROR_FORMAT); if (metroInternalError) { - const [ - content, - fileName, - row, - column, - codeFrame, - ] = metroInternalError.slice(1); + const [content, fileName, row, column, codeFrame] = + metroInternalError.slice(1); return { level: 'fatal', @@ -219,13 +215,8 @@ export function parseLogBoxException( const babelTransformError = message.match(BABEL_TRANSFORM_ERROR_FORMAT); if (babelTransformError) { // Transform errors are thrown from inside the Babel transformer. - const [ - fileName, - content, - row, - column, - codeFrame, - ] = babelTransformError.slice(1); + const [fileName, content, row, column, codeFrame] = + babelTransformError.slice(1); return { level: 'syntax', @@ -318,9 +309,7 @@ export function parseLogBoxException( }; } -export function parseLogBoxLog( - args: $ReadOnlyArray, -): {| +export function parseLogBoxLog(args: $ReadOnlyArray): {| componentStack: ComponentStack, category: Category, message: Message, diff --git a/Libraries/LogBox/LogBox.js b/Libraries/LogBox/LogBox.js index 23492d721656..c18fe6982898 100644 --- a/Libraries/LogBox/LogBox.js +++ b/Libraries/LogBox/LogBox.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -147,17 +147,17 @@ if (__DEV__) { }, }; - const isRCTLogAdviceWarning = (...args) => { + const isRCTLogAdviceWarning = (...args: Array) => { // RCTLogAdvice is a native logging function designed to show users // a message in the console, but not show it to them in Logbox. return typeof args[0] === 'string' && args[0].startsWith('(ADVICE)'); }; - const isWarningModuleWarning = (...args) => { + const isWarningModuleWarning = (...args: any) => { return typeof args[0] === 'string' && args[0].startsWith('Warning: '); }; - const registerWarning = (...args): void => { + const registerWarning = (...args: Array): void => { // Let warnings within LogBox itself fall through. if (LogBoxData.isLogBoxErrorMessage(String(args[0]))) { originalConsoleError(...args); diff --git a/Libraries/LogBox/LogBoxInspectorContainer.js b/Libraries/LogBox/LogBoxInspectorContainer.js index bb7fb4916cf6..c163ba773331 100644 --- a/Libraries/LogBox/LogBoxInspectorContainer.js +++ b/Libraries/LogBox/LogBoxInspectorContainer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/LogBoxNotificationContainer.js b/Libraries/LogBox/LogBoxNotificationContainer.js index 51f78fb72562..a1291e5f01ac 100644 --- a/Libraries/LogBox/LogBoxNotificationContainer.js +++ b/Libraries/LogBox/LogBoxNotificationContainer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/AnsiHighlight.js b/Libraries/LogBox/UI/AnsiHighlight.js index 101b14258264..aab1a5e39d64 100644 --- a/Libraries/LogBox/UI/AnsiHighlight.js +++ b/Libraries/LogBox/UI/AnsiHighlight.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,9 +9,8 @@ */ import {ansiToJson} from 'anser'; -import Text from '../../Text/Text'; -import View from '../../Components/View/View'; import * as React from 'react'; +import {StyleSheet, Text, View} from 'react-native'; import type {TextStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet'; @@ -77,9 +76,9 @@ export default function Ansi({ }; return ( - + {parsedLines.map((items, i) => ( - + {items.map((bundle, key) => { const textStyle = bundle.fg && COLORS[bundle.fg] @@ -101,3 +100,9 @@ export default function Ansi({ ); } + +const styles = StyleSheet.create({ + line: { + flexDirection: 'row', + }, +}); diff --git a/Libraries/LogBox/UI/LogBoxButton.js b/Libraries/LogBox/UI/LogBoxButton.js index 12f5845afc67..0f9f000fc6ea 100644 --- a/Libraries/LogBox/UI/LogBoxButton.js +++ b/Libraries/LogBox/UI/LogBoxButton.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/LogBoxInspector.js b/Libraries/LogBox/UI/LogBoxInspector.js index d67a25ee3f61..bfca9fedccb8 100644 --- a/Libraries/LogBox/UI/LogBoxInspector.js +++ b/Libraries/LogBox/UI/LogBoxInspector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -92,7 +92,9 @@ const headerTitleMap = { component: 'Render Error', }; -function LogBoxInspectorBody(props) { +function LogBoxInspectorBody( + props: $TEMPORARY$object<{log: LogBoxLog, onRetry: () => void}>, +) { const [collapsed, setCollapsed] = React.useState(true); React.useEffect(() => { diff --git a/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js b/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js index f9af7848e3cf..3eb16ecc20a0 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js +++ b/Libraries/LogBox/UI/LogBoxInspectorCodeFrame.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/LogBoxInspectorFooter.js b/Libraries/LogBox/UI/LogBoxInspectorFooter.js index fbb166823003..5e1d29e63e14 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorFooter.js +++ b/Libraries/LogBox/UI/LogBoxInspectorFooter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/LogBoxInspectorHeader.js b/Libraries/LogBox/UI/LogBoxInspectorHeader.js index 8ad4aa2d6f51..90c1332b54ac 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorHeader.js +++ b/Libraries/LogBox/UI/LogBoxInspectorHeader.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js b/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js index 5fde1f3d841d..e8797f9506a2 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js +++ b/Libraries/LogBox/UI/LogBoxInspectorMessageHeader.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js b/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js index dd47dda5ea01..2a3f8f5e703d 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js +++ b/Libraries/LogBox/UI/LogBoxInspectorReactFrames.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,7 +26,7 @@ type Props = $ReadOnly<{| const BEFORE_SLASH_RE = /^(.*)[\\/]/; // Taken from React https://github.com/facebook/react/blob/206d61f72214e8ae5b935f0bf8628491cb7f0797/packages/react-devtools-shared/src/backend/describeComponentFrame.js#L27-L41 -function getPrettyFileName(path) { +function getPrettyFileName(path: string) { let fileName = path.replace(BEFORE_SLASH_RE, ''); // In DEV, include code for a common special case: diff --git a/Libraries/LogBox/UI/LogBoxInspectorSection.js b/Libraries/LogBox/UI/LogBoxInspectorSection.js index 28c2b1e1d498..d8c0a9302830 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorSection.js +++ b/Libraries/LogBox/UI/LogBoxInspectorSection.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js b/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js index fd9ec23926b5..c0b5f5aff31d 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js +++ b/Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +36,6 @@ function LogBoxInspectorSourceMapStatus(props: Props): React.Node { const animation = Animated.loop( Animated.timing(animated, { duration: 2000, - // $FlowFixMe[method-unbinding] easing: Easing.linear, toValue: 1, useNativeDriver: true, diff --git a/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js b/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js index dc6208930b67..fd9d73736abd 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js +++ b/Libraries/LogBox/UI/LogBoxInspectorStackFrame.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -57,7 +57,7 @@ function LogBoxInspectorStackFrame(props: Props): React.Node { ); } -function getFileName(file) { +function getFileName(file: ?string) { if (file == null) { return ''; } diff --git a/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js b/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js index 9827a1c58b19..b1227d9a6836 100644 --- a/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js +++ b/Libraries/LogBox/UI/LogBoxInspectorStackFrames.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -132,7 +132,9 @@ function StackFrameList(props) { ); } -function StackFrameFooter(props) { +function StackFrameFooter( + props: $TEMPORARY$object<{message: string, onPress: () => void}>, +) { return ( +const cleanContent = (content: string) => content.replace(/^(TransformError |Warning: (Warning: )?|Error: )/g, ''); function LogBoxMessage(props: Props): React.Node { @@ -36,7 +36,11 @@ function LogBoxMessage(props: Props): React.Node { const substitutionStyle: TextStyleProp = props.style; const elements = []; let length = 0; - const createUnderLength = (key, message, style) => { + const createUnderLength = ( + key: string | $TEMPORARY$string<'-1'>, + message: string, + style: void | TextStyleProp, + ) => { let cleanMessage = cleanContent(message); if (props.maxLength != null) { diff --git a/Libraries/LogBox/UI/LogBoxNotification.js b/Libraries/LogBox/UI/LogBoxNotification.js index 81a0e2e130df..91376168ddb0 100644 --- a/Libraries/LogBox/UI/LogBoxNotification.js +++ b/Libraries/LogBox/UI/LogBoxNotification.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ * @format */ +import type {Message as MessageType} from '../Data/parseLogBoxLog'; import * as React from 'react'; import Image from '../../Image/Image'; import StyleSheet from '../../StyleSheet/StyleSheet'; @@ -54,7 +55,9 @@ function LogBoxLogNotification(props: Props): React.Node { ); } -function CountBadge(props) { +function CountBadge( + props: $TEMPORARY$object<{count: number, level: 'error' | 'warn'}>, +) { return ( {/* $FlowFixMe[incompatible-type] (>=0.114.0) This suppression was added @@ -69,7 +72,7 @@ function CountBadge(props) { ); } -function Message(props) { +function Message(props: $TEMPORARY$object<{message: MessageType}>) { return ( @@ -85,7 +88,7 @@ function Message(props) { ); } -function DismissButton(props) { +function DismissButton(props: $TEMPORARY$object<{onPress: () => void}>) { return ( { diff --git a/Libraries/LogBox/UI/__tests__/LogBoxInspectorReactFrames-test.js b/Libraries/LogBox/UI/__tests__/LogBoxInspectorReactFrames-test.js index 117fbafde0e3..15827401629a 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxInspectorReactFrames-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxInspectorReactFrames-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ 'use strict'; const React = require('react'); -const LogBoxInspectorReactFrames = require('../LogBoxInspectorReactFrames') - .default; +const LogBoxInspectorReactFrames = + require('../LogBoxInspectorReactFrames').default; const LogBoxLog = require('../../Data/LogBoxLog').default; const render = require('../../../../jest/renderer'); diff --git a/Libraries/LogBox/UI/__tests__/LogBoxInspectorSection-test.js b/Libraries/LogBox/UI/__tests__/LogBoxInspectorSection-test.js index 6d41ee7e2c83..b48f1785322d 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxInspectorSection-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxInspectorSection-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js b/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js index b44c4decf47e..51c32d2da11a 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxInspectorSourceMapStatus-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ 'use strict'; const React = require('react'); -const LogBoxInspectorSourceMapStatus = require('../LogBoxInspectorSourceMapStatus') - .default; +const LogBoxInspectorSourceMapStatus = + require('../LogBoxInspectorSourceMapStatus').default; const render = require('../../../../jest/renderer'); describe('LogBoxInspectorSourceMapStatus', () => { diff --git a/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrame-test.js b/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrame-test.js index b52175d54abc..e7d14ef0b0ac 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrame-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrame-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ 'use strict'; const React = require('react'); -const LogBoxInspectorStackFrame = require('../LogBoxInspectorStackFrame') - .default; +const LogBoxInspectorStackFrame = + require('../LogBoxInspectorStackFrame').default; const render = require('../../../../jest/renderer'); describe('LogBoxInspectorStackFrame', () => { diff --git a/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js b/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js index 8540f4543dce..d9ff74d83551 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxInspectorStackFrames-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/__tests__/LogBoxMessage-test.js b/Libraries/LogBox/UI/__tests__/LogBoxMessage-test.js index 342b308305b2..38f48e9a2292 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxMessage-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxMessage-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/UI/__tests__/LogBoxNotification-test.js b/Libraries/LogBox/UI/__tests__/LogBoxNotification-test.js index 1f056852f3b6..ed6954d25328 100644 --- a/Libraries/LogBox/UI/__tests__/LogBoxNotification-test.js +++ b/Libraries/LogBox/UI/__tests__/LogBoxNotification-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/__tests__/LogBox-integration-test.js b/Libraries/LogBox/__tests__/LogBox-integration-test.js index 22355633c8ea..ddaaffb0261f 100644 --- a/Libraries/LogBox/__tests__/LogBox-integration-test.js +++ b/Libraries/LogBox/__tests__/LogBox-integration-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/__tests__/LogBox-test.js b/Libraries/LogBox/__tests__/LogBox-test.js index 4c8144c7334c..6a41702ff1f8 100644 --- a/Libraries/LogBox/__tests__/LogBox-test.js +++ b/Libraries/LogBox/__tests__/LogBox-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,20 +30,20 @@ function mockFilterResult(returnValues) { } describe('LogBox', () => { - const {error, warn} = console; - let consoleError; - let consoleWarn; + const {error, log, warn} = console; beforeEach(() => { jest.resetModules(); - console.error = consoleError = jest.fn(); - console.warn = consoleWarn = jest.fn(); + console.error = jest.fn(); + console.log = jest.fn(); + console.warn = jest.fn(); console.disableYellowBox = false; }); afterEach(() => { LogBox.uninstall(); console.error = error; + console.log = log; console.warn = warn; }); @@ -329,6 +329,8 @@ describe('LogBox', () => { }); it('preserves decorations of console.error after installing/uninstalling', () => { + const consoleError = console.error; + LogBox.install(); const originalConsoleError = console.error; @@ -356,6 +358,8 @@ describe('LogBox', () => { }); it('preserves decorations of console.warn after installing/uninstalling', () => { + const consoleWarn = console.warn; + LogBox.install(); const originalConsoleWarn = console.warn; diff --git a/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js b/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js index f5ded6824207..2e87cbbb279e 100644 --- a/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js +++ b/Libraries/LogBox/__tests__/LogBoxInspectorContainer-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js b/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js index 5494ae1146b5..1354c00f8c86 100644 --- a/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js +++ b/Libraries/LogBox/__tests__/LogBoxNotificationContainer-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js b/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js index 2b6c1573e704..2cbc78487de7 100644 --- a/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js +++ b/Libraries/LogBox/__tests__/__fixtures__/ReactWarningFixtures.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Modal/Modal.js b/Libraries/Modal/Modal.js index 3c41898f5246..9140a56dbe3c 100644 --- a/Libraries/Modal/Modal.js +++ b/Libraries/Modal/Modal.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -44,7 +44,7 @@ const ModalEventEmitter = /** * The Modal component is a simple way to present content above an enclosing view. * - * See https://reactnative.dev/docs/modal.html + * See https://reactnative.dev/docs/modal */ // In order to route onDismiss callbacks, we need to uniquely identifier each @@ -63,14 +63,14 @@ export type Props = $ReadOnly<{| /** * The `animationType` prop controls how the modal animates. * - * See https://reactnative.dev/docs/modal.html#animationtype + * See https://reactnative.dev/docs/modal#animationtype */ animationType?: ?('none' | 'slide' | 'fade'), /** * The `presentationStyle` prop controls how the modal appears. * - * See https://reactnative.dev/docs/modal.html#presentationstyle + * See https://reactnative.dev/docs/modal#presentationstyle */ presentationStyle?: ?( | 'fullScreen' @@ -83,7 +83,7 @@ export type Props = $ReadOnly<{| * The `transparent` prop determines whether your modal will fill the * entire view. * - * See https://reactnative.dev/docs/modal.html#transparent + * See https://reactnative.dev/docs/modal#transparent */ transparent?: ?boolean, @@ -91,7 +91,7 @@ export type Props = $ReadOnly<{| * The `statusBarTranslucent` prop determines whether your modal should go under * the system statusbar. * - * See https://reactnative.dev/docs/modal.html#transparent + * See https://reactnative.dev/docs/modal#transparent */ statusBarTranslucent?: ?boolean, @@ -101,14 +101,14 @@ export type Props = $ReadOnly<{| * * This prop works only on Android. * - * See https://reactnative.dev/docs/modal.html#hardwareaccelerated + * See https://reactnative.dev/docs/modal#hardwareaccelerated */ hardwareAccelerated?: ?boolean, /** * The `visible` prop determines whether your modal is visible. * - * See https://reactnative.dev/docs/modal.html#visible + * See https://reactnative.dev/docs/modal#visible */ visible?: ?boolean, @@ -118,7 +118,7 @@ export type Props = $ReadOnly<{| * * This is required on Apple TV and Android. * - * See https://reactnative.dev/docs/modal.html#onrequestclose + * See https://reactnative.dev/docs/modal#onrequestclose */ onRequestClose?: ?DirectEventHandler, @@ -126,7 +126,7 @@ export type Props = $ReadOnly<{| * The `onShow` prop allows passing a function that will be called once the * modal has been shown. * - * See https://reactnative.dev/docs/modal.html#onshow + * See https://reactnative.dev/docs/modal#onshow */ onShow?: ?DirectEventHandler, @@ -134,14 +134,14 @@ export type Props = $ReadOnly<{| * The `onDismiss` prop allows passing a function that will be called once * the modal has been dismissed. * - * See https://reactnative.dev/docs/modal.html#ondismiss + * See https://reactnative.dev/docs/modal#ondismiss */ onDismiss?: ?() => mixed, /** * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. * - * See https://reactnative.dev/docs/modal.html#supportedorientations + * See https://reactnative.dev/docs/modal#supportedorientations */ supportedOrientations?: ?$ReadOnlyArray< | 'portrait' @@ -154,7 +154,7 @@ export type Props = $ReadOnly<{| /** * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed. * - * See https://reactnative.dev/docs/modal.html#onorientationchange + * See https://reactnative.dev/docs/modal#onorientationchange */ onOrientationChange?: ?DirectEventHandler, |}>; @@ -264,7 +264,8 @@ class Modal extends React.Component { // $FlowFixMe[method-unbinding] added when improving typing for this parameters onStartShouldSetResponder={this._shouldSetResponder} supportedOrientations={this.props.supportedOrientations} - onOrientationChange={this.props.onOrientationChange}> + onOrientationChange={this.props.onOrientationChange} + testID={this.props.testID}> , /** * The `presentationStyle` prop controls how the modal appears. * - * See https://reactnative.dev/docs/modal.html#presentationstyle + * See https://reactnative.dev/docs/modal#presentationstyle */ presentationStyle?: WithDefault< 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen', @@ -46,7 +46,7 @@ type NativeProps = $ReadOnly<{| * The `transparent` prop determines whether your modal will fill the * entire view. * - * See https://reactnative.dev/docs/modal.html#transparent + * See https://reactnative.dev/docs/modal#transparent */ transparent?: WithDefault, @@ -54,7 +54,7 @@ type NativeProps = $ReadOnly<{| * The `statusBarTranslucent` prop determines whether your modal should go under * the system statusbar. * - * See https://reactnative.dev/docs/modal.html#statusBarTranslucent + * See https://reactnative.dev/docs/modal#statusBarTranslucent */ statusBarTranslucent?: WithDefault, @@ -62,7 +62,7 @@ type NativeProps = $ReadOnly<{| * The `hardwareAccelerated` prop controls whether to force hardware * acceleration for the underlying window. * - * See https://reactnative.dev/docs/modal.html#hardwareaccelerated + * See https://reactnative.dev/docs/modal#hardwareaccelerated */ hardwareAccelerated?: WithDefault, @@ -72,7 +72,7 @@ type NativeProps = $ReadOnly<{| * * This is required on Apple TV and Android. * - * See https://reactnative.dev/docs/modal.html#onrequestclose + * See https://reactnative.dev/docs/modal#onrequestclose */ onRequestClose?: ?DirectEventHandler, @@ -80,7 +80,7 @@ type NativeProps = $ReadOnly<{| * The `onShow` prop allows passing a function that will be called once the * modal has been shown. * - * See https://reactnative.dev/docs/modal.html#onshow + * See https://reactnative.dev/docs/modal#onshow */ onShow?: ?DirectEventHandler, @@ -88,14 +88,14 @@ type NativeProps = $ReadOnly<{| * The `onDismiss` prop allows passing a function that will be called once * the modal has been dismissed. * - * See https://reactnative.dev/docs/modal.html#ondismiss + * See https://reactnative.dev/docs/modal#ondismiss */ onDismiss?: ?DirectEventHandler, /** * The `visible` prop determines whether your modal is visible. * - * See https://reactnative.dev/docs/modal.html#visible + * See https://reactnative.dev/docs/modal#visible */ visible?: WithDefault, @@ -107,7 +107,7 @@ type NativeProps = $ReadOnly<{| /** * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations. * - * See https://reactnative.dev/docs/modal.html#supportedorientations + * See https://reactnative.dev/docs/modal#supportedorientations */ supportedOrientations?: WithDefault< $ReadOnlyArray< @@ -123,7 +123,7 @@ type NativeProps = $ReadOnly<{| /** * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed. * - * See https://reactnative.dev/docs/modal.html#onorientationchange + * See https://reactnative.dev/docs/modal#onorientationchange */ onOrientationChange?: ?DirectEventHandler, diff --git a/Libraries/Modal/__tests__/Modal-test.js b/Libraries/Modal/__tests__/Modal-test.js index 7c27e70b200a..7496be95c862 100644 --- a/Libraries/Modal/__tests__/Modal-test.js +++ b/Libraries/Modal/__tests__/Modal-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTAnimationDriver.h b/Libraries/NativeAnimation/Drivers/RCTAnimationDriver.h index 256464bd9653..2782c2abb70a 100644 --- a/Libraries/NativeAnimation/Drivers/RCTAnimationDriver.h +++ b/Libraries/NativeAnimation/Drivers/RCTAnimationDriver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.h b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.h index e68450ec65c5..f9aba7d53b68 100644 --- a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.h +++ b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m index 167b245708df..4ead00762709 100644 --- a/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTDecayAnimation.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTEventAnimation.h b/Libraries/NativeAnimation/Drivers/RCTEventAnimation.h index c63c1f4c643c..3791ba5a0aff 100644 --- a/Libraries/NativeAnimation/Drivers/RCTEventAnimation.h +++ b/Libraries/NativeAnimation/Drivers/RCTEventAnimation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m b/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m index 270cf317eb9b..35b96a8128b0 100644 --- a/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTEventAnimation.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.h b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.h index 610d3ff00a23..1ce3c83ef1ef 100644 --- a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.h +++ b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m index e128cf643a86..92b3f8e2afa5 100644 --- a/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.h b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.h index 0c031ecac876..bb7554c1039b 100644 --- a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.h +++ b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m index 2a99acacb984..8292ea41fee4 100644 --- a/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m +++ b/Libraries/NativeAnimation/Drivers/RCTSpringAnimation.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h index 50f3bc1ac298..53c91baa3557 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m index 9f8d1258dc26..e6088bbe4946 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTAdditionAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h index 24c0fb381548..a6308ee542be 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m index 997e3156e5e3..7641c539068a 100644 --- a/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h index 085fb3d6d855..82144af06af7 100644 --- a/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m index 1a99e29a6d9c..4d226f19886a 100644 --- a/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTDiffClampAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h index 006fd5aaa370..6909be3b6cf1 100644 --- a/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m index 08bbc523b451..4517ea46fd4f 100644 --- a/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTDivisionAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h index 8ec41017f64e..2ac165013dc0 100644 --- a/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m index b5bb0972fdfb..82b94b9ca5c4 100644 --- a/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTInterpolationAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.h index fc7f69dbf033..6396edafb77f 100644 --- a/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m index f1fca3c7df05..a0b02372a032 100644 --- a/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTModuloAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h index bb8b3b2477ae..44e7fb7b73b0 100644 --- a/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m index 9f72d75e03f5..4f7220ebff6b 100644 --- a/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTMultiplicationAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.h index 0b5f5329419c..8c11a438eb72 100644 --- a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m index 91acd7dcbaed..aac71b01efaf 100644 --- a/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTPropsAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.h index cdcaca45fe93..ec4e92d59095 100644 --- a/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m index 1e42c04b286e..c6710d0582ea 100644 --- a/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTStyleAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h index e8ec7991fdd8..043b7c8674b7 100644 --- a/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m index af625d885264..3ddcf34d3f99 100644 --- a/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTSubtractionAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h index 27d61faedf4c..0703c450fcd6 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m index 799e976fe928..b55f6bb38f54 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTTrackingAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.h index fe16bd271331..3d8680850d7d 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m index e1abefe070d3..dd2fd2cfad84 100644 --- a/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTTransformAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h index a388d00a44c0..ccc33462c0a8 100644 --- a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h +++ b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m index 8442b3264232..df1f5866bb88 100644 --- a/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m +++ b/Libraries/NativeAnimation/Nodes/RCTValueAnimatedNode.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTAnimationPlugins.h b/Libraries/NativeAnimation/RCTAnimationPlugins.h index 406eb68b38dc..37e3cc8643c7 100644 --- a/Libraries/NativeAnimation/RCTAnimationPlugins.h +++ b/Libraries/NativeAnimation/RCTAnimationPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTAnimationPlugins.mm b/Libraries/NativeAnimation/RCTAnimationPlugins.mm index b0eecfc9b882..a7fed6bb7efb 100644 --- a/Libraries/NativeAnimation/RCTAnimationPlugins.mm +++ b/Libraries/NativeAnimation/RCTAnimationPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTAnimationUtils.h b/Libraries/NativeAnimation/RCTAnimationUtils.h index 1f1afa9d24b8..cc8c8faa9fe8 100644 --- a/Libraries/NativeAnimation/RCTAnimationUtils.h +++ b/Libraries/NativeAnimation/RCTAnimationUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTAnimationUtils.m b/Libraries/NativeAnimation/RCTAnimationUtils.m index 751497805a0c..f095a520cf88 100644 --- a/Libraries/NativeAnimation/RCTAnimationUtils.m +++ b/Libraries/NativeAnimation/RCTAnimationUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedModule.h b/Libraries/NativeAnimation/RCTNativeAnimatedModule.h index 13b40fd8ae22..f573e859586d 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedModule.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm b/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm index 90eb5ae29e9e..534587b876ff 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm +++ b/Libraries/NativeAnimation/RCTNativeAnimatedModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h index 78325388a60d..fe88f55c8f2b 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,82 +13,86 @@ @protocol RCTValueAnimatedNodeObserver; +NS_ASSUME_NONNULL_BEGIN + @interface RCTNativeAnimatedNodesManager : NSObject -- (nonnull instancetype)initWithBridge:(RCTBridge *)bridge +- (nonnull instancetype)initWithBridge:(nullable RCTBridge *)bridge surfacePresenter:(id)surfacePresenter; - (void)updateAnimations; -- (void)stepAnimations:(nonnull CADisplayLink *)displaylink; +- (void)stepAnimations:(CADisplayLink *)displaylink; -- (BOOL)isNodeManagedByFabric:(nonnull NSNumber *)tag; +- (BOOL)isNodeManagedByFabric:(NSNumber *)tag; -- (void)getValue:(nonnull NSNumber *)nodeTag - saveCallback:(nullable RCTResponseSenderBlock)saveCallback; +- (void)getValue:(NSNumber *)nodeTag + saveCallback:(RCTResponseSenderBlock)saveCallback; // graph -- (void)createAnimatedNode:(nonnull NSNumber *)tag - config:(NSDictionary *__nonnull)config; +- (void)createAnimatedNode:(NSNumber *)tag + config:(NSDictionary *)config; -- (void)connectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag; +- (void)connectAnimatedNodes:(NSNumber *)parentTag + childTag:(NSNumber *)childTag; -- (void)disconnectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag; +- (void)disconnectAnimatedNodes:(NSNumber *)parentTag + childTag:(NSNumber *)childTag; -- (void)connectAnimatedNodeToView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag - viewName:(nonnull NSString *)viewName; +- (void)connectAnimatedNodeToView:(NSNumber *)nodeTag + viewTag:(NSNumber *)viewTag + viewName:(nullable NSString *)viewName; -- (void)restoreDefaultValues:(nonnull NSNumber *)nodeTag; +- (void)restoreDefaultValues:(NSNumber *)nodeTag; -- (void)disconnectAnimatedNodeFromView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag; +- (void)disconnectAnimatedNodeFromView:(NSNumber *)nodeTag + viewTag:(NSNumber *)viewTag; -- (void)dropAnimatedNode:(nonnull NSNumber *)tag; +- (void)dropAnimatedNode:(NSNumber *)tag; // mutations -- (void)setAnimatedNodeValue:(nonnull NSNumber *)nodeTag - value:(nonnull NSNumber *)value; +- (void)setAnimatedNodeValue:(NSNumber *)nodeTag + value:(NSNumber *)value; -- (void)setAnimatedNodeOffset:(nonnull NSNumber *)nodeTag - offset:(nonnull NSNumber *)offset; +- (void)setAnimatedNodeOffset:(NSNumber *)nodeTag + offset:(NSNumber *)offset; -- (void)flattenAnimatedNodeOffset:(nonnull NSNumber *)nodeTag; +- (void)flattenAnimatedNodeOffset:(NSNumber *)nodeTag; -- (void)extractAnimatedNodeOffset:(nonnull NSNumber *)nodeTag; +- (void)extractAnimatedNodeOffset:(NSNumber *)nodeTag; // drivers -- (void)startAnimatingNode:(nonnull NSNumber *)animationId - nodeTag:(nonnull NSNumber *)nodeTag - config:(NSDictionary *__nonnull)config +- (void)startAnimatingNode:(NSNumber *)animationId + nodeTag:(NSNumber *)nodeTag + config:(NSDictionary *)config endCallback:(nullable RCTResponseSenderBlock)callBack; -- (void)stopAnimation:(nonnull NSNumber *)animationId; +- (void)stopAnimation:(NSNumber *)animationId; - (void)stopAnimationLoop; // events -- (void)addAnimatedEventToView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - eventMapping:(NSDictionary *__nonnull)eventMapping; +- (void)addAnimatedEventToView:(NSNumber *)viewTag + eventName:(NSString *)eventName + eventMapping:(NSDictionary *)eventMapping; -- (void)removeAnimatedEventFromView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - animatedNodeTag:(nonnull NSNumber *)animatedNodeTag; +- (void)removeAnimatedEventFromView:(NSNumber *)viewTag + eventName:(NSString *)eventName + animatedNodeTag:(NSNumber *)animatedNodeTag; -- (void)handleAnimatedEvent:(nonnull id)event; +- (void)handleAnimatedEvent:(id)event; // listeners -- (void)startListeningToAnimatedNodeValue:(nonnull NSNumber *)tag - valueObserver:(nonnull id)valueObserver; +- (void)startListeningToAnimatedNodeValue:(NSNumber *)tag + valueObserver:(id)valueObserver; -- (void)stopListeningToAnimatedNodeValue:(nonnull NSNumber *)tag; +- (void)stopListeningToAnimatedNodeValue:(NSNumber *)tag; @end + +NS_ASSUME_NONNULL_END diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m index e7fb791193b6..8cbf79f14834 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m +++ b/Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -55,7 +55,7 @@ @implementation RCTNativeAnimatedNodesManager CADisplayLink *_displayLink; } -- (instancetype)initWithBridge:(RCTBridge *)bridge surfacePresenter:(id)surfacePresenter; +- (instancetype)initWithBridge:(nullable RCTBridge *)bridge surfacePresenter:(id)surfacePresenter; { if ((self = [super init])) { _bridge = bridge; @@ -67,7 +67,7 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge surfacePresenter:(id *)config { static NSDictionary *map; @@ -112,8 +112,8 @@ - (void)createAnimatedNode:(nonnull NSNumber *)tag [node setNeedsUpdate]; } -- (void)connectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag +- (void)connectAnimatedNodes:(NSNumber *)parentTag + childTag:(NSNumber *)childTag { RCTAssertParam(parentTag); RCTAssertParam(childTag); @@ -128,8 +128,8 @@ - (void)connectAnimatedNodes:(nonnull NSNumber *)parentTag [childNode setNeedsUpdate]; } -- (void)disconnectAnimatedNodes:(nonnull NSNumber *)parentTag - childTag:(nonnull NSNumber *)childTag +- (void)disconnectAnimatedNodes:(NSNumber *)parentTag + childTag:(NSNumber *)childTag { RCTAssertParam(parentTag); RCTAssertParam(childTag); @@ -144,12 +144,13 @@ - (void)disconnectAnimatedNodes:(nonnull NSNumber *)parentTag [childNode setNeedsUpdate]; } -- (void)connectAnimatedNodeToView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag - viewName:(nonnull NSString *)viewName +- (void)connectAnimatedNodeToView:(NSNumber *)nodeTag + viewTag:(NSNumber *)viewTag + viewName:(nullable NSString *)viewName { RCTAnimatedNode *node = _animationNodes[nodeTag]; if ([node isKindOfClass:[RCTPropsAnimatedNode class]]) { + // viewName is not used when node is managed by Fabric [(RCTPropsAnimatedNode *)node connectToView:viewTag viewName:viewName bridge:_bridge @@ -158,8 +159,8 @@ - (void)connectAnimatedNodeToView:(nonnull NSNumber *)nodeTag [node setNeedsUpdate]; } -- (void)disconnectAnimatedNodeFromView:(nonnull NSNumber *)nodeTag - viewTag:(nonnull NSNumber *)viewTag +- (void)disconnectAnimatedNodeFromView:(NSNumber *)nodeTag + viewTag:(NSNumber *)viewTag { RCTAnimatedNode *node = _animationNodes[nodeTag]; if ([node isKindOfClass:[RCTPropsAnimatedNode class]]) { @@ -167,7 +168,7 @@ - (void)disconnectAnimatedNodeFromView:(nonnull NSNumber *)nodeTag } } -- (void)restoreDefaultValues:(nonnull NSNumber *)nodeTag +- (void)restoreDefaultValues:(NSNumber *)nodeTag { RCTAnimatedNode *node = _animationNodes[nodeTag]; // Restoring default values needs to happen before UIManager operations so it is @@ -183,7 +184,7 @@ - (void)restoreDefaultValues:(nonnull NSNumber *)nodeTag [(RCTPropsAnimatedNode *)node restoreDefaultValues]; } -- (void)dropAnimatedNode:(nonnull NSNumber *)tag +- (void)dropAnimatedNode:(NSNumber *)tag { RCTAnimatedNode *node = _animationNodes[tag]; if (node) { @@ -194,8 +195,8 @@ - (void)dropAnimatedNode:(nonnull NSNumber *)tag #pragma mark -- Mutations -- (void)setAnimatedNodeValue:(nonnull NSNumber *)nodeTag - value:(nonnull NSNumber *)value +- (void)setAnimatedNodeValue:(NSNumber *)nodeTag + value:(NSNumber *)value { RCTAnimatedNode *node = _animationNodes[nodeTag]; if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { @@ -209,8 +210,8 @@ - (void)setAnimatedNodeValue:(nonnull NSNumber *)nodeTag [valueNode setNeedsUpdate]; } -- (void)setAnimatedNodeOffset:(nonnull NSNumber *)nodeTag - offset:(nonnull NSNumber *)offset +- (void)setAnimatedNodeOffset:(NSNumber *)nodeTag + offset:(NSNumber *)offset { RCTAnimatedNode *node = _animationNodes[nodeTag]; if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { @@ -223,7 +224,7 @@ - (void)setAnimatedNodeOffset:(nonnull NSNumber *)nodeTag [valueNode setNeedsUpdate]; } -- (void)flattenAnimatedNodeOffset:(nonnull NSNumber *)nodeTag +- (void)flattenAnimatedNodeOffset:(NSNumber *)nodeTag { RCTAnimatedNode *node = _animationNodes[nodeTag]; if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { @@ -235,7 +236,7 @@ - (void)flattenAnimatedNodeOffset:(nonnull NSNumber *)nodeTag [valueNode flattenOffset]; } -- (void)extractAnimatedNodeOffset:(nonnull NSNumber *)nodeTag +- (void)extractAnimatedNodeOffset:(NSNumber *)nodeTag { RCTAnimatedNode *node = _animationNodes[nodeTag]; if (![node isKindOfClass:[RCTValueAnimatedNode class]]) { @@ -260,10 +261,10 @@ - (void)getValue:(NSNumber *)nodeTag saveCallback:(RCTResponseSenderBlock)saveCa #pragma mark -- Drivers -- (void)startAnimatingNode:(nonnull NSNumber *)animationId - nodeTag:(nonnull NSNumber *)nodeTag +- (void)startAnimatingNode:(NSNumber *)animationId + nodeTag:(NSNumber *)nodeTag config:(NSDictionary *)config - endCallback:(RCTResponseSenderBlock)callBack + endCallback:(nullable RCTResponseSenderBlock)callBack { // check if the animation has already started for (id driver in _activeAnimations) { @@ -306,7 +307,7 @@ - (void)startAnimatingNode:(nonnull NSNumber *)animationId [self startAnimationLoopIfNeeded]; } -- (void)stopAnimation:(nonnull NSNumber *)animationId +- (void)stopAnimation:(NSNumber *)animationId { for (id driver in _activeAnimations) { if ([driver.animationId isEqual:animationId]) { @@ -317,7 +318,7 @@ - (void)stopAnimation:(nonnull NSNumber *)animationId } } -- (void)stopAnimationsForNode:(nonnull RCTAnimatedNode *)node +- (void)stopAnimationsForNode:(RCTAnimatedNode *)node { NSMutableArray> *discarded = [NSMutableArray new]; for (id driver in _activeAnimations) { @@ -333,8 +334,8 @@ - (void)stopAnimationsForNode:(nonnull RCTAnimatedNode *)node #pragma mark -- Events -- (void)addAnimatedEventToView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName +- (void)addAnimatedEventToView:(NSNumber *)viewTag + eventName:(NSString *)eventName eventMapping:(NSDictionary *)eventMapping { NSNumber *nodeTag = [RCTConvert NSNumber:eventMapping[@"animatedValueTag"]]; @@ -365,9 +366,9 @@ - (void)addAnimatedEventToView:(nonnull NSNumber *)viewTag } } -- (void)removeAnimatedEventFromView:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - animatedNodeTag:(nonnull NSNumber *)animatedNodeTag +- (void)removeAnimatedEventFromView:(NSNumber *)viewTag + eventName:(NSString *)eventName + animatedNodeTag:(NSNumber *)animatedNodeTag { NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, RCTNormalizeAnimatedEventName(eventName)]; if (_eventDrivers[key] != nil) { @@ -405,7 +406,7 @@ - (void)handleAnimatedEvent:(id)event #pragma mark -- Listeners -- (void)startListeningToAnimatedNodeValue:(nonnull NSNumber *)tag +- (void)startListeningToAnimatedNodeValue:(NSNumber *)tag valueObserver:(id)valueObserver { RCTAnimatedNode *node = _animationNodes[tag]; @@ -414,7 +415,7 @@ - (void)startListeningToAnimatedNodeValue:(nonnull NSNumber *)tag } } -- (void)stopListeningToAnimatedNodeValue:(nonnull NSNumber *)tag +- (void)stopListeningToAnimatedNodeValue:(NSNumber *)tag { RCTAnimatedNode *node = _animationNodes[tag]; if ([node isKindOfClass:[RCTValueAnimatedNode class]]) { diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h index 2da04a1277eb..7c4dc64a19e9 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h +++ b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,8 +9,6 @@ #import #import #import -#import -#import #import #import "RCTValueAnimatedNode.h" @@ -18,6 +16,6 @@ // TODO T69437152 @petetheheat - Delete this fork when Fabric ships to 100%. // NOTE: This module is temporarily forked (see RCTNativeAnimatedModule). // When making any changes, be sure to apply them to the fork as well. -@interface RCTNativeAnimatedTurboModule: RCTEventEmitter +@interface RCTNativeAnimatedTurboModule: RCTEventEmitter @end diff --git a/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm index 0964e23a0fa6..e627475bb656 100644 --- a/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm +++ b/Libraries/NativeAnimation/RCTNativeAnimatedTurboModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,7 +29,6 @@ @implementation RCTNativeAnimatedTurboModule NSMutableDictionary *_animIdIsManagedByFabric; // A set of nodeIDs managed by Fabric. NSMutableSet *_nodeIDsManagedByFabric; - } RCT_EXPORT_MODULE(); @@ -52,15 +51,8 @@ - (instancetype)init - (void)initialize { - if (self.bridge) { - _surfacePresenter = self.bridge.surfacePresenter; - _nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:self.bridge surfacePresenter:_surfacePresenter]; - [self.bridge.uiManager.observerCoordinator addObserver:self]; - } else { - // _surfacePresenter set in setSurfacePresenter: - _nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:nil surfacePresenter:_surfacePresenter]; - } - + // _surfacePresenter set in setSurfacePresenter: + _nodesManager = [[RCTNativeAnimatedNodesManager alloc] initWithBridge:nil surfacePresenter:_surfacePresenter]; [_surfacePresenter addObserver:self]; [[self.moduleRegistry moduleForName:"EventDispatcher"] addDispatchObserver:self]; } @@ -70,7 +62,6 @@ - (void)invalidate [super invalidate]; [_nodesManager stopAnimationLoop]; [[self.moduleRegistry moduleForName:"EventDispatcher"] removeDispatchObserver:self]; - [self.bridge.uiManager.observerCoordinator removeObserver:self]; [_surfacePresenter removeObserver:self]; } @@ -162,6 +153,10 @@ - (void)setSurfacePresenter:(id)surfacePresenter [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { [nodesManager setAnimatedNodeValue:[NSNumber numberWithDouble:nodeTag] value:[NSNumber numberWithDouble:value]]; }]; + // In Bridge, flushing of native animations is done from RCTCxxBridge batchDidComplete(). + // Since RCTCxxBridge doesn't exist in Bridgeless, and components are not remounted in Fabric for native animations, + // flush here for changes in Animated.Value for Animated.event. + [self flushOperationQueues]; } RCT_EXPORT_METHOD(setAnimatedNodeOffset:(double)nodeTag @@ -192,9 +187,9 @@ - (void)setSurfacePresenter:(id)surfacePresenter if (RCTUIManagerTypeForTagIsFabric(@(viewTag))) { [_nodeIDsManagedByFabric addObject:@(nodeTag)]; } - NSString *viewName = [self.bridge.uiManager viewNameForReactTag:[NSNumber numberWithDouble:viewTag]]; [self addOperationBlock:^(RCTNativeAnimatedNodesManager *nodesManager) { - [nodesManager connectAnimatedNodeToView:[NSNumber numberWithDouble:nodeTag] viewTag:[NSNumber numberWithDouble:viewTag] viewName:viewName]; + // viewName is not used when node is managed by Fabric, and nodes are always managed by Fabric in Bridgeless. + [nodesManager connectAnimatedNodeToView:[NSNumber numberWithDouble:nodeTag] viewTag:[NSNumber numberWithDouble:viewTag] viewName:nil]; }]; } @@ -332,33 +327,6 @@ - (void)didMountComponentsWithRootTag:(NSInteger)rootTag }); } -#pragma mark - RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting:(RCTUIManager *)uiManager -{ - if (_preOperations.count == 0 && _operations.count == 0) { - return; - } - - NSArray *preOperations = _preOperations; - NSArray *operations = _operations; - _preOperations = [NSMutableArray new]; - _operations = [NSMutableArray new]; - - [uiManager prependUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (AnimatedOperation operation in preOperations) { - operation(self->_nodesManager); - } - }]; - [uiManager addUIBlock:^(__unused RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (AnimatedOperation operation in operations) { - operation(self->_nodesManager); - } - - [self->_nodesManager updateAnimations]; - }]; -} - #pragma mark -- Events - (NSArray *)supportedEvents diff --git a/Libraries/NativeAnimation/React-RCTAnimation.podspec b/Libraries/NativeAnimation/React-RCTAnimation.podspec index 1aa5ae78a8aa..b97c4c841c3b 100644 --- a/Libraries/NativeAnimation/React-RCTAnimation.podspec +++ b/Libraries/NativeAnimation/React-RCTAnimation.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -35,11 +35,11 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.dependency "RCT-Folly", folly_version - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version diff --git a/Libraries/NativeComponent/NativeComponentRegistry.js b/Libraries/NativeComponent/NativeComponentRegistry.js index 0dce50704b55..e56021877f0e 100644 --- a/Libraries/NativeComponent/NativeComponentRegistry.js +++ b/Libraries/NativeComponent/NativeComponentRegistry.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ * @format */ +import * as StaticViewConfigValidator from './StaticViewConfigValidator'; import {createViewConfig} from './ViewConfig'; import UIManager from '../ReactNative/UIManager'; import type { @@ -32,10 +33,9 @@ let componentNameToExists: Map = new Map(); * the current environment. */ export function setRuntimeConfigProvider( - runtimeConfigProvider: ( - name: string, - ) => ?{ + runtimeConfigProvider: (name: string) => ?{ native: boolean, + strict: boolean, verify: boolean, }, ): void { @@ -57,8 +57,9 @@ export function get( viewConfigProvider: () => PartialViewConfig, ): HostComponent { ReactNativeViewConfigRegistry.register(name, () => { - const {native, verify} = getRuntimeConfig?.(name) ?? { + const {native, strict, verify} = getRuntimeConfig?.(name) ?? { native: true, + strict: false, verify: false, }; @@ -67,16 +68,30 @@ export function get( : createViewConfig(viewConfigProvider()); if (verify) { - if (native) { - verifyComponentAttributeEquivalence( - viewConfig, - createViewConfig(viewConfigProvider()), + const nativeViewConfig = native + ? viewConfig + : getNativeComponentAttributes(name); + const staticViewConfig = native + ? createViewConfig(viewConfigProvider()) + : viewConfig; + + if (strict) { + const validationOutput = StaticViewConfigValidator.validate( + name, + nativeViewConfig, + staticViewConfig, ); + + if (validationOutput.type === 'invalid') { + console.error( + StaticViewConfigValidator.stringifyValidationResult( + name, + validationOutput, + ), + ); + } } else { - verifyComponentAttributeEquivalence( - getNativeComponentAttributes(name), - viewConfig, - ); + verifyComponentAttributeEquivalence(nativeViewConfig, staticViewConfig); } } @@ -101,6 +116,7 @@ export function getWithFallback_DEPRECATED( viewConfigProvider: () => PartialViewConfig, ): React.AbstractComponent { if (getRuntimeConfig == null) { + // `getRuntimeConfig == null` when static view configs are disabled // If `setRuntimeConfigProvider` is not configured, use native reflection. if (hasNativeViewConfig(name)) { return get(name, viewConfigProvider); @@ -112,7 +128,7 @@ export function getWithFallback_DEPRECATED( } } - const FallbackNativeComponent = function(props: Config): React.Node { + const FallbackNativeComponent = function (props: Config): React.Node { return null; }; FallbackNativeComponent.displayName = `Fallback(${name})`; @@ -136,22 +152,3 @@ export function unstable_hasStaticViewConfig(name: string): boolean { }; return !native; } - -/** - * Unstable API. Do not use! - * - * This method returns if the component with name received as a parameter - * is registed in the native platform. - */ -export function unstable_hasComponent(name: string): boolean { - let hasNativeComponent = componentNameToExists.get(name); - if (hasNativeComponent == null) { - if (global.__nativeComponentRegistry__hasComponent) { - hasNativeComponent = global.__nativeComponentRegistry__hasComponent(name); - componentNameToExists.set(name, hasNativeComponent); - } else { - throw `unstable_hasComponent('${name}'): Global function is not registered`; - } - } - return hasNativeComponent; -} diff --git a/Libraries/NativeComponent/NativeComponentRegistryUnstable.js b/Libraries/NativeComponent/NativeComponentRegistryUnstable.js new file mode 100644 index 000000000000..cebacfc033b7 --- /dev/null +++ b/Libraries/NativeComponent/NativeComponentRegistryUnstable.js @@ -0,0 +1,27 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +let componentNameToExists: Map = new Map(); + +/** + * Unstable API. Do not use! + * + * This method returns if the component with name received as a parameter + * is registed in the native platform. + */ +export function unstable_hasComponent(name: string): boolean { + let hasNativeComponent = componentNameToExists.get(name); + if (hasNativeComponent == null) { + if (global.__nativeComponentRegistry__hasComponent) { + hasNativeComponent = global.__nativeComponentRegistry__hasComponent(name); + componentNameToExists.set(name, hasNativeComponent); + } else { + throw `unstable_hasComponent('${name}'): Global function is not registered`; + } + } + return hasNativeComponent; +} diff --git a/Libraries/NativeComponent/StaticViewConfigValidator.js b/Libraries/NativeComponent/StaticViewConfigValidator.js new file mode 100644 index 000000000000..f69efcfb34a6 --- /dev/null +++ b/Libraries/NativeComponent/StaticViewConfigValidator.js @@ -0,0 +1,198 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +import {type ViewConfig} from '../Renderer/shims/ReactNativeTypes'; +// $FlowFixMe[nonstrict-import] +import getNativeComponentAttributes from '../ReactNative/getNativeComponentAttributes'; +// $FlowFixMe[nonstrict-import] +import {createViewConfig} from './ViewConfig'; + +type Difference = + | { + type: 'missing', + path: Array, + nativeValue: mixed, + } + | { + type: 'unequal', + path: Array, + nativeValue: mixed, + staticValue: mixed, + } + | { + type: 'unexpected', + path: Array, + staticValue: mixed, + }; + +type ValidationResult = ValidResult | InvalidResult; +type ValidResult = { + type: 'valid', +}; +type InvalidResult = { + type: 'invalid', + differences: Array, +}; + +type ViewConfigValidationResult = { + componentName: string, + nativeViewConfig?: ?ViewConfig, + staticViewConfig?: ?ViewConfig, + validationResult?: ?ValidationResult, +}; + +// e.g. require('MyNativeComponent') where MyNativeComponent.js exports a HostComponent +type JSModule = $FlowFixMe; + +export function validateStaticViewConfigs( + nativeComponent: JSModule, +): ViewConfigValidationResult { + const nativeViewConfig = getNativeComponentAttributes( + nativeComponent.default || nativeComponent, + ); + + const generatedPartialViewConfig = nativeComponent.__INTERNAL_VIEW_CONFIG; + const staticViewConfig: ?ViewConfig = + generatedPartialViewConfig && createViewConfig(generatedPartialViewConfig); + + const componentName: string = nativeComponent.default || nativeComponent; + const validationResult: ?ValidationResult = + nativeViewConfig && + staticViewConfig && + validate(componentName, nativeViewConfig, staticViewConfig); + + return { + componentName, + nativeViewConfig, + staticViewConfig, + validationResult, + }; +} + +/** + * During the migration from native view configs to static view configs, this is + * used to validate that the two are equivalent. + */ +export function validate( + name: string, + nativeViewConfig: ViewConfig, + staticViewConfig: ViewConfig, +): ValidationResult { + const differences = []; + accumulateDifferences( + differences, + [], + { + bubblingEventTypes: nativeViewConfig.bubblingEventTypes, + directEventTypes: nativeViewConfig.directEventTypes, + uiViewClassName: nativeViewConfig.uiViewClassName, + validAttributes: nativeViewConfig.validAttributes, + }, + { + bubblingEventTypes: staticViewConfig.bubblingEventTypes, + directEventTypes: staticViewConfig.directEventTypes, + uiViewClassName: staticViewConfig.uiViewClassName, + validAttributes: staticViewConfig.validAttributes, + }, + ); + + if (differences.length === 0) { + return {type: 'valid'}; + } + + return { + type: 'invalid', + differences, + }; +} + +export function stringifyValidationResult( + name: string, + validationResult: InvalidResult, +): string { + const {differences} = validationResult; + return [ + `StaticViewConfigValidator: Invalid static view config for '${name}'.`, + '', + ...differences.map(difference => { + const {type, path} = difference; + switch (type) { + case 'missing': + return `- '${path.join('.')}' is missing.`; + case 'unequal': + return `- '${path.join('.')}' is the wrong value.`; + case 'unexpected': + return `- '${path.join('.')}' is present but not expected to be.`; + } + }), + '', + ].join('\n'); +} + +function accumulateDifferences( + differences: Array, + path: Array, + nativeObject: {...}, + staticObject: {...}, +): void { + for (const nativeKey in nativeObject) { + const nativeValue = nativeObject[nativeKey]; + + if (!staticObject.hasOwnProperty(nativeKey)) { + differences.push({ + path: [...path, nativeKey], + type: 'missing', + nativeValue, + }); + continue; + } + + const staticValue = staticObject[nativeKey]; + + const nativeValueIfObject = ifObject(nativeValue); + if (nativeValueIfObject != null) { + const staticValueIfObject = ifObject(staticValue); + if (staticValueIfObject != null) { + path.push(nativeKey); + accumulateDifferences( + differences, + path, + nativeValueIfObject, + staticValueIfObject, + ); + path.pop(); + continue; + } + } + + if (nativeValue !== staticValue) { + differences.push({ + path: [...path, nativeKey], + type: 'unequal', + nativeValue, + staticValue, + }); + } + } + + for (const staticKey in staticObject) { + if (!nativeObject.hasOwnProperty(staticKey)) { + differences.push({ + path: [...path, staticKey], + type: 'unexpected', + staticValue: staticObject[staticKey], + }); + } + } +} + +function ifObject(value: mixed): ?{...} { + return typeof value === 'object' && !Array.isArray(value) ? value : null; +} diff --git a/Libraries/NativeComponent/ViewConfig.js b/Libraries/NativeComponent/ViewConfig.js index d04535a40967..ffba9d9cdee7 100644 --- a/Libraries/NativeComponent/ViewConfig.js +++ b/Libraries/NativeComponent/ViewConfig.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js b/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js new file mode 100644 index 000000000000..d39afe9f416d --- /dev/null +++ b/Libraries/NativeComponent/__tests__/StaticViewConfigValidator-test.js @@ -0,0 +1,233 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict + * @format + */ + +import * as StaticViewConfigValidator from '../StaticViewConfigValidator'; + +test('passes for identical configs', () => { + const name = 'RCTView'; + const nativeViewConfig = { + bubblingEventTypes: { + topBlur: { + phasedRegistrationNames: { + bubbled: 'onBlur', + captured: 'onBlurCapture', + }, + }, + topFocus: { + phasedRegistrationNames: { + bubbled: 'onFocus', + captured: 'onFocusCapture', + }, + }, + }, + directEventTypes: { + topLayout: { + registrationName: 'onLayout', + }, + }, + uiViewClassName: 'RCTView', + validAttributes: { + collapsable: true, + nativeID: true, + style: { + height: true, + width: true, + }, + }, + }; + const staticViewConfig = { + bubblingEventTypes: { + topBlur: { + phasedRegistrationNames: { + bubbled: 'onBlur', + captured: 'onBlurCapture', + }, + }, + topFocus: { + phasedRegistrationNames: { + bubbled: 'onFocus', + captured: 'onFocusCapture', + }, + }, + }, + directEventTypes: { + topLayout: { + registrationName: 'onLayout', + }, + }, + uiViewClassName: 'RCTView', + validAttributes: { + collapsable: true, + nativeID: true, + style: { + height: true, + width: true, + }, + }, + }; + + const validationResult = StaticViewConfigValidator.validate( + name, + nativeViewConfig, + staticViewConfig, + ); + + expect(validationResult.type).toBe('valid'); +}); + +test('fails for mismatched names', () => { + const name = 'RCTView'; + const nativeViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + style: {}, + }, + }; + const staticViewConfig = { + uiViewClassName: 'RCTImage', + validAttributes: { + style: {}, + }, + }; + + expectSVCToNotMatchNVC( + name, + nativeViewConfig, + staticViewConfig, + ` +StaticViewConfigValidator: Invalid static view config for 'RCTView'. + +- 'uiViewClassName' is the wrong value. +`.trimStart(), + ); +}); + +test('fails for unequal attributes', () => { + const name = 'RCTView'; + const nativeViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + nativeID: true, + style: {}, + }, + }; + const staticViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + nativeID: {}, + style: {}, + }, + }; + + expectSVCToNotMatchNVC( + name, + nativeViewConfig, + staticViewConfig, + ` +StaticViewConfigValidator: Invalid static view config for 'RCTView'. + +- 'validAttributes.nativeID' is the wrong value. +`.trimStart(), + ); +}); + +test('fails for missing attributes', () => { + const name = 'RCTView'; + const nativeViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + collapsable: true, + nativeID: true, + style: { + height: true, + width: true, + }, + }, + }; + const staticViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + style: {}, + }, + }; + + expectSVCToNotMatchNVC( + name, + nativeViewConfig, + staticViewConfig, + ` +StaticViewConfigValidator: Invalid static view config for 'RCTView'. + +- 'validAttributes.collapsable' is missing. +- 'validAttributes.nativeID' is missing. +- 'validAttributes.style.height' is missing. +- 'validAttributes.style.width' is missing. +`.trimStart(), + ); +}); + +test('fails for unexpected attributes', () => { + const name = 'RCTView'; + const nativeViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + style: {}, + }, + }; + const staticViewConfig = { + uiViewClassName: 'RCTView', + validAttributes: { + collapsable: true, + nativeID: true, + style: { + height: true, + width: true, + }, + }, + }; + + expectSVCToNotMatchNVC( + name, + nativeViewConfig, + staticViewConfig, + ` +StaticViewConfigValidator: Invalid static view config for 'RCTView'. + +- 'validAttributes.style.height' is present but not expected to be. +- 'validAttributes.style.width' is present but not expected to be. +- 'validAttributes.collapsable' is present but not expected to be. +- 'validAttributes.nativeID' is present but not expected to be. +`.trimStart(), + ); +}); + +function expectSVCToNotMatchNVC( + name, + nativeViewConfig, + staticViewConfig, + message, +) { + const validationResult = StaticViewConfigValidator.validate( + name, + nativeViewConfig, + staticViewConfig, + ); + + expect(validationResult.type).toBe('invalid'); + if (validationResult.type === 'invalid') { + expect( + StaticViewConfigValidator.stringifyValidationResult( + name, + validationResult, + ), + ).toBe(message); + } +} diff --git a/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js b/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js index 5f826cd8bdd4..b1a0d7cc3b16 100644 --- a/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js +++ b/Libraries/NativeModules/specs/NativeAnimationsDebugModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeDevMenu.js b/Libraries/NativeModules/specs/NativeDevMenu.js index f2e32cd595b6..86337f80a04c 100644 --- a/Libraries/NativeModules/specs/NativeDevMenu.js +++ b/Libraries/NativeModules/specs/NativeDevMenu.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeDevSettings.js b/Libraries/NativeModules/specs/NativeDevSettings.js index 800820745e37..89143ebc61c1 100644 --- a/Libraries/NativeModules/specs/NativeDevSettings.js +++ b/Libraries/NativeModules/specs/NativeDevSettings.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeDeviceEventManager.js b/Libraries/NativeModules/specs/NativeDeviceEventManager.js index ca0a0863bcc1..f3afae93fee4 100644 --- a/Libraries/NativeModules/specs/NativeDeviceEventManager.js +++ b/Libraries/NativeModules/specs/NativeDeviceEventManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js b/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js index f24c2cf82383..2bf53deb4615 100644 --- a/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js +++ b/Libraries/NativeModules/specs/NativeDialogManagerAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeLogBox.js b/Libraries/NativeModules/specs/NativeLogBox.js index bdf4f09ce4c5..65a9f5242ef5 100644 --- a/Libraries/NativeModules/specs/NativeLogBox.js +++ b/Libraries/NativeModules/specs/NativeLogBox.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeRedBox.js b/Libraries/NativeModules/specs/NativeRedBox.js index 6df25078c365..a892cdd76ecf 100644 --- a/Libraries/NativeModules/specs/NativeRedBox.js +++ b/Libraries/NativeModules/specs/NativeRedBox.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NativeModules/specs/NativeSourceCode.js b/Libraries/NativeModules/specs/NativeSourceCode.js index 5b4f8342de63..e2eb48fcec1d 100644 --- a/Libraries/NativeModules/specs/NativeSourceCode.js +++ b/Libraries/NativeModules/specs/NativeSourceCode.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/FormData.js b/Libraries/Network/FormData.js index 8ff360688693..8304a7d171d6 100644 --- a/Libraries/Network/FormData.js +++ b/Libraries/Network/FormData.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/NativeNetworkingAndroid.js b/Libraries/Network/NativeNetworkingAndroid.js index 293d74afe891..dd05e3306215 100644 --- a/Libraries/Network/NativeNetworkingAndroid.js +++ b/Libraries/Network/NativeNetworkingAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/NativeNetworkingIOS.js b/Libraries/Network/NativeNetworkingIOS.js index 45d003203499..574eda7d9c09 100644 --- a/Libraries/Network/NativeNetworkingIOS.js +++ b/Libraries/Network/NativeNetworkingIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTDataRequestHandler.h b/Libraries/Network/RCTDataRequestHandler.h index f0b2c684390e..24fa02ae9ba8 100644 --- a/Libraries/Network/RCTDataRequestHandler.h +++ b/Libraries/Network/RCTDataRequestHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTDataRequestHandler.mm b/Libraries/Network/RCTDataRequestHandler.mm index 1021566a8fb4..de308c77f6c2 100644 --- a/Libraries/Network/RCTDataRequestHandler.mm +++ b/Libraries/Network/RCTDataRequestHandler.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTFileRequestHandler.h b/Libraries/Network/RCTFileRequestHandler.h index 7faf39df00d5..d2368c2f340d 100644 --- a/Libraries/Network/RCTFileRequestHandler.h +++ b/Libraries/Network/RCTFileRequestHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTFileRequestHandler.mm b/Libraries/Network/RCTFileRequestHandler.mm index 071ef082e7f8..634bbe0fd047 100644 --- a/Libraries/Network/RCTFileRequestHandler.mm +++ b/Libraries/Network/RCTFileRequestHandler.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTHTTPRequestHandler.h b/Libraries/Network/RCTHTTPRequestHandler.h index 5a91bd0a71fa..3f96a8b4f6be 100644 --- a/Libraries/Network/RCTHTTPRequestHandler.h +++ b/Libraries/Network/RCTHTTPRequestHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTHTTPRequestHandler.mm b/Libraries/Network/RCTHTTPRequestHandler.mm index d160a9e72f9e..7b545928516b 100644 --- a/Libraries/Network/RCTHTTPRequestHandler.mm +++ b/Libraries/Network/RCTHTTPRequestHandler.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworkPlugins.h b/Libraries/Network/RCTNetworkPlugins.h index b8ea7cdbeaaa..c596ea863565 100644 --- a/Libraries/Network/RCTNetworkPlugins.h +++ b/Libraries/Network/RCTNetworkPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworkPlugins.mm b/Libraries/Network/RCTNetworkPlugins.mm index f1a016e1d209..d50344a587b3 100644 --- a/Libraries/Network/RCTNetworkPlugins.mm +++ b/Libraries/Network/RCTNetworkPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworkTask.h b/Libraries/Network/RCTNetworkTask.h index 716a0908ec7f..c7df9198e070 100644 --- a/Libraries/Network/RCTNetworkTask.h +++ b/Libraries/Network/RCTNetworkTask.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworkTask.mm b/Libraries/Network/RCTNetworkTask.mm index 5b07e2cb6865..a14748039c05 100644 --- a/Libraries/Network/RCTNetworkTask.mm +++ b/Libraries/Network/RCTNetworkTask.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworking.android.js b/Libraries/Network/RCTNetworking.android.js index abca231af643..94c5d9b37757 100644 --- a/Libraries/Network/RCTNetworking.android.js +++ b/Libraries/Network/RCTNetworking.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworking.h b/Libraries/Network/RCTNetworking.h index 2068f32b8030..3ad70f0ce80f 100644 --- a/Libraries/Network/RCTNetworking.h +++ b/Libraries/Network/RCTNetworking.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworking.ios.js b/Libraries/Network/RCTNetworking.ios.js index 67db8dd88dac..e0a6e6e0002d 100644 --- a/Libraries/Network/RCTNetworking.ios.js +++ b/Libraries/Network/RCTNetworking.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/RCTNetworking.mm b/Libraries/Network/RCTNetworking.mm index 22ca45b0fa3f..c9004d648bed 100644 --- a/Libraries/Network/RCTNetworking.mm +++ b/Libraries/Network/RCTNetworking.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/React-RCTNetwork.podspec b/Libraries/Network/React-RCTNetwork.podspec index fccf5b0fbf9b..a36b73a3f782 100644 --- a/Libraries/Network/React-RCTNetwork.podspec +++ b/Libraries/Network/React-RCTNetwork.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -35,12 +35,12 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.frameworks = "MobileCoreServices" s.dependency "RCT-Folly", folly_version - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version diff --git a/Libraries/Network/XHRInterceptor.js b/Libraries/Network/XHRInterceptor.js index 65c32e5606d7..11fe55c531c8 100644 --- a/Libraries/Network/XHRInterceptor.js +++ b/Libraries/Network/XHRInterceptor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -75,7 +75,7 @@ const XHRInterceptor = { } // Override `open` method for all XHR requests to intercept the request // method and url, then pass them through the `openCallback`. - XMLHttpRequest.prototype.open = function(method, url) { + XMLHttpRequest.prototype.open = function (method, url) { if (openCallback) { openCallback(method, url, this); } @@ -84,7 +84,7 @@ const XHRInterceptor = { // Override `setRequestHeader` method for all XHR requests to intercept // the request headers, then pass them through the `requestHeaderCallback`. - XMLHttpRequest.prototype.setRequestHeader = function(header, value) { + XMLHttpRequest.prototype.setRequestHeader = function (header, value) { if (requestHeaderCallback) { requestHeaderCallback(header, value, this); } @@ -93,7 +93,7 @@ const XHRInterceptor = { // Override `send` method of all XHR requests to intercept the data sent, // register listeners to intercept the response, and invoke the callbacks. - XMLHttpRequest.prototype.send = function(data) { + XMLHttpRequest.prototype.send = function (data) { if (sendCallback) { sendCallback(data, this); } @@ -106,9 +106,8 @@ const XHRInterceptor = { } if (this.readyState === this.HEADERS_RECEIVED) { const contentTypeString = this.getResponseHeader('Content-Type'); - const contentLengthString = this.getResponseHeader( - 'Content-Length', - ); + const contentLengthString = + this.getResponseHeader('Content-Length'); let responseContentType, responseSize; if (contentTypeString) { responseContentType = contentTypeString.split(';')[0]; diff --git a/Libraries/Network/XMLHttpRequest.js b/Libraries/Network/XMLHttpRequest.js index c12888f087a1..36dc8461cf33 100644 --- a/Libraries/Network/XMLHttpRequest.js +++ b/Libraries/Network/XMLHttpRequest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -136,7 +136,6 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { _lowerCaseResponseHeaders: Object; _method: ?string = null; _perfKey: ?string = null; - _response: string | ?Object; _responseType: ResponseType; _response: string = ''; _sent: boolean; @@ -423,12 +422,49 @@ class XMLHttpRequest extends (EventTarget(...XHR_EVENTS): any) { // according to the spec, return null if no response has been received return null; } - const headers = this.responseHeaders || {}; - return Object.keys(headers) - .map(headerName => { - return headerName + ': ' + headers[headerName]; - }) - .join('\r\n'); + + // Assign to non-nullable local variable. + const responseHeaders = this.responseHeaders; + + const unsortedHeaders: Map< + string, + {lowerHeaderName: string, upperHeaderName: string, headerValue: string}, + > = new Map(); + for (const rawHeaderName of Object.keys(responseHeaders)) { + const headerValue = responseHeaders[rawHeaderName]; + const lowerHeaderName = rawHeaderName.toLowerCase(); + const header = unsortedHeaders.get(lowerHeaderName); + if (header) { + header.headerValue += ', ' + headerValue; + unsortedHeaders.set(lowerHeaderName, header); + } else { + unsortedHeaders.set(lowerHeaderName, { + lowerHeaderName, + upperHeaderName: rawHeaderName.toUpperCase(), + headerValue, + }); + } + } + + // Sort in ascending order, with a being less than b if a's name is legacy-uppercased-byte less than b's name. + const sortedHeaders = [...unsortedHeaders.values()].sort((a, b) => { + if (a.upperHeaderName < b.upperHeaderName) { + return -1; + } + if (a.upperHeaderName > b.upperHeaderName) { + return 1; + } + return 0; + }); + + // Combine into single text response. + return ( + sortedHeaders + .map(header => { + return header.lowerHeaderName + ': ' + header.headerValue; + }) + .join('\r\n') + '\r\n' + ); } getResponseHeader(header: string): ?string { diff --git a/Libraries/Network/__tests__/FormData-test.js b/Libraries/Network/__tests__/FormData-test.js index 5ea0263aac35..4762ddf2c1f4 100644 --- a/Libraries/Network/__tests__/FormData-test.js +++ b/Libraries/Network/__tests__/FormData-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ const FormData = require('../FormData'); -describe('FormData', function() { +describe('FormData', function () { var formData; beforeEach(() => { @@ -23,7 +23,7 @@ describe('FormData', function() { formData = null; }); - it('should return non blob null', function() { + it('should return non blob null', function () { formData.append('null', null); const expectedPart = { @@ -36,7 +36,7 @@ describe('FormData', function() { expect(formData.getParts()[0]).toMatchObject(expectedPart); }); - it('should return blob', function() { + it('should return blob', function () { formData.append('photo', { uri: 'arbitrary/path', type: 'image/jpeg', diff --git a/Libraries/Network/__tests__/XMLHttpRequest-test.js b/Libraries/Network/__tests__/XMLHttpRequest-test.js index 91d2ce1e252c..646317998678 100644 --- a/Libraries/Network/__tests__/XMLHttpRequest-test.js +++ b/Libraries/Network/__tests__/XMLHttpRequest-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -28,15 +28,15 @@ jest .dontMock('event-target-shim') .setMock('../../BatchedBridge/NativeModules', { Networking: { - addListener: function() {}, - removeListeners: function() {}, + addListener: function () {}, + removeListeners: function () {}, sendRequest(options, callback) { if (typeof callback === 'function') { // android does not pass a callback callback(requestId); } }, - abortRequest: function() {}, + abortRequest: function () {}, }, PlatformConstants: { getConstants() { @@ -47,7 +47,7 @@ jest const XMLHttpRequest = require('../XMLHttpRequest'); -describe('XMLHttpRequest', function() { +describe('XMLHttpRequest', function () { let xhr; let handleTimeout; let handleError; @@ -88,7 +88,7 @@ describe('XMLHttpRequest', function() { handleReadyStateChange = null; }); - it('should transition readyState correctly', function() { + it('should transition readyState correctly', function () { expect(xhr.readyState).toBe(xhr.UNSENT); xhr.open('GET', 'blabla'); @@ -98,7 +98,7 @@ describe('XMLHttpRequest', function() { expect(xhr.readyState).toBe(xhr.OPENED); }); - it('should expose responseType correctly', function() { + it('should expose responseType correctly', function () { expect(xhr.responseType).toBe(''); jest.spyOn(console, 'warn').mockReturnValue(undefined); @@ -123,7 +123,7 @@ describe('XMLHttpRequest', function() { }).toThrow(); }); - it('should expose responseText correctly', function() { + it('should expose responseText correctly', function () { xhr.responseType = ''; expect(xhr.responseText).toBe(''); expect(xhr.response).toBe(''); @@ -150,7 +150,7 @@ describe('XMLHttpRequest', function() { expect(xhr.responseText).toBe('Some data'); }); - it('should call ontimeout function when the request times out', function() { + it('should call ontimeout function when the request times out', function () { xhr.open('GET', 'blabla'); xhr.send(); setRequestId(3); @@ -170,7 +170,7 @@ describe('XMLHttpRequest', function() { expect(handleLoad).not.toBeCalled(); }); - it('should call onerror function when the request times out', function() { + it('should call onerror function when the request times out', function () { xhr.open('GET', 'blabla'); xhr.send(); setRequestId(4); @@ -191,7 +191,7 @@ describe('XMLHttpRequest', function() { expect(handleLoad).not.toBeCalled(); }); - it('should call onload function when there is no error', function() { + it('should call onload function when there is no error', function () { xhr.open('GET', 'blabla'); xhr.send(); setRequestId(5); @@ -212,7 +212,7 @@ describe('XMLHttpRequest', function() { expect(handleTimeout).not.toBeCalled(); }); - it('should call upload onprogress', function() { + it('should call upload onprogress', function () { xhr.open('GET', 'blabla'); xhr.send(); @@ -231,7 +231,7 @@ describe('XMLHttpRequest', function() { expect(handleProgress.mock.calls[0][0].total).toBe(100); }); - it('should combine response headers with CRLF', function() { + it('should combine response headers with CRLF', function () { xhr.open('GET', 'blabla'); xhr.send(); setRequestId(7); @@ -241,7 +241,7 @@ describe('XMLHttpRequest', function() { }); expect(xhr.getAllResponseHeaders()).toBe( - 'Content-Type: text/plain; charset=utf-8\r\n' + 'Content-Length: 32', + 'content-length: 32\r\n' + 'content-type: text/plain; charset=utf-8\r\n', ); }); @@ -292,4 +292,22 @@ describe('XMLHttpRequest', function() { ); expect(GlobalPerformanceLogger.stopTimespan).not.toHaveBeenCalled(); }); + + it('should sort and lowercase response headers', function () { + // Derived from XHR Web Platform Test: https://github.com/web-platform-tests/wpt/blob/master/xhr/getallresponseheaders.htm + xhr.open('GET', 'blabla'); + xhr.send(); + setRequestId(10); + xhr.__didReceiveResponse(requestId, 200, { + 'foo-TEST': '1', + 'FOO-test': '2', + __Custom: 'token', + 'ALSO-here': 'Mr. PB', + ewok: 'lego', + }); + + expect(xhr.getAllResponseHeaders()).toBe( + 'also-here: Mr. PB\r\newok: lego\r\nfoo-test: 1, 2\r\n__custom: token\r\n', + ); + }); }); diff --git a/Libraries/Network/convertRequestBody.js b/Libraries/Network/convertRequestBody.js index 68940a1db241..b65b38f3b169 100644 --- a/Libraries/Network/convertRequestBody.js +++ b/Libraries/Network/convertRequestBody.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Network/fetch.js b/Libraries/Network/fetch.js index 6ebb79c2ca51..d10537ea60bb 100644 --- a/Libraries/Network/fetch.js +++ b/Libraries/Network/fetch.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/components/Colors.js b/Libraries/NewAppScreen/components/Colors.js index 4179617bf641..f2a38599cb2d 100644 --- a/Libraries/NewAppScreen/components/Colors.js +++ b/Libraries/NewAppScreen/components/Colors.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/components/DebugInstructions.js b/Libraries/NewAppScreen/components/DebugInstructions.js index 861f98b6f14b..35bb4a80dacf 100644 --- a/Libraries/NewAppScreen/components/DebugInstructions.js +++ b/Libraries/NewAppScreen/components/DebugInstructions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/components/Header.js b/Libraries/NewAppScreen/components/Header.js index f8c186b5d5b5..490746601aa9 100644 --- a/Libraries/NewAppScreen/components/Header.js +++ b/Libraries/NewAppScreen/components/Header.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/components/HermesBadge.js b/Libraries/NewAppScreen/components/HermesBadge.js index b0907266e024..9ead0caf9107 100644 --- a/Libraries/NewAppScreen/components/HermesBadge.js +++ b/Libraries/NewAppScreen/components/HermesBadge.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/components/LearnMoreLinks.js b/Libraries/NewAppScreen/components/LearnMoreLinks.js index ab69dd888bc3..b2d170e69f8a 100644 --- a/Libraries/NewAppScreen/components/LearnMoreLinks.js +++ b/Libraries/NewAppScreen/components/LearnMoreLinks.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/components/ReloadInstructions.js b/Libraries/NewAppScreen/components/ReloadInstructions.js index 4fd2cda45ef5..0294113b3c5c 100644 --- a/Libraries/NewAppScreen/components/ReloadInstructions.js +++ b/Libraries/NewAppScreen/components/ReloadInstructions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/NewAppScreen/index.js b/Libraries/NewAppScreen/index.js index fc7d7315f0b7..61f27b5c1e85 100644 --- a/Libraries/NewAppScreen/index.js +++ b/Libraries/NewAppScreen/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Performance/NativeJSCSamplingProfiler.js b/Libraries/Performance/NativeJSCSamplingProfiler.js index 4925e79d4421..a8c64967ce4f 100644 --- a/Libraries/Performance/NativeJSCSamplingProfiler.js +++ b/Libraries/Performance/NativeJSCSamplingProfiler.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Performance/PureComponentDebug.js b/Libraries/Performance/PureComponentDebug.js index 767a0d48727b..ec172ca6e4a1 100644 --- a/Libraries/Performance/PureComponentDebug.js +++ b/Libraries/Performance/PureComponentDebug.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Performance/QuickPerformanceLogger.js b/Libraries/Performance/QuickPerformanceLogger.js index 94f7cdbc790d..48fcc468b20e 100644 --- a/Libraries/Performance/QuickPerformanceLogger.js +++ b/Libraries/Performance/QuickPerformanceLogger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,6 +13,13 @@ const AUTO_SET_TIMESTAMP = -1; const DUMMY_INSTANCE_KEY = 0; +// Defines map of annotations for markEvent +// Use as following: +// {string: {key1: value1, key2: value2}} +export type AnnotationsMap = $Shape<{ + string: ?{[string]: string, ...}, +}>; + const QuickPerformanceLogger = { markerStart( markerId: number, @@ -90,6 +97,16 @@ const QuickPerformanceLogger = { } }, + markEvent( + markerId: number, + type: string, + annotations: ?AnnotationsMap = null, + ): void { + if (global.nativeQPLMarkEvent) { + global.nativeQPLMarkEvent(markerId, type, annotations); + } + }, + currentTimestamp(): number { if (global.nativeQPLTimestamp) { return global.nativeQPLTimestamp(); diff --git a/Libraries/Performance/SamplingProfiler.js b/Libraries/Performance/SamplingProfiler.js index a1c0ece4d166..9c27d4c04d44 100644 --- a/Libraries/Performance/SamplingProfiler.js +++ b/Libraries/Performance/SamplingProfiler.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,7 +11,7 @@ 'use strict'; const SamplingProfiler = { - poke: function(token: number): void { + poke: function (token: number): void { let error = null; let result = null; try { @@ -28,8 +28,8 @@ const SamplingProfiler = { error = e.toString(); } - const NativeJSCSamplingProfiler = require('./NativeJSCSamplingProfiler') - .default; + const NativeJSCSamplingProfiler = + require('./NativeJSCSamplingProfiler').default; if (NativeJSCSamplingProfiler) { NativeJSCSamplingProfiler.operationComplete(token, result, error); } diff --git a/Libraries/Performance/Systrace.js b/Libraries/Performance/Systrace.js index 6089016521b8..d25b76bd3d3b 100644 --- a/Libraries/Performance/Systrace.js +++ b/Libraries/Performance/Systrace.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -87,7 +87,14 @@ const userTimingPolyfill = __DEV__ } : null; -function installPerformanceHooks(polyfill) { +function installPerformanceHooks( + polyfill: null | $TEMPORARY$object<{ + clearMarks(markName: string): void, + clearMeasures(): void, + mark(markName: string): void, + measure(measureName: string, startMark: ?string, endMark: ?string): void, + }>, +) { if (polyfill) { if (global.performance === undefined) { global.performance = {}; diff --git a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js index 7c3a6c58ac76..76b4742398de 100644 --- a/Libraries/PermissionsAndroid/NativePermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/NativePermissionsAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -45,7 +45,12 @@ export type PermissionType = | 'android.permission.BLUETOOTH_CONNECT' | 'android.permission.BLUETOOTH_SCAN' | 'android.permission.BLUETOOTH_ADVERTISE' - | 'android.permission.ACCESS_MEDIA_LOCATION'; + | 'android.permission.ACCESS_MEDIA_LOCATION' + | 'android.permission.ACCEPT_HANDOVER' + | 'android.permission.ACTIVITY_RECOGNITION' + | 'android.permission.ANSWER_PHONE_CALLS' + | 'android.permission.READ_PHONE_NUMBERS' + | 'android.permission.UWB_RANGING'; */ export interface Spec extends TurboModule { diff --git a/Libraries/PermissionsAndroid/PermissionsAndroid.js b/Libraries/PermissionsAndroid/PermissionsAndroid.js index 0a24840c56e1..227af12e15f9 100644 --- a/Libraries/PermissionsAndroid/PermissionsAndroid.js +++ b/Libraries/PermissionsAndroid/PermissionsAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -63,21 +63,29 @@ const PERMISSIONS = Object.freeze({ BLUETOOTH_SCAN: 'android.permission.BLUETOOTH_SCAN', BLUETOOTH_ADVERTISE: 'android.permission.BLUETOOTH_ADVERTISE', ACCESS_MEDIA_LOCATION: 'android.permission.ACCESS_MEDIA_LOCATION', + ACCEPT_HANDOVER: 'android.permission.ACCEPT_HANDOVER', + ACTIVITY_RECOGNITION: 'android.permission.ACTIVITY_RECOGNITION', + ANSWER_PHONE_CALLS: 'android.permission.ANSWER_PHONE_CALLS', + READ_PHONE_NUMBERS: 'android.permission.READ_PHONE_NUMBERS', + UWB_RANGING: 'android.permission.UWB_RANGING', }); /** * `PermissionsAndroid` provides access to Android M's new permissions model. * - * See https://reactnative.dev/docs/permissionsandroid.html + * See https://reactnative.dev/docs/permissionsandroid */ class PermissionsAndroid { PERMISSIONS: {| + ACCEPT_HANDOVER: string, ACCESS_BACKGROUND_LOCATION: string, ACCESS_COARSE_LOCATION: string, ACCESS_FINE_LOCATION: string, ACCESS_MEDIA_LOCATION: string, + ACTIVITY_RECOGNITION: string, ADD_VOICEMAIL: string, + ANSWER_PHONE_CALLS: string, BLUETOOTH_ADVERTISE: string, BLUETOOTH_CONNECT: string, BLUETOOTH_SCAN: string, @@ -90,6 +98,7 @@ class PermissionsAndroid { READ_CALL_LOG: string, READ_CONTACTS: string, READ_EXTERNAL_STORAGE: string, + READ_PHONE_NUMBERS: string, READ_PHONE_STATE: string, READ_SMS: string, RECEIVE_MMS: string, @@ -98,6 +107,7 @@ class PermissionsAndroid { RECORD_AUDIO: string, SEND_SMS: string, USE_SIP: string, + UWB_RANGING: string, WRITE_CALENDAR: string, WRITE_CALL_LOG: string, WRITE_CONTACTS: string, @@ -140,7 +150,7 @@ class PermissionsAndroid { * Returns a promise resolving to a boolean value as to whether the specified * permissions has been granted * - * See https://reactnative.dev/docs/permissionsandroid.html#check + * See https://reactnative.dev/docs/permissionsandroid#check */ check(permission: PermissionType): Promise { if (Platform.OS !== 'android') { @@ -167,7 +177,7 @@ class PermissionsAndroid { * If the optional rationale argument is included (which is an object with a * `title` and `message`), this function checks with the OS whether it is * necessary to show a dialog explaining why the permission is needed - * (https://developer.android.com/training/permissions/requesting.html#explain) + * (https://developer.android.com/training/permissions/requesting#explain) * and then shows the system permission dialog * * @deprecated @@ -194,7 +204,7 @@ class PermissionsAndroid { * Prompts the user to enable a permission and returns a promise resolving to a * string value indicating whether the user allowed or denied the request * - * See https://reactnative.dev/docs/permissionsandroid.html#request + * See https://reactnative.dev/docs/permissionsandroid#request */ async request( permission: PermissionType, @@ -213,9 +223,10 @@ class PermissionsAndroid { ); if (rationale) { - const shouldShowRationale = await NativePermissionsAndroid.shouldShowRequestPermissionRationale( - permission, - ); + const shouldShowRationale = + await NativePermissionsAndroid.shouldShowRequestPermissionRationale( + permission, + ); if (shouldShowRationale && !!NativeDialogManagerAndroid) { return new Promise((resolve, reject) => { @@ -243,7 +254,7 @@ class PermissionsAndroid { * returns an object with the permissions as keys and strings as values * indicating whether the user allowed or denied the request * - * See https://reactnative.dev/docs/permissionsandroid.html#requestmultiple + * See https://reactnative.dev/docs/permissionsandroid#requestmultiple */ requestMultiple( permissions: Array, diff --git a/Libraries/Pressability/HoverState.js b/Libraries/Pressability/HoverState.js index 43e9aef50afe..ebbe9921dbac 100644 --- a/Libraries/Pressability/HoverState.js +++ b/Libraries/Pressability/HoverState.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Pressability/Pressability.js b/Libraries/Pressability/Pressability.js index bb3c6d4d2822..30c227c91d63 100644 --- a/Libraries/Pressability/Pressability.js +++ b/Libraries/Pressability/Pressability.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -545,8 +545,8 @@ export default class Pressability { if (process.env.NODE_ENV === 'test') { // We are setting this in order to find this node in ReactNativeTestTools - responderEventHandlers.onStartShouldSetResponder.testOnly_pressabilityConfig = () => - this._config; + responderEventHandlers.onStartShouldSetResponder.testOnly_pressabilityConfig = + () => this._config; } const mouseEventHandlers = diff --git a/Libraries/Pressability/PressabilityDebug.js b/Libraries/Pressability/PressabilityDebug.js index 27017a476082..2d37a26dd917 100644 --- a/Libraries/Pressability/PressabilityDebug.js +++ b/Libraries/Pressability/PressabilityDebug.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -52,17 +52,20 @@ export function PressabilityDebugView({color, hitSlop}: Props): React.Node { return ( ); } diff --git a/Libraries/Pressability/PressabilityPerformanceEventEmitter.js b/Libraries/Pressability/PressabilityPerformanceEventEmitter.js index ec49f2bf9a4d..5853b390ff21 100644 --- a/Libraries/Pressability/PressabilityPerformanceEventEmitter.js +++ b/Libraries/Pressability/PressabilityPerformanceEventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,7 +14,8 @@ export type PressabilityPerformanceEvent = $ReadOnly<{| signal: TouchSignal, nativeTimestamp: number, |}>; -export type PressabilityPerformanceEventListener = PressabilityPerformanceEvent => void; +export type PressabilityPerformanceEventListener = + PressabilityPerformanceEvent => void; class PressabilityPerformanceEventEmitter { _listeners: Array = []; @@ -42,6 +43,7 @@ class PressabilityPerformanceEventEmitter { } } -const PressabilityPerformanceEventEmitterSingleton: PressabilityPerformanceEventEmitter = new PressabilityPerformanceEventEmitter(); +const PressabilityPerformanceEventEmitterSingleton: PressabilityPerformanceEventEmitter = + new PressabilityPerformanceEventEmitter(); export default PressabilityPerformanceEventEmitterSingleton; diff --git a/Libraries/Pressability/PressabilityTypes.js b/Libraries/Pressability/PressabilityTypes.js index 5e8b1ffdb8ab..986223788d95 100644 --- a/Libraries/Pressability/PressabilityTypes.js +++ b/Libraries/Pressability/PressabilityTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Pressability/__tests__/Pressability-test.js b/Libraries/Pressability/__tests__/Pressability-test.js index 6960546e376a..cbb48e1acf8e 100644 --- a/Libraries/Pressability/__tests__/Pressability-test.js +++ b/Libraries/Pressability/__tests__/Pressability-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,12 +10,13 @@ */ import type {PressEvent} from '../../Types/CoreEventTypes'; -import * as HoverState from '../HoverState'; -import Pressability from '../Pressability'; -import invariant from 'invariant'; -import nullthrows from 'nullthrows'; -import Platform from '../../Utilities/Platform'; -import UIManager from '../../ReactNative/UIManager'; + +const HoverState = require('../HoverState'); +const Pressability = require('../Pressability').default; +const invariant = require('invariant'); +const nullthrows = require('nullthrows'); +const Platform = require('../../Utilities/Platform'); +const UIManager = require('../../ReactNative/UIManager'); // TODO: Move this util to a shared location. function getMock, TReturn>( diff --git a/Libraries/Pressability/usePressability.js b/Libraries/Pressability/usePressability.js index 605a9d8c406e..3204711c9e50 100644 --- a/Libraries/Pressability/usePressability.js +++ b/Libraries/Pressability/usePressability.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Promise.js b/Libraries/Promise.js index fc06e9f35db0..b14f6f32055c 100644 --- a/Libraries/Promise.js +++ b/Libraries/Promise.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js b/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js index 84d59b030a9d..e4252de820a1 100644 --- a/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js +++ b/Libraries/PushNotificationIOS/NativePushNotificationManagerIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/PushNotificationIOS/PushNotificationIOS.js b/Libraries/PushNotificationIOS/PushNotificationIOS.js index 288d06d9a7b5..268f7e9c15b4 100644 --- a/Libraries/PushNotificationIOS/PushNotificationIOS.js +++ b/Libraries/PushNotificationIOS/PushNotificationIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -37,11 +37,12 @@ type NativePushNotificationIOSEventDefinitions = { localNotificationReceived: [{...}], }; -const PushNotificationEmitter = new NativeEventEmitter( - // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior - // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' ? null : NativePushNotificationManagerIOS, -); +const PushNotificationEmitter = + new NativeEventEmitter( + // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior + // If you want to use the native module on other platforms, please remove this condition and test its behavior + Platform.OS !== 'ios' ? null : NativePushNotificationManagerIOS, + ); const _notifHandlers = new Map(); @@ -92,7 +93,7 @@ export type PushNotificationEventName = $Keys<{ * Handle push notifications for your app, including permission handling and * icon badge number. * - * See https://reactnative.dev/docs/pushnotificationios.html + * See https://reactnative.dev/docs/pushnotificationios */ class PushNotificationIOS { _data: Object; @@ -115,7 +116,7 @@ class PushNotificationIOS { /** * Schedules the localNotification for immediate presentation. * - * See https://reactnative.dev/docs/pushnotificationios.html#presentlocalnotification + * See https://reactnative.dev/docs/pushnotificationios#presentlocalnotification */ static presentLocalNotification(details: Object) { invariant( @@ -128,7 +129,7 @@ class PushNotificationIOS { /** * Schedules the localNotification for future presentation. * - * See https://reactnative.dev/docs/pushnotificationios.html#schedulelocalnotification + * See https://reactnative.dev/docs/pushnotificationios#schedulelocalnotification */ static scheduleLocalNotification(details: Object) { invariant( @@ -141,7 +142,7 @@ class PushNotificationIOS { /** * Cancels all scheduled localNotifications. * - * See https://reactnative.dev/docs/pushnotificationios.html#cancelalllocalnotifications + * See https://reactnative.dev/docs/pushnotificationios#cancelalllocalnotifications */ static cancelAllLocalNotifications() { invariant( @@ -154,7 +155,7 @@ class PushNotificationIOS { /** * Remove all delivered notifications from Notification Center. * - * See https://reactnative.dev/docs/pushnotificationios.html#removealldeliverednotifications + * See https://reactnative.dev/docs/pushnotificationios#removealldeliverednotifications */ static removeAllDeliveredNotifications(): void { invariant( @@ -167,7 +168,7 @@ class PushNotificationIOS { /** * Provides you with a list of the app’s notifications that are still displayed in Notification Center. * - * See https://reactnative.dev/docs/pushnotificationios.html#getdeliverednotifications + * See https://reactnative.dev/docs/pushnotificationios#getdeliverednotifications */ static getDeliveredNotifications( callback: (notifications: Array) => void, @@ -182,7 +183,7 @@ class PushNotificationIOS { /** * Removes the specified notifications from Notification Center * - * See https://reactnative.dev/docs/pushnotificationios.html#removedeliverednotifications + * See https://reactnative.dev/docs/pushnotificationios#removedeliverednotifications */ static removeDeliveredNotifications(identifiers: Array): void { invariant( @@ -195,7 +196,7 @@ class PushNotificationIOS { /** * Sets the badge number for the app icon on the home screen. * - * See https://reactnative.dev/docs/pushnotificationios.html#setapplicationiconbadgenumber + * See https://reactnative.dev/docs/pushnotificationios#setapplicationiconbadgenumber */ static setApplicationIconBadgeNumber(number: number) { invariant( @@ -208,7 +209,7 @@ class PushNotificationIOS { /** * Gets the current badge number for the app icon on the home screen. * - * See https://reactnative.dev/docs/pushnotificationios.html#getapplicationiconbadgenumber + * See https://reactnative.dev/docs/pushnotificationios#getapplicationiconbadgenumber */ static getApplicationIconBadgeNumber(callback: Function) { invariant( @@ -221,7 +222,7 @@ class PushNotificationIOS { /** * Cancel local notifications. * - * See https://reactnative.dev/docs/pushnotificationios.html#cancellocalnotification + * See https://reactnative.dev/docs/pushnotificationios#cancellocalnotification */ static cancelLocalNotifications(userInfo: Object) { invariant( @@ -234,7 +235,7 @@ class PushNotificationIOS { /** * Gets the local notifications that are currently scheduled. * - * See https://reactnative.dev/docs/pushnotificationios.html#getscheduledlocalnotifications + * See https://reactnative.dev/docs/pushnotificationios#getscheduledlocalnotifications */ static getScheduledLocalNotifications(callback: Function) { invariant( @@ -248,7 +249,7 @@ class PushNotificationIOS { * Attaches a listener to remote or local notification events while the app * is running in the foreground or the background. * - * See https://reactnative.dev/docs/pushnotificationios.html#addeventlistener + * See https://reactnative.dev/docs/pushnotificationios#addeventlistener */ static addEventListener(type: PushNotificationEventName, handler: Function) { invariant( @@ -295,7 +296,7 @@ class PushNotificationIOS { * Removes the event listener. Do this in `componentWillUnmount` to prevent * memory leaks. * - * See https://reactnative.dev/docs/pushnotificationios.html#removeeventlistener + * See https://reactnative.dev/docs/pushnotificationios#removeeventlistener */ static removeEventListener( type: PushNotificationEventName, @@ -322,7 +323,7 @@ class PushNotificationIOS { * a subset of these can be requested by passing a map of requested * permissions. * - * See https://reactnative.dev/docs/pushnotificationios.html#requestpermissions + * See https://reactnative.dev/docs/pushnotificationios#requestpermissions */ static requestPermissions(permissions?: { alert?: boolean, @@ -359,7 +360,7 @@ class PushNotificationIOS { /** * Unregister for all remote notifications received via Apple Push Notification service. * - * See https://reactnative.dev/docs/pushnotificationios.html#abandonpermissions + * See https://reactnative.dev/docs/pushnotificationios#abandonpermissions */ static abandonPermissions() { invariant( @@ -373,7 +374,7 @@ class PushNotificationIOS { * See what push permissions are currently enabled. `callback` will be * invoked with a `permissions` object. * - * See https://reactnative.dev/docs/pushnotificationios.html#checkpermissions + * See https://reactnative.dev/docs/pushnotificationios#checkpermissions */ static checkPermissions(callback: Function) { invariant(typeof callback === 'function', 'Must provide a valid callback'); @@ -388,7 +389,7 @@ class PushNotificationIOS { * This method returns a promise that resolves to either the notification * object if the app was launched by a push notification, or `null` otherwise. * - * See https://reactnative.dev/docs/pushnotificationios.html#getinitialnotification + * See https://reactnative.dev/docs/pushnotificationios#getinitialnotification */ static getInitialNotification(): Promise { invariant( @@ -432,7 +433,7 @@ class PushNotificationIOS { if (nativeNotif.remote) { // Extract data from Apple's `aps` dict as defined: - // https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html + // https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService Object.keys(nativeNotif).forEach(notifKey => { const notifVal = nativeNotif[notifKey]; if (notifKey === 'aps') { @@ -460,7 +461,7 @@ class PushNotificationIOS { * This method is available for remote notifications that have been received via: * `application:didReceiveRemoteNotification:fetchCompletionHandler:` * - * See https://reactnative.dev/docs/pushnotificationios.html#finish + * See https://reactnative.dev/docs/pushnotificationios#finish */ finish(fetchResult: string) { if ( @@ -493,7 +494,7 @@ class PushNotificationIOS { /** * Gets the sound string from the `aps` object * - * See https://reactnative.dev/docs/pushnotificationios.html#getsound + * See https://reactnative.dev/docs/pushnotificationios#getsound */ getSound(): ?string { return this._sound; @@ -502,7 +503,7 @@ class PushNotificationIOS { /** * Gets the category string from the `aps` object * - * See https://reactnative.dev/docs/pushnotificationios.html#getcategory + * See https://reactnative.dev/docs/pushnotificationios#getcategory */ getCategory(): ?string { return this._category; @@ -511,7 +512,7 @@ class PushNotificationIOS { /** * Gets the notification's main message from the `aps` object * - * See https://reactnative.dev/docs/pushnotificationios.html#getalert + * See https://reactnative.dev/docs/pushnotificationios#getalert */ getAlert(): ?string | ?Object { return this._alert; @@ -520,7 +521,7 @@ class PushNotificationIOS { /** * Gets the content-available number from the `aps` object * - * See https://reactnative.dev/docs/pushnotificationios.html#getcontentavailable + * See https://reactnative.dev/docs/pushnotificationios#getcontentavailable */ getContentAvailable(): ContentAvailable { return this._contentAvailable; @@ -529,7 +530,7 @@ class PushNotificationIOS { /** * Gets the badge count number from the `aps` object * - * See https://reactnative.dev/docs/pushnotificationios.html#getbadgecount + * See https://reactnative.dev/docs/pushnotificationios#getbadgecount */ getBadgeCount(): ?number { return this._badgeCount; @@ -538,7 +539,7 @@ class PushNotificationIOS { /** * Gets the data object on the notif * - * See https://reactnative.dev/docs/pushnotificationios.html#getdata + * See https://reactnative.dev/docs/pushnotificationios#getdata */ getData(): ?Object { return this._data; @@ -547,7 +548,7 @@ class PushNotificationIOS { /** * Gets the thread ID on the notif * - * See https://reactnative.dev/docs/pushnotificationios.html#getthreadid + * See https://reactnative.dev/docs/pushnotificationios#getthreadid */ getThreadID(): ?string { return this._threadID; diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index e486252c704b..cbd581536e3b 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index 57ce10017857..a56a88edf72b 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.h b/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.h index 34c8f014b33a..d25e019c14b3 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.h +++ b/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.mm b/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.mm index 434829371738..be1d99fd8ff2 100644 --- a/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.mm +++ b/Libraries/PushNotificationIOS/RCTPushNotificationPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec index 238d0ab95148..b403bd8e3156 100644 --- a/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec +++ b/Libraries/PushNotificationIOS/React-RCTPushNotification.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -36,11 +36,11 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.framework = "UserNotifications" - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "RCTTypeSafety", version s.dependency "React-Core/RCTPushNotificationHeaders", version s.dependency "ReactCommon/turbomodule/core", version diff --git a/Libraries/RCTRequired/RCTRequired.podspec b/Libraries/RCTRequired/RCTRequired.podspec index 83f8119d93aa..7d657a0b547b 100644 --- a/Libraries/RCTRequired/RCTRequired.podspec +++ b/Libraries/RCTRequired/RCTRequired.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/Libraries/RCTRequired/RCTRequired/RCTRequired.h b/Libraries/RCTRequired/RCTRequired/RCTRequired.h index 36ee6a8113b2..d0c9d3e3994b 100644 --- a/Libraries/RCTRequired/RCTRequired/RCTRequired.h +++ b/Libraries/RCTRequired/RCTRequired/RCTRequired.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/AppContainer.js b/Libraries/ReactNative/AppContainer.js index 23da450a3108..30c8db33c33a 100644 --- a/Libraries/ReactNative/AppContainer.js +++ b/Libraries/ReactNative/AppContainer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -82,8 +82,8 @@ class AppContainer extends React.Component { !global.__RCTProfileIsProfiling && !this.props.internal_excludeLogBox ) { - const LogBoxNotificationContainer = require('../LogBox/LogBoxNotificationContainer') - .default; + const LogBoxNotificationContainer = + require('../LogBox/LogBoxNotificationContainer').default; logBox = ; } } diff --git a/Libraries/ReactNative/AppRegistry.js b/Libraries/ReactNative/AppRegistry.js index f1ff791dd3d0..fdaccfb045c5 100644 --- a/Libraries/ReactNative/AppRegistry.js +++ b/Libraries/ReactNative/AppRegistry.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -59,9 +59,8 @@ let runCount = 1; const sections: Runnables = {}; const taskProviders: Map = new Map(); const taskCancelProviders: Map = new Map(); -let componentProviderInstrumentationHook: ComponentProviderInstrumentationHook = ( - component: ComponentProvider, -) => component(); +let componentProviderInstrumentationHook: ComponentProviderInstrumentationHook = + (component: ComponentProvider) => component(); let wrapperComponentProvider: ?WrapperComponentProvider; let showArchitectureIndicator = false; @@ -69,7 +68,7 @@ let showArchitectureIndicator = false; /** * `AppRegistry` is the JavaScript entry point to running all React Native apps. * - * See https://reactnative.dev/docs/appregistry.html + * See https://reactnative.dev/docs/appregistry */ const AppRegistry = { setWrapperComponentProvider(provider: WrapperComponentProvider) { @@ -103,7 +102,7 @@ const AppRegistry = { /** * Registers an app's root component. * - * See https://reactnative.dev/docs/appregistry.html#registercomponent + * See https://reactnative.dev/docs/appregistry#registercomponent */ registerComponent( appKey: string, @@ -114,6 +113,9 @@ const AppRegistry = { runnables[appKey] = { componentProvider, run: (appParameters, displayMode) => { + const concurrentRootEnabled = + appParameters.initialProps?.concurrentRoot || + appParameters.concurrentRoot; renderApplication( componentProviderInstrumentationHook( componentProvider, @@ -128,7 +130,7 @@ const AppRegistry = { appKey === 'LogBox', appKey, coerceDisplayMode(displayMode), - appParameters.concurrentRoot, + concurrentRootEnabled, ); }, }; @@ -181,7 +183,7 @@ const AppRegistry = { /** * Loads the JavaScript bundle and runs the app. * - * See https://reactnative.dev/docs/appregistry.html#runapplication + * See https://reactnative.dev/docs/appregistry#runapplication */ runApplication( appKey: string, @@ -245,7 +247,7 @@ const AppRegistry = { /** * Stops an application when a view should be destroyed. * - * See https://reactnative.dev/docs/appregistry.html#unmountapplicationcomponentatroottag + * See https://reactnative.dev/docs/appregistry#unmountapplicationcomponentatroottag */ unmountApplicationComponentAtRootTag(rootTag: RootTag): void { // NOTE: RootTag type @@ -256,7 +258,7 @@ const AppRegistry = { /** * Register a headless task. A headless task is a bit of code that runs without a UI. * - * See https://reactnative.dev/docs/appregistry.html#registerheadlesstask + * See https://reactnative.dev/docs/appregistry#registerheadlesstask */ registerHeadlessTask(taskKey: string, taskProvider: TaskProvider): void { // $FlowFixMe[object-this-reference] @@ -268,7 +270,7 @@ const AppRegistry = { /** * Register a cancellable headless task. A headless task is a bit of code that runs without a UI. * - * See https://reactnative.dev/docs/appregistry.html#registercancellableheadlesstask + * See https://reactnative.dev/docs/appregistry#registercancellableheadlesstask */ registerCancellableHeadlessTask( taskKey: string, @@ -287,7 +289,7 @@ const AppRegistry = { /** * Only called from native code. Starts a headless task. * - * See https://reactnative.dev/docs/appregistry.html#startheadlesstask + * See https://reactnative.dev/docs/appregistry#startheadlesstask */ startHeadlessTask(taskId: number, taskKey: string, data: any): void { const taskProvider = taskProviders.get(taskKey); @@ -325,7 +327,7 @@ const AppRegistry = { /** * Only called from native code. Cancels a headless task. * - * See https://reactnative.dev/docs/appregistry.html#cancelheadlesstask + * See https://reactnative.dev/docs/appregistry#cancelheadlesstask */ cancelHeadlessTask(taskId: number, taskKey: string): void { const taskCancelProvider = taskCancelProviders.get(taskKey); diff --git a/Libraries/ReactNative/DisplayMode.js b/Libraries/ReactNative/DisplayMode.js index e6850f0eb4ca..2bf55dc6976e 100644 --- a/Libraries/ReactNative/DisplayMode.js +++ b/Libraries/ReactNative/DisplayMode.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/DummyUIManager.js b/Libraries/ReactNative/DummyUIManager.js index bdf874592613..a8fba2edc628 100644 --- a/Libraries/ReactNative/DummyUIManager.js +++ b/Libraries/ReactNative/DummyUIManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,11 +11,13 @@ 'use strict'; import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes'; +import {unstable_hasComponent} from 'react-native/Libraries/NativeComponent/NativeComponentRegistryUnstable'; module.exports = { getViewManagerConfig: (viewManagerName: string): mixed => { console.warn( - 'Attempting to get config for view manager: ' + viewManagerName, + 'getViewManagerConfig is unavailable in Bridgeless, use hasViewManagerConfig instead. viewManagerName: ' + + viewManagerName, ); if (viewManagerName === 'RCTVirtualText') { return {}; @@ -23,10 +25,15 @@ module.exports = { return null; }, hasViewManagerConfig: (viewManagerName: string): boolean => { - return ( - viewManagerName === 'RCTVirtualText' || - viewManagerName === 'RCTShimmeringView' - ); + const staticViewConfigsEnabled = global.__fbStaticViewConfig === true; + if (staticViewConfigsEnabled) { + return unstable_hasComponent(viewManagerName); + } else { + return ( + viewManagerName === 'RCTVirtualText' || + viewManagerName === 'RCTShimmeringView' + ); + } }, getConstants: (): {...} => ({}), getConstantsForViewManager: (viewManagerName: string) => {}, diff --git a/Libraries/ReactNative/FabricUIManager.js b/Libraries/ReactNative/FabricUIManager.js index 987ef84f3812..9e5b625a778b 100644 --- a/Libraries/ReactNative/FabricUIManager.js +++ b/Libraries/ReactNative/FabricUIManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/HeadlessJsTaskError.js b/Libraries/ReactNative/HeadlessJsTaskError.js index 877ed3c9b73d..c4389166daa0 100644 --- a/Libraries/ReactNative/HeadlessJsTaskError.js +++ b/Libraries/ReactNative/HeadlessJsTaskError.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/I18nManager.js b/Libraries/ReactNative/I18nManager.js index 1095ab81cdb3..9084f2279d96 100644 --- a/Libraries/ReactNative/I18nManager.js +++ b/Libraries/ReactNative/I18nManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,11 +18,8 @@ const i18nConstants: {| function getI18nManagerConstants() { if (NativeI18nManager) { - const { - isRTL, - doLeftAndRightSwapInRTL, - localeIdentifier, - } = NativeI18nManager.getConstants(); + const {isRTL, doLeftAndRightSwapInRTL, localeIdentifier} = + NativeI18nManager.getConstants(); return {isRTL, doLeftAndRightSwapInRTL, localeIdentifier}; } diff --git a/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js b/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js index de7c9912c1bd..3fe8cf032777 100644 --- a/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js +++ b/Libraries/ReactNative/NativeHeadlessJsTaskSupport.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/NativeI18nManager.js b/Libraries/ReactNative/NativeI18nManager.js index b9cb0efebcc9..1c605de0f149 100644 --- a/Libraries/ReactNative/NativeI18nManager.js +++ b/Libraries/ReactNative/NativeI18nManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/NativeUIManager.js b/Libraries/ReactNative/NativeUIManager.js index ce77d2d4db34..a198dcb12926 100644 --- a/Libraries/ReactNative/NativeUIManager.js +++ b/Libraries/ReactNative/NativeUIManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/PaperUIManager.js b/Libraries/ReactNative/PaperUIManager.js index 87cc101db310..10b89e448694 100644 --- a/Libraries/ReactNative/PaperUIManager.js +++ b/Libraries/ReactNative/PaperUIManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -38,9 +38,8 @@ function getViewManagerConfig(viewManagerName: string): any { NativeUIManager.getConstantsForViewManager ) { try { - viewManagerConfigs[ - viewManagerName - ] = NativeUIManager.getConstantsForViewManager(viewManagerName); + viewManagerConfigs[viewManagerName] = + NativeUIManager.getConstantsForViewManager(viewManagerName); } catch (e) { console.error( "NativeUIManager.getConstantsForViewManager('" + diff --git a/Libraries/ReactNative/ReactFabricInternals.js b/Libraries/ReactNative/ReactFabricInternals.js index 4be6f784a290..98b8ca0c970c 100644 --- a/Libraries/ReactNative/ReactFabricInternals.js +++ b/Libraries/ReactNative/ReactFabricInternals.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/RootTag.js b/Libraries/ReactNative/RootTag.js index 03c83a86af97..e2cb96cfa580 100644 --- a/Libraries/ReactNative/RootTag.js +++ b/Libraries/ReactNative/RootTag.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,9 +13,8 @@ import * as React from 'react'; // TODO: Make this into an opaque type. export opaque type RootTag = number; -export const RootTagContext: React$Context = React.createContext( - 0, -); +export const RootTagContext: React$Context = + React.createContext(0); if (__DEV__) { RootTagContext.displayName = 'RootTagContext'; diff --git a/Libraries/ReactNative/UIManager.js b/Libraries/ReactNative/UIManager.js index ac916e66a241..98b5c80d0fa8 100644 --- a/Libraries/ReactNative/UIManager.js +++ b/Libraries/ReactNative/UIManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,11 +8,10 @@ * @format */ -import UIManagerInjection from './UIManagerInjection'; import type {Spec} from './NativeUIManager'; import type {RootTag} from 'react-native/Libraries/Types/RootTagTypes'; -interface UIManagerJSInterface extends Spec { +export interface UIManagerJSInterface extends Spec { +getViewManagerConfig: (viewManagerName: string) => Object; +hasViewManagerConfig: (viewManagerName: string) => boolean; +createView: ( @@ -34,9 +33,8 @@ interface UIManagerJSInterface extends Spec { const UIManager: UIManagerJSInterface = global.RN$Bridgeless === true - ? require('./DummyUIManager') // No UIManager in bridgeless mode - : UIManagerInjection.unstable_UIManager == null - ? require('./PaperUIManager') - : UIManagerInjection.unstable_UIManager; + ? require('./DummyUIManager') + : require('./UIManagerInjection').default.unstable_UIManager ?? + require('./PaperUIManager'); module.exports = UIManager; diff --git a/Libraries/ReactNative/UIManagerInjection.js b/Libraries/ReactNative/UIManagerInjection.js index 00a16ac04578..b1f74df852fe 100644 --- a/Libraries/ReactNative/UIManagerInjection.js +++ b/Libraries/ReactNative/UIManagerInjection.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,8 @@ * @format */ +import type {UIManagerJSInterface} from './UIManager'; + export default { - unstable_UIManager: (null: ?any), + unstable_UIManager: (null: ?UIManagerJSInterface), }; diff --git a/Libraries/ReactNative/UIManagerProperties.js b/Libraries/ReactNative/UIManagerProperties.js index f8f9f6b7ea82..c332897730a6 100644 --- a/Libraries/ReactNative/UIManagerProperties.js +++ b/Libraries/ReactNative/UIManagerProperties.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/getCachedComponentWithDebugName.js b/Libraries/ReactNative/getCachedComponentWithDebugName.js index 7e5e116399ad..c2020c9ede24 100644 --- a/Libraries/ReactNative/getCachedComponentWithDebugName.js +++ b/Libraries/ReactNative/getCachedComponentWithDebugName.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,7 +23,9 @@ export default function getCachedComponentWithDisplayName( let ComponentWithDisplayName = cache.get(displayName); if (!ComponentWithDisplayName) { - ComponentWithDisplayName = ({children}) => children; + ComponentWithDisplayName = ({ + children, + }: $TEMPORARY$object<{children: Node}>) => children; ComponentWithDisplayName.displayName = displayName; cache.set(displayName, ComponentWithDisplayName); } diff --git a/Libraries/ReactNative/getNativeComponentAttributes.js b/Libraries/ReactNative/getNativeComponentAttributes.js index 732e9b6745cf..64eb42488565 100644 --- a/Libraries/ReactNative/getNativeComponentAttributes.js +++ b/Libraries/ReactNative/getNativeComponentAttributes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,6 +35,10 @@ function getNativeComponentAttributes(uiViewClassName: string): any { // native component that can be either avoided or simplified. let {baseModuleName, bubblingEventTypes, directEventTypes} = viewConfig; let nativeProps = viewConfig.NativeProps; + + bubblingEventTypes = bubblingEventTypes ?? {}; + directEventTypes = directEventTypes ?? {}; + while (baseModuleName) { const baseModule = UIManager.getViewManagerConfig(baseModuleName); if (!baseModule) { @@ -63,8 +67,18 @@ function getNativeComponentAttributes(uiViewClassName: string): any { const diff = getDifferForType(typeName); const process = getProcessorForType(typeName); + // If diff or process == null, omit the corresponding property from the Attribute + // Why: + // 1. Consistency with AttributeType flow type + // 2. Consistency with Static View Configs, which omit the null properties validAttributes[key] = - diff == null && process == null ? true : {diff, process}; + diff == null + ? process == null + ? true + : {process} + : process == null + ? {diff} + : {diff, process}; } // Unfortunately, the current setup declares style properties as top-level @@ -80,17 +94,11 @@ function getNativeComponentAttributes(uiViewClassName: string): any { directEventTypes, }); - if (!hasAttachedDefaultEventTypes) { - attachDefaultEventTypes(viewConfig); - hasAttachedDefaultEventTypes = true; - } + attachDefaultEventTypes(viewConfig); return viewConfig; } -// TODO: Figure out how this makes sense. We're using a global boolean to only -// initialize this on the first eagerly initialized native component. -let hasAttachedDefaultEventTypes = false; function attachDefaultEventTypes(viewConfig: any) { // This is supported on UIManager platforms (ex: Android), // as lazy view managers are not implemented for all platforms. @@ -156,6 +164,8 @@ function getDifferForType( // Android Types case 'Point': return pointsDiffer; + case 'EdgeInsets': + return insetsDiffer; } return null; } @@ -178,6 +188,8 @@ function getProcessorForType(typeName: string): ?(nextProp: any) => any { return processColor; case 'ColorArray': return processColorArray; + case 'ImageSource': + return resolveAssetSource; } return null; } diff --git a/Libraries/ReactNative/renderApplication.js b/Libraries/ReactNative/renderApplication.js index 9eb3b932ce74..5663a47a7ad7 100644 --- a/Libraries/ReactNative/renderApplication.js +++ b/Libraries/ReactNative/renderApplication.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactNative/requireNativeComponent.js b/Libraries/ReactNative/requireNativeComponent.js index 02d33db9b5ee..7402bbfb0758 100644 --- a/Libraries/ReactNative/requireNativeComponent.js +++ b/Libraries/ReactNative/requireNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js b/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js index e34e6271f2f7..69ca3d5a73ac 100644 --- a/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js +++ b/Libraries/ReactPrivate/ReactNativePrivateInitializeCore.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/ReactPrivate/ReactNativePrivateInterface.js b/Libraries/ReactPrivate/ReactNativePrivateInterface.js index 7e8abb94c786..e7c9d2a983d1 100644 --- a/Libraries/ReactPrivate/ReactNativePrivateInterface.js +++ b/Libraries/ReactPrivate/ReactNativePrivateInterface.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Reliability/UserFlow.js b/Libraries/Reliability/UserFlow.js index c6206df57716..7a6262a5f5b3 100644 --- a/Libraries/Reliability/UserFlow.js +++ b/Libraries/Reliability/UserFlow.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/REVISION b/Libraries/Renderer/REVISION index 97d8977a5a38..b3c49ffc21d8 100644 --- a/Libraries/Renderer/REVISION +++ b/Libraries/Renderer/REVISION @@ -1 +1 @@ -afcb9cdc9343ddc134b03dcf4d7fbc0810b6002b \ No newline at end of file +51947a14bb24bd151f76f6fc0acdbbc404de13f7 \ No newline at end of file diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js index 6bc84b6f4956..f37be3e0ef68 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.fb.js @@ -7,14 +7,25 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<10efd73d5435b5750183622476c68681>> */ 'use strict'; if (__DEV__) { (function() { -"use strict"; + + 'use strict'; + +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); +} + "use strict"; var React = require("react"); require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); @@ -145,7 +156,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; // when we call document.createEvent(). However this can cause confusing // errors: https://github.com/facebook/create-react-app/issues/3482 // So we preemptively throw with a better message instead. - if (typeof document === "undefined") { + if (typeof document === "undefined" || document === null) { throw new Error( "The `document` global was defined when React was initialized, but is not " + "defined anymore. This can happen in a test environment if a component " + @@ -2599,7 +2610,6 @@ var REACT_SUSPENSE_LIST_TYPE = 0xead8; var REACT_MEMO_TYPE = 0xead3; var REACT_LAZY_TYPE = 0xead4; var REACT_SCOPE_TYPE = 0xead7; -var REACT_OPAQUE_ID_TYPE = 0xeae0; var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; var REACT_OFFSCREEN_TYPE = 0xeae2; var REACT_LEGACY_HIDDEN_TYPE = 0xeae3; @@ -2620,7 +2630,6 @@ if (typeof Symbol === "function" && Symbol.for) { REACT_MEMO_TYPE = symbolFor("react.memo"); REACT_LAZY_TYPE = symbolFor("react.lazy"); REACT_SCOPE_TYPE = symbolFor("react.scope"); - REACT_OPAQUE_ID_TYPE = symbolFor("react.opaque.id"); REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode"); REACT_OFFSCREEN_TYPE = symbolFor("react.offscreen"); REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden"); @@ -2853,12 +2862,13 @@ function getComponentNameFromFiber(fiber) { var enablePersistentOffscreenHostContainer = dynamicFlags.enablePersistentOffscreenHostContainer; // The rest of the flags are static for better dead code elimination. -var enableSchedulingProfiler = false; +var enableSchedulingProfiler = true; var enableProfilerTimer = true; var enableProfilerCommitHooks = true; var enableLazyElements = false; var warnAboutStringRefs = false; var warnOnSubscriptionInsideStartTransition = false; +var enableSuspenseAvoidThisFallback = false; var enableNewReconciler = false; var enableLazyContextPropagation = false; @@ -2891,6 +2901,9 @@ var Callback = var DidCapture = /* */ 128; +var ForceClientRender = + /* */ + 256; var Ref = /* */ 512; @@ -2928,6 +2941,9 @@ var ShouldCapture = var ForceUpdateForLegacySuspense = /* */ 131072; +var Forked = + /* */ + 1048576; // Static tags describe aspects of a fiber that are not specific to a render, // e.g. a fiber uses a passive effect (even if there are no updates on this particular render). // This enables us to defer more work in the unmount case, // since we can defer traversing the tree during layout to look for Passive effects, @@ -2935,22 +2951,22 @@ var ForceUpdateForLegacySuspense = var RefStatic = /* */ - 1048576; + 2097152; var LayoutStatic = /* */ - 2097152; + 4194304; var PassiveStatic = /* */ - 4194304; // These flags allow us to traverse to fibers that have effects on mount + 8388608; // These flags allow us to traverse to fibers that have effects on mount // without traversing the entire tree after every commit for // double invoking var MountLayoutDev = /* */ - 8388608; + 16777216; var MountPassiveDev = /* */ - 16777216; // Groups of flags that are used in the commit phase to skip over trees that + 33554432; // Groups of flags that are used in the commit phase to skip over trees that // don't contain effects, by checking subtreeFlags. var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility @@ -3993,6 +4009,7 @@ function reenableLogs() { var rendererID = null; var injectedHook = null; +var injectedProfilingHooks = null; var hasLoggedError = false; var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; function injectInternals(internals) { @@ -4023,7 +4040,12 @@ function injectInternals(internals) { } try { - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + rendererID = hook.inject( + Object.assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }) + ); // We have successfully injected, so now it is safe to set up hooks. injectedHook = hook; } catch (err) { @@ -4150,6 +4172,272 @@ function setIsStrictModeForDevtools(newIsStrictMode) { reenableLogs(); } } +} // Profiler API hooks + +function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; +} + +function getLaneLabelMap() { + var map = new Map(); + var lane = 1; + + for (var index = 0; index < TotalLanes; index++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } + + return map; +} + +function markCommitStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markCommitStarted === "function" + ) { + injectedProfilingHooks.markCommitStarted(lanes); + } + } +} +function markCommitStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markCommitStopped === "function" + ) { + injectedProfilingHooks.markCommitStopped(); + } + } +} +function markComponentRenderStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentRenderStarted === "function" + ) { + injectedProfilingHooks.markComponentRenderStarted(fiber); + } + } +} +function markComponentRenderStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentRenderStopped === "function" + ) { + injectedProfilingHooks.markComponentRenderStopped(); + } + } +} +function markComponentPassiveEffectMountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); + } + } +} +function markComponentPassiveEffectMountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectMountStopped(); + } + } +} +function markComponentPassiveEffectUnmountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); + } + } +} +function markComponentPassiveEffectUnmountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); + } + } +} +function markComponentLayoutEffectMountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); + } + } +} +function markComponentLayoutEffectMountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); + } + } +} +function markComponentLayoutEffectUnmountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); + } + } +} +function markComponentLayoutEffectUnmountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); + } + } +} +function markComponentErrored(fiber, thrownValue, lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentErrored === "function" + ) { + injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); + } + } +} +function markComponentSuspended(fiber, wakeable, lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentSuspended === "function" + ) { + injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); + } + } +} +function markLayoutEffectsStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markLayoutEffectsStarted === "function" + ) { + injectedProfilingHooks.markLayoutEffectsStarted(lanes); + } + } +} +function markLayoutEffectsStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markLayoutEffectsStopped === "function" + ) { + injectedProfilingHooks.markLayoutEffectsStopped(); + } + } +} +function markPassiveEffectsStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markPassiveEffectsStarted === "function" + ) { + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + } + } +} +function markPassiveEffectsStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markPassiveEffectsStopped === "function" + ) { + injectedProfilingHooks.markPassiveEffectsStopped(); + } + } +} +function markRenderStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderStarted === "function" + ) { + injectedProfilingHooks.markRenderStarted(lanes); + } + } +} +function markRenderYielded() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderYielded === "function" + ) { + injectedProfilingHooks.markRenderYielded(); + } + } +} +function markRenderStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderStopped === "function" + ) { + injectedProfilingHooks.markRenderStopped(); + } + } +} +function markRenderScheduled(lane) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderScheduled === "function" + ) { + injectedProfilingHooks.markRenderScheduled(lane); + } + } +} +function markForceUpdateScheduled(fiber, lane) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markForceUpdateScheduled === "function" + ) { + injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); + } + } +} +function markStateUpdateScheduled(fiber, lane) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markStateUpdateScheduled === "function" + ) { + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + } } var NoMode = @@ -4175,6 +4463,24 @@ var ConcurrentUpdatesByDefaultMode = /* */ 32; +// TODO: This is pretty well supported by browsers. Maybe we can drop it. +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. +// Based on: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + +var log = Math.log; +var LN2 = Math.LN2; + +function clz32Fallback(x) { + var asUint = x >>> 0; + + if (asUint === 0) { + return 32; + } + + return (31 - ((log(asUint) / LN2) | 0)) | 0; +} + // If those values are changed that package should be rebuilt and redeployed. var TotalLanes = 31; @@ -4286,7 +4592,60 @@ var IdleLane = 536870912; var OffscreenLane = /* */ - 1073741824; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) + 1073741824; // This function is used for the experimental timeline (react-devtools-timeline) +// It should be kept in sync with the Lanes values above. + +function getLabelForLane(lane) { + { + if (lane & SyncLane) { + return "Sync"; + } + + if (lane & InputContinuousHydrationLane) { + return "InputContinuousHydration"; + } + + if (lane & InputContinuousLane) { + return "InputContinuous"; + } + + if (lane & DefaultHydrationLane) { + return "DefaultHydration"; + } + + if (lane & DefaultLane) { + return "Default"; + } + + if (lane & TransitionHydrationLane) { + return "TransitionHydration"; + } + + if (lane & TransitionLanes) { + return "Transition"; + } + + if (lane & RetryLanes) { + return "Retry"; + } + + if (lane & SelectiveHydrationLane) { + return "SelectiveHydration"; + } + + if (lane & IdleHydrationLane) { + return "IdleHydration"; + } + + if (lane & IdleLane) { + return "Idle"; + } + + if (lane & OffscreenLane) { + return "Offscreen"; + } + } +} var NoTimestamp = -1; var nextTransitionLane = TransitionLane1; var nextRetryLane = RetryLane1; @@ -4764,7 +5123,6 @@ function markRootFinished(root, remainingLanes) { root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; - var entanglements = root.entanglements; var eventTimes = root.eventTimes; var expirationTimes = root.expirationTimes; // Clear the lanes that no longer have pending work @@ -4853,20 +5211,6 @@ function movePendingFibersToMemoized(root, lanes) { lanes &= ~lane; } } -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. Only used on lanes, so assume input is an integer. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 - -var log = Math.log; -var LN2 = Math.LN2; - -function clz32Fallback(lanes) { - if (lanes === 0) { - return 32; - } - - return (31 - ((log(lanes) / LN2) | 0)) | 0; -} var DiscreteEventPriority = SyncLane; var ContinuousEventPriority = InputContinuousLane; @@ -4918,7 +5262,6 @@ function shim() { var supportsMutation = false; var commitMount = shim; -var clearContainer = shim; // Renderers that don't support hydration // can re-export everything from this module. @@ -5205,6 +5548,8 @@ function getCurrentEventPriority() { return DefaultEventPriority; } // The Fabric renderer is secondary to the existing React Native renderer. + +var warnsIfNotActing = false; var scheduleTimeout = setTimeout; var cancelTimeout = clearTimeout; var noTimeout = -1; // ------------------- @@ -5300,9 +5645,6 @@ function appendChildToContainerChildSet(childSet, child) { function finalizeContainerChildren(container, newChildren) { completeRoot(container, newChildren); } -function makeClientIdInDEV(warnOnAccessInDEV) { - throw new Error("Not yet implemented"); -} function preparePortalMount(portalInstance) { // noop } @@ -5938,13 +6280,6 @@ function flushSyncCallbacks() { return null; } -var ReactVersion = "18.0.0-afcb9cdc9-20211008"; - -function markComponentRenderStopped() {} -function markComponentErrored(fiber, thrownValue, lanes) {} - -function markComponentSuspended(fiber, wakeable, lanes) {} - var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var NoTransition = 0; function requestCurrentTransition() { @@ -5979,9 +6314,11 @@ function shallowEqual(objA, objB) { } // Test for A's keys different from B. for (var i = 0; i < keysA.length; i++) { + var currentKey = keysA[i]; + if ( - !hasOwnProperty.call(objB, keysA[i]) || - !objectIs(objA[keysA[i]], objB[keysA[i]]) + !hasOwnProperty.call(objB, currentKey) || + !objectIs(objA[currentKey], objB[currentKey]) ) { return false; } @@ -6088,11 +6425,6 @@ function setIsRendering(rendering) { isRendering = rendering; } } -function getIsRendering() { - { - return isRendering; - } -} var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function(fiber, instance) {}, @@ -6452,7 +6784,6 @@ var ReactStrictModeWarnings = { * of the `value` object). */ // $FlowFixMe only called in DEV, so void return is not possible. - function typeName(value) { { // toStringTag is needed for namespaced types like Temporal.Instant @@ -6467,17 +6798,6 @@ function typeName(value) { function willCoercionThrow(value) { { - if ( - value !== null && - typeof value === "object" && - value.$$typeof === REACT_OPAQUE_ID_TYPE - ) { - // OpaqueID type is expected to throw, so React will handle it. Not sure if - // it's expected that string coercion will throw, but we'll assume it's OK. - // See https://github.com/facebook/react/issues/20127. - return; - } - try { testStringCoercion(value); return false; @@ -7554,6 +7874,10 @@ var classComponentUpdater = { if (root !== null) { entangleTransitions(root, fiber, lane); } + + { + markStateUpdateScheduled(fiber, lane); + } }, enqueueReplaceState: function(inst, payload, callback) { var fiber = get(inst); @@ -7577,6 +7901,10 @@ var classComponentUpdater = { if (root !== null) { entangleTransitions(root, fiber, lane); } + + { + markStateUpdateScheduled(fiber, lane); + } }, enqueueForceUpdate: function(inst, callback) { var fiber = get(inst); @@ -7599,6 +7927,10 @@ var classComponentUpdater = { if (root !== null) { entangleTransitions(root, fiber, lane); } + + { + markForceUpdateScheduled(fiber, lane); + } } }; @@ -8537,6 +8869,84 @@ function updateClassInstance( return shouldUpdate; } +// TODO: Use the unified fiber stack module instead of this local one? +// Intentionally not using it yet to derisk the initial implementation, because +// the way we push/pop these values is a bit unusual. If there's a mistake, I'd +// rather the ids be wrong than crash the whole reconciler. +var forkStack = []; +var forkStackIndex = 0; +var treeForkProvider = null; +var treeForkCount = 0; +var idStack = []; +var idStackIndex = 0; +var treeContextProvider = null; +var treeContextId = 1; +var treeContextOverflow = ""; + +function popTreeContext(workInProgress) { + // Restore the previous values. + // This is a bit more complicated than other context-like modules in Fiber + // because the same Fiber may appear on the stack multiple times and for + // different reasons. We have to keep popping until the work-in-progress is + // no longer at the top of the stack. + while (workInProgress === treeForkProvider) { + treeForkProvider = forkStack[--forkStackIndex]; + forkStack[forkStackIndex] = null; + treeForkCount = forkStack[--forkStackIndex]; + forkStack[forkStackIndex] = null; + } + + while (workInProgress === treeContextProvider) { + treeContextProvider = idStack[--idStackIndex]; + idStack[idStackIndex] = null; + treeContextOverflow = idStack[--idStackIndex]; + idStack[idStackIndex] = null; + treeContextId = idStack[--idStackIndex]; + idStack[idStackIndex] = null; + } +} + +var isHydrating = false; + +function enterHydrationState(fiber) { + { + return false; + } +} + +function prepareToHydrateHostInstance( + fiber, + rootContainerInstance, + hostContext +) { + { + throw new Error( + "Expected prepareToHydrateHostInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } +} + +function prepareToHydrateHostTextInstance(fiber) { + { + throw new Error( + "Expected prepareToHydrateHostTextInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + var shouldUpdate = hydrateTextInstance(); +} + +function popHydrationState(fiber) { + { + return false; + } +} + +function getIsHydrating() { + return isHydrating; +} + var didWarnAboutMaps; var didWarnAboutGenerators; var didWarnAboutStringRefs; @@ -8820,7 +9230,9 @@ function ChildReconciler(shouldTrackSideEffects) { newFiber.index = newIndex; if (!shouldTrackSideEffects) { - // Noop. + // During hydration, the useId algorithm needs to know which fibers are + // part of a list of children (arrays, iterators). + newFiber.flags |= Forked; return lastPlacedIndex; } @@ -8949,7 +9361,10 @@ function ChildReconciler(shouldTrackSideEffects) { } function createChild(returnFiber, newChild, lanes) { - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. @@ -9012,7 +9427,10 @@ function ChildReconciler(shouldTrackSideEffects) { // Update the fiber if the keys match, otherwise return null. var key = oldFiber !== null ? oldFiber.key : null; - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. @@ -9069,7 +9487,10 @@ function ChildReconciler(shouldTrackSideEffects) { newChild, lanes ) { - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; @@ -9260,6 +9681,7 @@ function ChildReconciler(shouldTrackSideEffects) { if (newIdx === newChildren.length) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; } @@ -9466,6 +9888,7 @@ function ChildReconciler(shouldTrackSideEffects) { if (step.done) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; } @@ -9752,7 +10175,10 @@ function ChildReconciler(shouldTrackSideEffects) { throwOnInvalidObjectType(returnFiber, newChild); } - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { return placeSingleChild( reconcileSingleTextNode( returnFiber, @@ -9942,16 +10368,9 @@ function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { var props = workInProgress.memoizedProps; // Regular boundaries always capture. - if (props.unstable_avoidThisFallback !== true) { + { return true; } // If it's a boundary we should avoid, then we prefer to bubble up to the - // parent boundary if it is currently invisible. - - if (hasInvisibleParent) { - return false; - } // If the parent is not able to handle it, we must handle it. - - return true; } function findFirstSuspended(row) { var node = row; @@ -10024,47 +10443,6 @@ var Passive$1 = /* */ 8; -var isHydrating = false; - -function enterHydrationState(fiber) { - { - return false; - } -} - -function prepareToHydrateHostInstance( - fiber, - rootContainerInstance, - hostContext -) { - { - throw new Error( - "Expected prepareToHydrateHostInstance() to never be called. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } -} - -function prepareToHydrateHostTextInstance(fiber) { - { - throw new Error( - "Expected prepareToHydrateHostTextInstance() to never be called. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - var shouldUpdate = hydrateTextInstance(); -} - -function popHydrationState(fiber) { - { - return false; - } -} - -function getIsHydrating() { - return isHydrating; -} - // and should be reset before starting a new render. // This tracks which mutable sources need to be reset after a render. @@ -10126,11 +10504,9 @@ function getSuspendedCachePool() { var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; -var didWarnAboutUseOpaqueIdentifier; var didWarnUncachedGetSnapshot; { - didWarnAboutUseOpaqueIdentifier = {}; didWarnAboutMismatchedHooksForComponent = new Set(); } @@ -10154,7 +10530,13 @@ var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only // TODO: Maybe there's some way to consolidate this with // `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. -var didScheduleRenderPhaseUpdateDuringThisPass = false; +var didScheduleRenderPhaseUpdateDuringThisPass = false; // Counts the number of useId hooks in this component. + +var localIdCounter = 0; // Used for ids that are generated completely client-side (i.e. not during +// hydration). This counter is global, so client ids are not stable across +// render attempts. + +var globalClientIdCounter = 0; var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. @@ -10335,6 +10717,7 @@ function renderWithHooks( // currentHook = null; // workInProgressHook = null; // didScheduleRenderPhaseUpdate = false; + // localIdCounter = 0; // TODO Warn if no hooks are used at all during mount, then some are used during update. // Currently we will identify the update render as a mount because memoizedState === null. // This is tricky because it's valid for certain types of components (e.g. React.lazy) @@ -10366,6 +10749,7 @@ function renderWithHooks( do { didScheduleRenderPhaseUpdateDuringThisPass = false; + localIdCounter = 0; if (numberOfReRenders >= RE_RENDER_LIMIT) { throw new Error( @@ -10434,7 +10818,8 @@ function renderWithHooks( } } - didScheduleRenderPhaseUpdate = false; + didScheduleRenderPhaseUpdate = false; // This is reset by checkDidRenderIdHook + // localIdCounter = 0; if (didRenderTooFewHooks) { throw new Error( @@ -10445,6 +10830,14 @@ function renderWithHooks( return children; } +function checkDidRenderIdHook() { + // This should be called immediately after every renderWithHooks call. + // Conceptually, it's part of the return value of renderWithHooks; it's only a + // separate function to avoid using an array tuple. + var didRenderIdHook = localIdCounter !== 0; + localIdCounter = 0; + return didRenderIdHook; +} function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the // complete phase (bubbleProperties). @@ -10504,6 +10897,7 @@ function resetHooksAfterThrow() { } didScheduleRenderPhaseUpdateDuringThisPass = false; + localIdCounter = 0; } function mountWorkInProgressHook() { @@ -11723,44 +12117,30 @@ function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { } } -function warnOnOpaqueIdentifierAccessInDEV(fiber) { - { - // TODO: Should warn in effects and callbacks, too - var name = getComponentNameFromFiber(fiber) || "Unknown"; - - if (getIsRendering() && !didWarnAboutUseOpaqueIdentifier[name]) { - error( - "The object passed back from useOpaqueIdentifier is meant to be " + - "passed through to attributes only. Do not read the " + - "value directly." - ); - - didWarnAboutUseOpaqueIdentifier[name] = true; - } - } -} +function mountId() { + var hook = mountWorkInProgressHook(); + var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we + // should do this in Fiber, too? Deferring this decision for now because + // there's no other place to store the prefix except for an internal field on + // the public createRoot object, which the fiber tree does not currently have + // a reference to. -function mountOpaqueIdentifier() { - var makeId = makeClientIdInDEV.bind( - null, - warnOnOpaqueIdentifierAccessInDEV.bind(null, currentlyRenderingFiber$1) - ); + var identifierPrefix = root.identifierPrefix; + var id; { - var _id = makeId(); - - mountState(_id); - return _id; + // Use a lowercase r prefix for client-generated ids. + var globalClientId = globalClientIdCounter++; + id = identifierPrefix + "r:" + globalClientId.toString(32); } -} -function updateOpaqueIdentifier() { - var id = updateState()[0]; + hook.memoizedState = id; return id; } -function rerenderOpaqueIdentifier() { - var id = rerenderState()[0]; +function updateId() { + var hook = updateWorkInProgressHook(); + var id = hook.memoizedState; return id; } @@ -11788,7 +12168,6 @@ function dispatchReducerAction(fiber, queue, action) { enqueueRenderPhaseUpdate(queue, update); } else { enqueueUpdate$1(fiber, queue, update); - var eventTime = requestEventTime(); var root = scheduleUpdateOnFiber(fiber, lane, eventTime); @@ -11796,6 +12175,8 @@ function dispatchReducerAction(fiber, queue, action) { entangleTransitionUpdate(root, queue, lane); } } + + markUpdateInDevTools(fiber, lane); } function dispatchSetState(fiber, queue, action) { @@ -11875,6 +12256,8 @@ function dispatchSetState(fiber, queue, action) { entangleTransitionUpdate(root, queue, lane); } } + + markUpdateInDevTools(fiber, lane); } function isRenderPhaseUpdate(fiber) { @@ -11953,6 +12336,12 @@ function entangleTransitionUpdate(root, queue, lane) { } } +function markUpdateInDevTools(fiber, lane, action) { + { + markStateUpdateScheduled(fiber, lane); + } +} + var ContextOnlyDispatcher = { readContext: readContext, useCallback: throwInvalidHookError, @@ -11970,7 +12359,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, + useId: throwInvalidHookError, unstable_isNewReconciler: enableNewReconciler }; @@ -12107,10 +12496,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; mountHookTypesDev(); - return mountOpaqueIdentifier(); + return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12215,10 +12604,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; updateHookTypesDev(); - return mountOpaqueIdentifier(); + return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12323,10 +12712,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; updateHookTypesDev(); - return updateOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12431,10 +12820,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; updateHookTypesDev(); - return rerenderOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12555,11 +12944,11 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; warnInvalidHookAccess(); mountHookTypesDev(); - return mountOpaqueIdentifier(); + return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12680,11 +13069,11 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; warnInvalidHookAccess(); updateHookTypesDev(); - return updateOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12805,11 +13194,11 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; warnInvalidHookAccess(); updateHookTypesDev(); - return rerenderOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -13265,165 +13654,158 @@ function resetSuspendedComponent(sourceFiber, rootRenderLanes) { sourceFiber.memoizedState = currentSource.memoizedState; sourceFiber.lanes = currentSource.lanes; } else { - sourceFiber.updateQueue = null; - sourceFiber.memoizedState = null; - } - } -} - -function markNearestSuspenseBoundaryShouldCapture( - returnFiber, - sourceFiber, - root, - rootRenderLanes -) { - var hasInvisibleParentBoundary = hasSuspenseContext( - suspenseStackCursor.current, - InvisibleParentSuspenseContext - ); - var node = returnFiber; - - do { - if ( - node.tag === SuspenseComponent && - shouldCaptureSuspense(node, hasInvisibleParentBoundary) - ) { - // Found the nearest boundary. - var suspenseBoundary = node; // This marks a Suspense boundary so that when we're unwinding the stack, - // it captures the suspended "exception" and does a second (fallback) pass. - - if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { - // Legacy Mode Suspense - // - // If the boundary is in legacy mode, we should *not* - // suspend the commit. Pretend as if the suspended component rendered - // null and keep rendering. When the Suspense boundary completes, - // we'll do a second pass to render the fallback. - if (suspenseBoundary === returnFiber) { - // Special case where we suspended while reconciling the children of - // a Suspense boundary's inner Offscreen wrapper fiber. This happens - // when a React.lazy component is a direct child of a - // Suspense boundary. - // - // Suspense boundaries are implemented as multiple fibers, but they - // are a single conceptual unit. The legacy mode behavior where we - // pretend the suspended fiber committed as `null` won't work, - // because in this case the "suspended" fiber is the inner - // Offscreen wrapper. - // - // Because the contents of the boundary haven't started rendering - // yet (i.e. nothing in the tree has partially rendered) we can - // switch to the regular, concurrent mode behavior: mark the - // boundary with ShouldCapture and enter the unwind phase. - suspenseBoundary.flags |= ShouldCapture; - } else { - suspenseBoundary.flags |= DidCapture; - sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. - // But we shouldn't call any lifecycle methods or callbacks. Remove - // all lifecycle effect tags. - - sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); - - if (enablePersistentOffscreenHostContainer) { - // Another legacy Suspense quirk. In persistent mode, if this is the - // initial mount, override the props of the host container to hide - // its contents. - var currentSuspenseBoundary = suspenseBoundary.alternate; - - if (currentSuspenseBoundary === null) { - var offscreenFiber = suspenseBoundary.child; - var offscreenContainer = offscreenFiber.child; - - if (offscreenContainer !== null) { - var children = offscreenContainer.memoizedProps.children; - var containerProps = getOffscreenContainerProps( - "hidden", - children - ); - offscreenContainer.pendingProps = containerProps; - offscreenContainer.memoizedProps = containerProps; - } - } - } - - if (sourceFiber.tag === ClassComponent) { - var currentSourceFiber = sourceFiber.alternate; - - if (currentSourceFiber === null) { - // This is a new mount. Change the tag so it's not mistaken for a - // completed class component. For example, we should not call - // componentWillUnmount if it is deleted. - sourceFiber.tag = IncompleteClassComponent; - } else { - // When we try rendering again, we should not reuse the current fiber, - // since it's known to be in an inconsistent state. Use a force update to - // prevent a bail out. - var update = createUpdate(NoTimestamp, SyncLane); - update.tag = ForceUpdate; - enqueueUpdate(sourceFiber, update); - } - } // The source fiber did not complete. Mark it with Sync priority to - // indicate that it still has pending work. - - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); - } - - return suspenseBoundary; - } // Confirmed that the boundary is in a concurrent mode tree. Continue - // with the normal suspend path. - // - // After this we'll use a set of heuristics to determine whether this - // render pass will run to completion or restart or "suspend" the commit. - // The actual logic for this is spread out in different places. - // - // This first principle is that if we're going to suspend when we complete - // a root, then we should also restart if we get an update or ping that - // might unsuspend it, and vice versa. The only reason to suspend is - // because you think you might want to restart before committing. However, - // it doesn't make sense to restart only while in the period we're suspended. - // - // Restarting too aggressively is also not good because it starves out any - // intermediate loading state. So we use heuristics to determine when. - // Suspense Heuristics - // - // If nothing threw a Promise or all the same fallbacks are already showing, - // then don't suspend/restart. - // - // If this is an initial render of a new tree of Suspense boundaries and - // those trigger a fallback, then don't suspend/restart. We want to ensure - // that we can show the initial loading state as quickly as possible. - // - // If we hit a "Delayed" case, such as when we'd switch from content back into - // a fallback, then we should always suspend/restart. Transitions apply - // to this case. If none is defined, JND is used instead. - // - // If we're already showing a fallback and it gets "retried", allowing us to show - // another level, but there's still an inner boundary that would show a fallback, - // then we suspend/restart for 500ms since the last time we showed a fallback - // anywhere in the tree. This effectively throttles progressive loading into a - // consistent train of commits. This also gives us an opportunity to restart to - // get to the completed state slightly earlier. - // - // If there's ambiguity due to batching it's resolved in preference of: - // 1) "delayed", 2) "initial render", 3) "retry". - // - // We want to ensure that a "busy" state doesn't get force committed. We want to - // ensure that new initial loading states can commit as soon as possible. + sourceFiber.updateQueue = null; + sourceFiber.memoizedState = null; + } + } +} - suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in - // the begin phase to prevent an early bailout. +function getNearestSuspenseBoundaryToCapture(returnFiber) { + var node = returnFiber; - suspenseBoundary.lanes = rootRenderLanes; - return suspenseBoundary; + do { + if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) { + return node; } // This boundary already captured during this render. Continue to the next // boundary. node = node.return; - } while (node !== null); // Could not find a Suspense boundary capable of capturing. + } while (node !== null); return null; } +function markSuspenseBoundaryShouldCapture( + suspenseBoundary, + returnFiber, + sourceFiber, + root, + rootRenderLanes +) { + // This marks a Suspense boundary so that when we're unwinding the stack, + // it captures the suspended "exception" and does a second (fallback) pass. + if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { + // Legacy Mode Suspense + // + // If the boundary is in legacy mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. When the Suspense boundary completes, + // we'll do a second pass to render the fallback. + if (suspenseBoundary === returnFiber) { + // Special case where we suspended while reconciling the children of + // a Suspense boundary's inner Offscreen wrapper fiber. This happens + // when a React.lazy component is a direct child of a + // Suspense boundary. + // + // Suspense boundaries are implemented as multiple fibers, but they + // are a single conceptual unit. The legacy mode behavior where we + // pretend the suspended fiber committed as `null` won't work, + // because in this case the "suspended" fiber is the inner + // Offscreen wrapper. + // + // Because the contents of the boundary haven't started rendering + // yet (i.e. nothing in the tree has partially rendered) we can + // switch to the regular, concurrent mode behavior: mark the + // boundary with ShouldCapture and enter the unwind phase. + suspenseBoundary.flags |= ShouldCapture; + } else { + suspenseBoundary.flags |= DidCapture; + sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. + // But we shouldn't call any lifecycle methods or callbacks. Remove + // all lifecycle effect tags. + + sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); + + if (enablePersistentOffscreenHostContainer) { + // Another legacy Suspense quirk. In persistent mode, if this is the + // initial mount, override the props of the host container to hide + // its contents. + var currentSuspenseBoundary = suspenseBoundary.alternate; + + if (currentSuspenseBoundary === null) { + var offscreenFiber = suspenseBoundary.child; + var offscreenContainer = offscreenFiber.child; + + if (offscreenContainer !== null) { + var children = offscreenContainer.memoizedProps.children; + var containerProps = getOffscreenContainerProps("hidden", children); + offscreenContainer.pendingProps = containerProps; + offscreenContainer.memoizedProps = containerProps; + } + } + } + + if (sourceFiber.tag === ClassComponent) { + var currentSourceFiber = sourceFiber.alternate; + + if (currentSourceFiber === null) { + // This is a new mount. Change the tag so it's not mistaken for a + // completed class component. For example, we should not call + // componentWillUnmount if it is deleted. + sourceFiber.tag = IncompleteClassComponent; + } else { + // When we try rendering again, we should not reuse the current fiber, + // since it's known to be in an inconsistent state. Use a force update to + // prevent a bail out. + var update = createUpdate(NoTimestamp, SyncLane); + update.tag = ForceUpdate; + enqueueUpdate(sourceFiber, update); + } + } // The source fiber did not complete. Mark it with Sync priority to + // indicate that it still has pending work. + + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); + } + + return suspenseBoundary; + } // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. Transitions apply + // to this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. + + suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in + // the begin phase to prevent an early bailout. + + suspenseBoundary.lanes = rootRenderLanes; + return suspenseBoundary; +} + function throwException( root, returnFiber, @@ -13450,14 +13832,17 @@ function throwException( var wakeable = value; resetSuspendedComponent(sourceFiber); - var suspenseBoundary = markNearestSuspenseBoundaryShouldCapture( - returnFiber, - sourceFiber, - root, - rootRenderLanes - ); + var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber); if (suspenseBoundary !== null) { + suspenseBoundary.flags &= ~ForceClientRender; + markSuspenseBoundaryShouldCapture( + suspenseBoundary, + returnFiber, + sourceFiber, + root, + rootRenderLanes + ); attachWakeableListeners( suspenseBoundary, root, @@ -14045,7 +14430,12 @@ function completeSuspendedOffscreenHostContainer(current, workInProgress) { } function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; + var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing + // to the current tree provider fiber is just as fast and less error-prone. + // Ideally we would have a special version of the work loop only + // for hydration. + + popTreeContext(workInProgress); switch (workInProgress.tag) { case IndeterminateComponent: @@ -14097,7 +14487,7 @@ function completeWork(current, workInProgress, renderLanes) { // Schedule an effect to clear this container at the start of the next commit. // This handles the case of React rendering into a container with previous children. // It's also safe to do for updates too, because current.child would only be null - // if the previous render was null (so the the container would already be empty). + // if the previous render was null (so the container would already be empty). workInProgress.flags |= Snapshot; } } @@ -14238,7 +14628,7 @@ function completeWork(current, workInProgress, renderLanes) { else { var prevState = current.memoizedState; prevDidTimeout = prevState !== null; - } // If the suspended state of the boundary changes, we need to schedule + } // an effect to toggle the subtree's visibility. When we switch from // fallback -> primary, the inner Offscreen fiber schedules this effect // as part of its normal complete phase. But when we switch from @@ -14251,8 +14641,8 @@ function completeWork(current, workInProgress, renderLanes) { // is active that we have to do anything special. if (nextDidTimeout && !prevDidTimeout) { - var offscreenFiber = workInProgress.child; - offscreenFiber.flags |= Visibility; // TODO: This will still suspend a synchronous tree if anything + var _offscreenFiber = workInProgress.child; + _offscreenFiber.flags |= Visibility; // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. @@ -14266,7 +14656,8 @@ function completeWork(current, workInProgress, renderLanes) { // should be able to immediately restart from within throwException. var hasInvisibleChildContext = current === null && - workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + (workInProgress.memoizedProps.unstable_avoidThisFallback !== true || + !enableSuspenseAvoidThisFallback); if ( hasInvisibleChildContext || @@ -14711,8 +15102,13 @@ function updateForwardRef( var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent var nextChildren; + var hasId; prepareToReadContext(workInProgress, renderLanes); + { + markComponentRenderStarted(workInProgress); + } + { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); @@ -14724,6 +15120,7 @@ function updateForwardRef( ref, renderLanes ); + hasId = checkDidRenderIdHook(); if (workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); @@ -14737,6 +15134,7 @@ function updateForwardRef( ref, renderLanes ); + hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } @@ -14745,10 +15143,14 @@ function updateForwardRef( setIsRendering(false); } + { + markComponentRenderStopped(); + } + if (current !== null && !didReceiveUpdate) { bailoutHooks(current, workInProgress, renderLanes); return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. + } workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, nextChildren, renderLanes); @@ -15181,8 +15583,13 @@ function updateFunctionComponent( } var nextChildren; + var hasId; prepareToReadContext(workInProgress, renderLanes); + { + markComponentRenderStarted(workInProgress); + } + { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); @@ -15194,6 +15601,7 @@ function updateFunctionComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); if (workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); @@ -15207,6 +15615,7 @@ function updateFunctionComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } @@ -15215,10 +15624,14 @@ function updateFunctionComponent( setIsRendering(false); } + { + markComponentRenderStopped(); + } + if (current !== null && !didReceiveUpdate) { bailoutHooks(current, workInProgress, renderLanes); return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. + } workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, nextChildren, renderLanes); @@ -15402,6 +15815,10 @@ function finishClassComponent( stopProfilerTimerIfRunning(); } } else { + { + markComponentRenderStarted(workInProgress); + } + { setIsRendering(true); nextChildren = instance.render(); @@ -15418,6 +15835,10 @@ function finishClassComponent( setIsRendering(false); } + + { + markComponentRenderStopped(); + } } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; @@ -15747,6 +16168,11 @@ function mountIndeterminateComponent( prepareToReadContext(workInProgress, renderLanes); var value; + var hasId; + + { + markComponentRenderStarted(workInProgress); + } { if ( @@ -15781,9 +16207,14 @@ function mountIndeterminateComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); setIsRendering(false); } + { + markComponentRenderStopped(); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; { @@ -15887,6 +16318,7 @@ function mountIndeterminateComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } @@ -15974,6 +16406,7 @@ function validateFunctionComponentInDev(workInProgress, Component) { var SUSPENDED_MARKER = { dehydrated: null, + treeContext: null, retryLane: NoLane }; @@ -16047,7 +16480,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { // Mark this subtree context as having at least one invisible parent that could // handle the fallback state. // Avoided boundaries are not considered since they cannot handle preferred fallback states. - if (nextProps.unstable_avoidThisFallback !== true) { + { suspenseContext = addSubtreeSuspenseContext( suspenseContext, InvisibleParentSuspenseContext @@ -17006,6 +17439,10 @@ function updateContextConsumer(current, workInProgress, renderLanes) { prepareToReadContext(workInProgress, renderLanes); var newValue = readContext(context); + { + markComponentRenderStarted(workInProgress); + } + var newChildren; { @@ -17015,6 +17452,10 @@ function updateContextConsumer(current, workInProgress, renderLanes) { setIsRendering(false); } + { + markComponentRenderStopped(); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, newChildren, renderLanes); return workInProgress.child; @@ -17562,6 +18003,12 @@ function beginWork(current, workInProgress, renderLanes) { } function unwindWork(workInProgress, renderLanes) { + // Note: This intentionally doesn't check if we're hydrating because comparing + // to the current tree provider fiber is just as fast and less error-prone. + // Ideally we would have a special version of the work loop only + // for hydration. + popTreeContext(workInProgress); + switch (workInProgress.tag) { case ClassComponent: { var Component = workInProgress.type; @@ -17657,6 +18104,12 @@ function unwindWork(workInProgress, renderLanes) { } function unwindInterruptedWork(interruptedWork, renderLanes) { + // Note: This intentionally doesn't check if we're hydrating because comparing + // to the current tree provider fiber is just as fast and less error-prone. + // Ideally we would have a special version of the work loop only + // for hydration. + popTreeContext(interruptedWork); + switch (interruptedWork.tag) { case ClassComponent: { var childContextTypes = interruptedWork.type.childContextTypes; @@ -17976,7 +18429,23 @@ function commitHookEffectListUnmount( effect.destroy = undefined; if (destroy !== undefined) { + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectUnmountStarted(finishedWork); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectUnmountStarted(finishedWork); + } + } + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); + + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectUnmountStopped(); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectUnmountStopped(); + } + } } } @@ -17985,7 +18454,7 @@ function commitHookEffectListUnmount( } } -function commitHookEffectListMount(tag, finishedWork) { +function commitHookEffectListMount(flags, finishedWork) { var updateQueue = finishedWork.updateQueue; var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; @@ -17994,11 +18463,26 @@ function commitHookEffectListMount(tag, finishedWork) { var effect = firstEffect; do { - if ((effect.tag & tag) === tag) { - // Mount + if ((effect.tag & flags) === flags) { + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectMountStarted(finishedWork); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectMountStarted(finishedWork); + } + } // Mount + var create = effect.create; effect.destroy = create(); + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectMountStopped(); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectMountStopped(); + } + } + { var destroy = effect.destroy; @@ -18524,10 +19008,13 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor) { tag = _effect.tag; if (destroy !== undefined) { - if ( - (tag & Insertion) !== NoFlags$1 || - (tag & Layout) !== NoFlags$1 - ) { + if ((tag & Insertion) !== NoFlags$1) { + safelyCallDestroy(current, nearestMountedAncestor, destroy); + } else if ((tag & Layout) !== NoFlags$1) { + { + markComponentLayoutEffectUnmountStarted(current); + } + if (current.mode & ProfileMode) { startLayoutEffectTimer(); safelyCallDestroy(current, nearestMountedAncestor, destroy); @@ -18535,6 +19022,10 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor) { } else { safelyCallDestroy(current, nearestMountedAncestor, destroy); } + + { + markComponentLayoutEffectUnmountStopped(); + } } } @@ -19487,11 +19978,44 @@ if (typeof Symbol === "function" && Symbol.for) { TEXT_TYPE = symbolFor$1("selector.text"); } +var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; +function isLegacyActEnvironment(fiber) { + { + // Legacy mode. We preserve the behavior of React 17's act. It assumes an + // act environment whenever `jest` is defined, but you can still turn off + // spurious warnings by setting IS_REACT_ACT_ENVIRONMENT explicitly + // to false. + var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" + ? IS_REACT_ACT_ENVIRONMENT + : undefined; // $FlowExpectedError - Flow doesn't know about jest + return warnsIfNotActing; + } +} +function isConcurrentActEnvironment() { + { + var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" + ? IS_REACT_ACT_ENVIRONMENT + : undefined; + + if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) { + // TODO: Include link to relevant documentation page. + error( + "The current testing environment is not configured to support " + + "act(...)" + ); + } + + return isReactActEnvironmentGlobal; + } +} + var ceil = Math.ceil; var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; + ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; var NoContext = /* */ 0; @@ -19544,7 +20068,9 @@ var workInProgressRootIncludedLanes = NoLanes; // The work left over by componen var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. -var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. +var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). + +var workInProgressRootRenderPhaseUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. var workInProgressRootPingedLanes = NoLanes; // The most recent time we committed a fallback. This lets us ensure a train // model where we don't commit new loading states in too quick succession. @@ -19571,7 +20097,7 @@ var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfi var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; var pendingPassiveEffectsLanes = NoLanes; -var pendingPassiveProfilerEffects = []; // Use these to prevent an infinite loop of nested updates +var pendingPassiveProfilerEffects = []; var NESTED_UPDATE_LIMIT = 50; var nestedUpdateCount = 0; @@ -19676,60 +20202,80 @@ function requestRetryLane(fiber) { function scheduleUpdateOnFiber(fiber, lane, eventTime) { checkForNestedUpdates(); - warnAboutRenderPhaseUpdatesInDEV(fiber); var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (root === null) { return null; - } - - { - if (isDevToolsPresent) { - addFiberToLanesMap(root, fiber, lane); - } } // Mark that the root has a pending update. markRootUpdated(root, lane, eventTime); - if (root === workInProgressRoot) { - // Received an update to a tree that's in the middle of rendering. Mark - // that there was an interleaved update work on this root. Unless the - // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render - // phase update. In that case, we don't treat render phase updates as if - // they were interleaved, for backwards compat reasons. - if ((executionContext & RenderContext) === NoContext) { - workInProgressRootUpdatedLanes = mergeLanes( - workInProgressRootUpdatedLanes, - lane - ); + if ( + (executionContext & RenderContext) !== NoLanes && + root === workInProgressRoot + ) { + // This update was dispatched during the render phase. This is a mistake + // if the update originates from user space (with the exception of local + // hook updates, which are handled differently and don't reach this + // function), but there are some internal React features that use this as + // an implementation detail, like selective hydration. + warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase + + workInProgressRootRenderPhaseUpdatedLanes = mergeLanes( + workInProgressRootRenderPhaseUpdatedLanes, + lane + ); + } else { + // This is a normal update, scheduled from outside the render phase. For + // example, during an input event. + { + if (isDevToolsPresent) { + addFiberToLanesMap(root, fiber, lane); + } } - if (workInProgressRootExitStatus === RootSuspendedWithDelay) { - // The root already suspended with a delay, which means this render - // definitely won't finish. Since we have a new update, let's mark it as - // suspended now, right before marking the incoming update. This has the - // effect of interrupting the current render and switching to the update. - // TODO: Make sure this doesn't override pings that happen while we've - // already started rendering. - markRootSuspended$1(root, workInProgressRootRenderLanes); + warnIfUpdatesNotWrappedWithActDEV(fiber); + + if (root === workInProgressRoot) { + // Received an update to a tree that's in the middle of rendering. Mark + // that there was an interleaved update work on this root. Unless the + // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render + // phase update. In that case, we don't treat render phase updates as if + // they were interleaved, for backwards compat reasons. + if ((executionContext & RenderContext) === NoContext) { + workInProgressRootInterleavedUpdatedLanes = mergeLanes( + workInProgressRootInterleavedUpdatedLanes, + lane + ); + } + + if (workInProgressRootExitStatus === RootSuspendedWithDelay) { + // The root already suspended with a delay, which means this render + // definitely won't finish. Since we have a new update, let's mark it as + // suspended now, right before marking the incoming update. This has the + // effect of interrupting the current render and switching to the update. + // TODO: Make sure this doesn't override pings that happen while we've + // already started rendering. + markRootSuspended$1(root, workInProgressRootRenderLanes); + } } - } - ensureRootIsScheduled(root, eventTime); + ensureRootIsScheduled(root, eventTime); - if ( - lane === SyncLane && - executionContext === NoContext && - (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy - ) { - // Flush the synchronous work now, unless we're already working or inside - // a batch. This is intentionally inside scheduleUpdateOnFiber instead of - // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initiated - // updates, to preserve historical behavior of legacy mode. - resetRenderTimer(); - flushSyncCallbacksOnlyInLegacyMode(); + if ( + lane === SyncLane && + executionContext === NoContext && + (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. + !ReactCurrentActQueue$1.isBatchingLegacy + ) { + // Flush the synchronous work now, unless we're already working or inside + // a batch. This is intentionally inside scheduleUpdateOnFiber instead of + // scheduleCallbackForFiber to preserve the ability to schedule a callback + // without immediately flushing it. We only do this for user-initiated + // updates, to preserve historical behavior of legacy mode. + resetRenderTimer(); + flushSyncCallbacksOnlyInLegacyMode(); + } } return root; @@ -19834,7 +20380,7 @@ function ensureRootIsScheduled(root, currentTime) { // Scheduler task, rather than an `act` task, cancel it and re-scheduled // on the `act` queue. !( - ReactCurrentActQueue.current !== null && + ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode ) ) { @@ -19866,8 +20412,8 @@ function ensureRootIsScheduled(root, currentTime) { // Special case: Sync React callbacks are scheduled on a special // internal queue if (root.tag === LegacyRoot) { - if (ReactCurrentActQueue.isBatchingLegacy !== null) { - ReactCurrentActQueue.didScheduleLegacyUpdate = true; + if (ReactCurrentActQueue$1.isBatchingLegacy !== null) { + ReactCurrentActQueue$1.didScheduleLegacyUpdate = true; } scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root)); @@ -20053,11 +20599,28 @@ function recoverFromConcurrentError(root, errorRetryLanes) { { errorHydratingContainer(root.containerInfo); } + } + + var exitStatus; + var MAX_ERROR_RETRY_ATTEMPTS = 50; + + for (var i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) { + exitStatus = renderRootSync(root, errorRetryLanes); + + if ( + exitStatus === RootErrored && + workInProgressRootRenderPhaseUpdatedLanes !== NoLanes + ) { + // There was a render phase update during this render. Some internal React + // implementation details may use this as a trick to schedule another + // render pass. To protect against an inifinite loop, eventually + // we'll give up. + continue; + } - clearContainer(root.containerInfo); + break; } - var exitStatus = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; return exitStatus; } @@ -20178,7 +20741,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { function isRenderConsistentWithExternalStores(finishedWork) { // Search the rendered tree for external store reads, and check whether the - // stores were mutated in a concurrent event. Intentionally using a iterative + // stores were mutated in a concurrent event. Intentionally using an iterative // loop instead of recursion so we can exit early. var node = finishedWork; @@ -20244,7 +20807,10 @@ function markRootSuspended$1(root, suspendedLanes) { // TODO: Lol maybe there's a better way to factor this besides this // obnoxiously named function :) suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes); + suspendedLanes = removeLanes( + suspendedLanes, + workInProgressRootInterleavedUpdatedLanes + ); markRootSuspended(root, suspendedLanes); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -20270,31 +20836,16 @@ function performSyncWorkOnRoot(root) { var exitStatus = renderRootSync(root, lanes); if (root.tag !== LegacyRoot && exitStatus === RootErrored) { - var prevExecutionContext = executionContext; - executionContext |= RetryAfterError; // If an error occurred during hydration, - // discard server response and fall back to client side render. - - if (root.isDehydrated) { - root.isDehydrated = false; - - { - errorHydratingContainer(root.containerInfo); - } - - clearContainer(root.containerInfo); - } // If something threw an error, try rendering one more time. We'll render + // If something threw an error, try rendering one more time. We'll render // synchronously to block concurrent data mutations, and we'll includes // all pending updates are included. If it still fails after the second // attempt, we'll give up and commit the resulting tree. - var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; - exitStatus = renderRootSync(root, lanes); + exitStatus = recoverFromConcurrentError(root, errorRetryLanes); } - - executionContext = prevExecutionContext; } if (exitStatus === RootFatalErrored) { @@ -20327,7 +20878,7 @@ function batchedUpdates$1(fn, a) { if ( executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy + !ReactCurrentActQueue$1.isBatchingLegacy ) { resetRenderTimer(); flushSyncCallbacksOnlyInLegacyMode(); @@ -20415,7 +20966,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootExitStatus = RootIncomplete; workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; - workInProgressRootUpdatedLanes = NoLanes; + workInProgressRootInterleavedUpdatedLanes = NoLanes; + workInProgressRootRenderPhaseUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; enqueueInterleavedUpdates(); @@ -20557,7 +21109,7 @@ function renderDidSuspendDelayIfPossible() { if ( workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -20608,6 +21160,10 @@ function renderRootSync(root, lanes) { prepareFreshStack(root, lanes); } + { + markRenderStarted(lanes); + } + do { try { workLoopSync(); @@ -20629,6 +21185,10 @@ function renderRootSync(root, lanes) { ); } + { + markRenderStopped(); + } // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; workInProgressRootRenderLanes = NoLanes; return workInProgressRootExitStatus; @@ -20670,6 +21230,10 @@ function renderRootConcurrent(root, lanes) { prepareFreshStack(root, lanes); } + { + markRenderStarted(lanes); + } + do { try { workLoopConcurrent(); @@ -20684,8 +21248,18 @@ function renderRootConcurrent(root, lanes) { executionContext = prevExecutionContext; if (workInProgress !== null) { + // Still work remaining. + { + markRenderYielded(); + } + return RootIncomplete; } else { + // Completed the tree. + { + markRenderStopped(); + } // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; workInProgressRootRenderLanes = NoLanes; // Return the final exit status. @@ -20857,7 +21431,15 @@ function commitRootImpl(root, renderPriorityLevel) { var finishedWork = root.finishedWork; var lanes = root.finishedLanes; + { + markCommitStarted(lanes); + } + if (finishedWork === null) { + { + markCommitStopped(); + } + return null; } else { { @@ -20906,7 +21488,10 @@ function commitRootImpl(root, renderPriorityLevel) { if (!rootDoesHavePassiveEffects) { rootDoesHavePassiveEffects = true; scheduleCallback$1(NormalPriority, function() { - flushPassiveEffects(); + flushPassiveEffects(); // This render triggered passive effects: release the root cache pool + // *after* passive effects fire to avoid freeing a cache pool that may + // be referenced by a node in the tree (HostRoot, Cache boundary etc) + return null; }); } @@ -20960,7 +21545,15 @@ function commitRootImpl(root, renderPriorityLevel) { root.current = finishedWork; // The next phase is the layout phase, where we call effects that read + { + markLayoutEffectsStarted(lanes); + } + commitLayoutEffects(finishedWork, root, lanes); + + { + markLayoutEffectsStopped(); + } // opportunity to paint. requestPaint(); @@ -21064,6 +21657,10 @@ function commitRootImpl(root, renderPriorityLevel) { flushSyncCallbacks(); + { + markCommitStopped(); + } + return null; } @@ -21086,7 +21683,7 @@ function flushPassiveEffects() { return flushPassiveEffectsImpl(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$2.transition = prevTransition; // Once passive effects have run for the tree - giving components a } } @@ -21112,6 +21709,7 @@ function flushPassiveEffectsImpl() { } var root = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; // TODO: This is sometimes out of sync with rootWithPendingPassiveEffects. // Figure out why and fix it. It's not causing any known issues (probably // because it's only used for profiling), but it's a refactor hazard. @@ -21122,6 +21720,10 @@ function flushPassiveEffectsImpl() { throw new Error("Cannot flush passive effects while already rendering."); } + { + markPassiveEffectsStarted(lanes); + } + var prevExecutionContext = executionContext; executionContext |= CommitContext; commitPassiveUnmountEffects(root.current); @@ -21137,6 +21739,10 @@ function flushPassiveEffectsImpl() { } } + { + markPassiveEffectsStopped(); + } + { commitDoubleInvokeEffectsInDEV(root.current, true); } @@ -21267,6 +21873,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { var eventTime = requestEventTime(); markRootPinged(root, pingedLanes); + warnIfSuspenseResolutionNotWrappedWithActDEV(root); if ( workInProgressRoot === root && @@ -21592,11 +22199,7 @@ var didWarnAboutUpdateInRenderForAnotherComponent; function warnAboutRenderPhaseUpdatesInDEV(fiber) { { - if ( - isRendering && - (executionContext & RenderContext) !== NoContext && - !getIsUpdatingOpaqueValueInRenderPhaseInDEV() - ) { + if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { switch (fiber.tag) { case FunctionComponent: case ForwardRef: @@ -21661,7 +22264,7 @@ function scheduleCallback$1(priorityLevel, callback) { { // If we're currently inside an `act` scope, bypass Scheduler and push to // the `act` queue instead. - var actQueue = ReactCurrentActQueue.current; + var actQueue = ReactCurrentActQueue$1.current; if (actQueue !== null) { actQueue.push(callback); @@ -21682,7 +22285,92 @@ function cancelCallback$1(callbackNode) { function shouldForceFlushFallbacksInDEV() { // Never force flush in production. This function should get stripped out. - return ReactCurrentActQueue.current !== null; + return ReactCurrentActQueue$1.current !== null; +} + +function warnIfUpdatesNotWrappedWithActDEV(fiber) { + { + if (fiber.mode & ConcurrentMode) { + if (!isConcurrentActEnvironment()) { + // Not in an act environment. No need to warn. + return; + } + } else { + // Legacy mode has additional cases where we suppress a warning. + if (!isLegacyActEnvironment()) { + // Not in an act environment. No need to warn. + return; + } + + if (executionContext !== NoContext) { + // Legacy mode doesn't warn if the update is batched, i.e. + // batchedUpdates or flushSync. + return; + } + + if ( + fiber.tag !== FunctionComponent && + fiber.tag !== ForwardRef && + fiber.tag !== SimpleMemoComponent + ) { + // For backwards compatibility with pre-hooks code, legacy mode only + // warns for updates that originate from a hook. + return; + } + } + + if (ReactCurrentActQueue$1.current === null) { + var previousFiber = current; + + try { + setCurrentFiber(fiber); + + error( + "An update to %s inside a test was not wrapped in act(...).\n\n" + + "When testing, code that causes React state updates should be " + + "wrapped into act(...):\n\n" + + "act(() => {\n" + + " /* fire events that update state */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://reactjs.org/link/wrap-tests-with-act", + getComponentNameFromFiber(fiber) + ); + } finally { + if (previousFiber) { + setCurrentFiber(fiber); + } else { + resetCurrentFiber(); + } + } + } + } +} + +function warnIfSuspenseResolutionNotWrappedWithActDEV(root) { + { + if ( + root.tag !== LegacyRoot && + isConcurrentActEnvironment() && + ReactCurrentActQueue$1.current === null + ) { + error( + "A suspended resource finished loading inside a test, but the event " + + "was not wrapped in act(...).\n\n" + + "When testing, code that resolves suspended data should be wrapped " + + "into act(...):\n\n" + + "act(() => {\n" + + " /* finish loading suspended data */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://reactjs.org/link/wrap-tests-with-act" + ); + } + } } /* eslint-disable react-internal/prod-error-codes */ @@ -22755,7 +23443,7 @@ function assignFiberPropertiesInDEV(target, source) { return target; } -function FiberRootNode(containerInfo, tag, hydrate) { +function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.tag = tag; this.containerInfo = containerInfo; this.pendingChildren = null; @@ -22778,6 +23466,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.finishedLanes = NoLanes; this.entangledLanes = NoLanes; this.entanglements = createLaneMap(NoLanes); + this.identifierPrefix = identifierPrefix; { this.effectDuration = 0; @@ -22812,9 +23501,10 @@ function createFiberRoot( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride + concurrentUpdatesByDefaultOverride, + identifierPrefix ) { - var root = new FiberRootNode(containerInfo, tag, hydrate); + var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix); // stateNode is any. var uninitializedFiber = createHostRootFiber( @@ -22836,6 +23526,8 @@ function createFiberRoot( return root; } +var ReactVersion = "18.0.0-rc.0-51947a14b-20220113"; + function createPortal( children, containerInfo, // TODO: figure out the API for cross-renderer implementation. @@ -22961,7 +23653,8 @@ function createContainer( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride + concurrentUpdatesByDefaultOverride, + identifierPrefix ) { return createFiberRoot( containerInfo, @@ -22969,7 +23662,8 @@ function createContainer( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride + concurrentUpdatesByDefaultOverride, + identifierPrefix ); } function updateContainer(element, container, parentComponent, callback) { @@ -22981,6 +23675,10 @@ function updateContainer(element, container, parentComponent, callback) { var eventTime = requestEventTime(); var lane = requestUpdateLane(current$1); + { + markRenderScheduled(lane); + } + var context = getContextForSubtree(parentComponent); if (container.context === null) { @@ -23759,7 +24457,8 @@ function render(element, containerTag, callback, concurrentRoot) { false, null, false, - null + null, + "" ); roots.set(containerTag, root); } @@ -23815,5 +24514,14 @@ exports.sendAccessibilityEvent = sendAccessibilityEvent; exports.stopSurface = stopSurface; exports.unmountComponentAtNode = unmountComponentAtNode; + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); +} + })(); } diff --git a/Libraries/Renderer/implementations/ReactFabric-dev.js b/Libraries/Renderer/implementations/ReactFabric-dev.js index c668e0af3477..39be9100e5e6 100644 --- a/Libraries/Renderer/implementations/ReactFabric-dev.js +++ b/Libraries/Renderer/implementations/ReactFabric-dev.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js index 73b6f5eb765f..bd8208a27d7e 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<0641813b146d4710c4029f156d65891e>> + * @generated SignedSource<> */ "use strict"; @@ -927,7 +927,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_219 = { +var injectedNamesToPlugins$jscomp$inline_220 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -962,33 +962,33 @@ var injectedNamesToPlugins$jscomp$inline_219 = { } } }, - isOrderingDirty$jscomp$inline_220 = !1, - pluginName$jscomp$inline_221; -for (pluginName$jscomp$inline_221 in injectedNamesToPlugins$jscomp$inline_219) + isOrderingDirty$jscomp$inline_221 = !1, + pluginName$jscomp$inline_222; +for (pluginName$jscomp$inline_222 in injectedNamesToPlugins$jscomp$inline_220) if ( - injectedNamesToPlugins$jscomp$inline_219.hasOwnProperty( - pluginName$jscomp$inline_221 + injectedNamesToPlugins$jscomp$inline_220.hasOwnProperty( + pluginName$jscomp$inline_222 ) ) { - var pluginModule$jscomp$inline_222 = - injectedNamesToPlugins$jscomp$inline_219[pluginName$jscomp$inline_221]; + var pluginModule$jscomp$inline_223 = + injectedNamesToPlugins$jscomp$inline_220[pluginName$jscomp$inline_222]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_221) || - namesToPlugins[pluginName$jscomp$inline_221] !== - pluginModule$jscomp$inline_222 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_222) || + namesToPlugins[pluginName$jscomp$inline_222] !== + pluginModule$jscomp$inline_223 ) { - if (namesToPlugins[pluginName$jscomp$inline_221]) + if (namesToPlugins[pluginName$jscomp$inline_222]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_221 + "`.") + (pluginName$jscomp$inline_222 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_221 - ] = pluginModule$jscomp$inline_222; - isOrderingDirty$jscomp$inline_220 = !0; + pluginName$jscomp$inline_222 + ] = pluginModule$jscomp$inline_223; + isOrderingDirty$jscomp$inline_221 = !0; } } -isOrderingDirty$jscomp$inline_220 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_221 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1619,6 +1619,19 @@ function onCommitRoot(root) { ); } catch (err) {} } +function injectProfilingHooks() {} +function getLaneLabelMap() { + for (var map = new Map(), lane = 1, index$3 = 0; 31 > index$3; index$3++) + map.set(lane, void 0), (lane *= 2); + return map; +} +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, + log = Math.log, + LN2 = Math.LN2; +function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; +} var nextTransitionLane = 64, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { @@ -1784,30 +1797,24 @@ function markRootFinished(root, remainingLanes) { remainingLanes = root.entanglements; var eventTimes = root.eventTimes; for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) { - var index$7 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$7; - remainingLanes[index$7] = 0; - eventTimes[index$7] = -1; - root[index$7] = -1; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + eventTimes[index$8] = -1; + root[index$8] = -1; noLongerPendingLanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$8 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$8; - (lane & entangledLanes) | (root[index$8] & entangledLanes) && - (root[index$8] |= entangledLanes); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, - log = Math.log, - LN2 = Math.LN2; -function clz32Fallback(lanes) { - return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; -} var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; @@ -1819,11 +1826,6 @@ function lanesToEventPriority(lanes) { : 4 : 1; } -function shim() { - throw Error( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." - ); -} function shim$1() { throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." @@ -2128,12 +2130,14 @@ function shallowEqual(objA, objB) { var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; - for (keysB = 0; keysB < keysA.length; keysB++) + for (keysB = 0; keysB < keysA.length; keysB++) { + var currentKey = keysA[keysB]; if ( - !hasOwnProperty.call(objB, keysA[keysB]) || - !objectIs(objA[keysA[keysB]], objB[keysA[keysB]]) + !hasOwnProperty.call(objB, currentKey) || + !objectIs(objA[currentKey], objB[currentKey]) ) return !1; + } return !0; } function describeFiber(fiber) { @@ -2631,6 +2635,26 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { "function" === typeof instance.componentDidMount && (workInProgress.flags |= 4); } +var forkStack = [], + forkStackIndex = 0, + treeForkProvider = null, + idStack = [], + idStackIndex = 0, + treeContextProvider = null; +function popTreeContext(workInProgress) { + for (; workInProgress === treeForkProvider; ) + (treeForkProvider = forkStack[--forkStackIndex]), + (forkStack[forkStackIndex] = null), + --forkStackIndex, + (forkStack[forkStackIndex] = null); + for (; workInProgress === treeContextProvider; ) + (treeContextProvider = idStack[--idStackIndex]), + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -2725,7 +2749,8 @@ function ChildReconciler(shouldTrackSideEffects) { } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; - if (!shouldTrackSideEffects) return lastPlacedIndex; + if (!shouldTrackSideEffects) + return (newFiber.flags |= 1048576), lastPlacedIndex; newIndex = newFiber.alternate; if (null !== newIndex) return ( @@ -2816,7 +2841,10 @@ function ChildReconciler(shouldTrackSideEffects) { return current; } function createChild(returnFiber, newChild, lanes) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (newChild = createFiberFromText( "" + newChild, @@ -2870,7 +2898,10 @@ function ChildReconciler(shouldTrackSideEffects) { } function updateSlot(returnFiber, oldFiber, newChild, lanes) { var key = null !== oldFiber ? oldFiber.key : null; - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return null !== key ? null : updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); @@ -2900,7 +2931,10 @@ function ChildReconciler(shouldTrackSideEffects) { newChild, lanes ) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (existingChildren = existingChildren.get(newIdx) || null), updateTextNode(returnFiber, existingChildren, "" + newChild, lanes) @@ -3226,7 +3260,8 @@ function ChildReconciler(shouldTrackSideEffects) { ); throwOnInvalidObjectType(returnFiber, newChild); } - return "string" === typeof newChild || "number" === typeof newChild + return ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), @@ -3329,7 +3364,8 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, - didScheduleRenderPhaseUpdateDuringThisPass = !1; + didScheduleRenderPhaseUpdateDuringThisPass = !1, + globalClientIdCounter = 0; function throwInvalidHookError() { throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." @@ -3752,7 +3788,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(4196352, 8, create, deps); + return mountEffectImpl(8390656, 8, create, deps); } function updateEffect(create, deps) { return updateEffectImpl(2048, 8, create, deps); @@ -3832,6 +3868,9 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } +function updateId() { + return updateWorkInProgressHook().memoizedState; +} function dispatchReducerAction(fiber, queue, action) { var lane = requestUpdateLane(fiber); action = { @@ -3939,7 +3978,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, + useId: throwInvalidHookError, unstable_isNewReconciler: !1 }, HooksDispatcherOnMount = { @@ -4037,8 +4076,12 @@ var ContextOnlyDispatcher = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - throw Error("Not yet implemented"); + useId: function() { + var hook = mountWorkInProgressHook(), + identifierPrefix = workInProgressRoot.identifierPrefix, + globalClientId = globalClientIdCounter++; + identifierPrefix = identifierPrefix + "r:" + globalClientId.toString(32); + return (hook.memoizedState = identifierPrefix); }, unstable_isNewReconciler: !1 }, @@ -4121,9 +4164,7 @@ var ContextOnlyDispatcher = { } return nextSnapshot; }, - useOpaqueIdentifier: function() { - return updateReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }, HooksDispatcherOnRerender = { @@ -4166,9 +4207,7 @@ var ContextOnlyDispatcher = { }, useMutableSource: updateMutableSource, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - return rerenderReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }; function createCapturedValue(value, source) { @@ -4415,14 +4454,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$35 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode), + for (var lastTailNode$36 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$36 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$35 + null === lastTailNode$36 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$35.sibling = null); + : (lastTailNode$36.sibling = null); } } function bubbleProperties(completedWork) { @@ -4432,19 +4471,19 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$36 = completedWork.child; null !== child$36; ) - (newChildLanes |= child$36.lanes | child$36.childLanes), - (subtreeFlags |= child$36.subtreeFlags & 7340032), - (subtreeFlags |= child$36.flags & 7340032), - (child$36.return = completedWork), - (child$36 = child$36.sibling); + for (var child$37 = completedWork.child; null !== child$37; ) + (newChildLanes |= child$37.lanes | child$37.childLanes), + (subtreeFlags |= child$37.subtreeFlags & 14680064), + (subtreeFlags |= child$37.flags & 14680064), + (child$37.return = completedWork), + (child$37 = child$37.sibling); else - for (child$36 = completedWork.child; null !== child$36; ) - (newChildLanes |= child$36.lanes | child$36.childLanes), - (subtreeFlags |= child$36.subtreeFlags), - (subtreeFlags |= child$36.flags), - (child$36.return = completedWork), - (child$36 = child$36.sibling); + for (child$37 = completedWork.child; null !== child$37; ) + (newChildLanes |= child$37.lanes | child$37.childLanes), + (subtreeFlags |= child$37.subtreeFlags), + (subtreeFlags |= child$37.flags), + (child$37.return = completedWork), + (child$37 = child$37.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4476,6 +4515,7 @@ function completeSuspendedOffscreenHostContainer(current, workInProgress) { } function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; + popTreeContext(workInProgress); switch (workInProgress.tag) { case 2: case 16: @@ -4583,11 +4623,7 @@ function completeWork(current, workInProgress, renderLanes) { !renderLanes && ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) - if ( - (null === current && - !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || - 0 !== (suspenseStackCursor.current & 1) - ) + if (null === current || 0 !== (suspenseStackCursor.current & 1)) 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 3); else { @@ -4599,7 +4635,7 @@ function completeWork(current, workInProgress, renderLanes) { workInProgressRootExitStatus = 4; null === workInProgressRoot || (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootUpdatedLanes & 268435455)) || + 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || markRootSuspended$1( workInProgressRoot, workInProgressRootRenderLanes @@ -4654,7 +4690,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (type = current), - (renderLanes.flags &= 7340034), + (renderLanes.flags &= 14680066), (renderedTail = renderLanes.alternate), null === renderedTail ? ((renderLanes.childLanes = 0), @@ -5270,7 +5306,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } -var SUSPENDED_MARKER = { dehydrated: null, retryLane: 0 }; +var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: null }; } @@ -5284,11 +5320,9 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseContext & 2)); - JSCompiler_temp - ? ((showFallback = !0), (workInProgress.flags &= -129)) - : (null !== current && null === current.memoizedState) || - !0 === nextProps.unstable_avoidThisFallback || - (suspenseContext |= 1); + if (JSCompiler_temp) (showFallback = !0), (workInProgress.flags &= -129); + else if (null === current || null !== current.memoizedState) + suspenseContext |= 1; push(suspenseStackCursor, suspenseContext & 1); if (null === current) { current = nextProps.children; @@ -5495,7 +5529,7 @@ function updateSuspenseFallbackChildren( primaryChildren ))), (current.subtreeFlags = - currentPrimaryChildFragment.subtreeFlags & 7340032)); + currentPrimaryChildFragment.subtreeFlags & 14680064)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5719,6 +5753,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate( return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } function unwindWork(workInProgress) { + popTreeContext(workInProgress); switch (workInProgress.tag) { case 1: isContextProvider(workInProgress.type) && popContext(); @@ -5776,6 +5811,13 @@ function safelyDetachRef(current, nearestMountedAncestor) { } else ref.current = null; } +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } +} var shouldFireAfterActiveInstanceBlur = !1; function commitBeforeMutationEffects(root, firstChild) { for (nextEffect = firstChild; null !== nextEffect; ) @@ -5840,7 +5882,7 @@ function commitBeforeMutationEffects(root, firstChild) { function commitHookEffectListUnmount( flags, finishedWork, - nearestMountedAncestor$jscomp$0 + nearestMountedAncestor ) { var updateQueue = finishedWork.updateQueue; updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; @@ -5850,29 +5892,22 @@ function commitHookEffectListUnmount( if ((effect.tag & flags) === flags) { var destroy = effect.destroy; effect.destroy = void 0; - if (void 0 !== destroy) { - var current = finishedWork, - nearestMountedAncestor = nearestMountedAncestor$jscomp$0; - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } - } + void 0 !== destroy && + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); } effect = effect.next; } while (effect !== updateQueue); } } -function commitHookEffectListMount(tag, finishedWork) { +function commitHookEffectListMount(flags, finishedWork) { finishedWork = finishedWork.updateQueue; finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; if (null !== finishedWork) { var effect = (finishedWork = finishedWork.next); do { - if ((effect.tag & tag) === tag) { - var create$80 = effect.create; - effect.destroy = create$80(); + if ((effect.tag & flags) === flags) { + var create$81 = effect.create; + effect.destroy = create$81(); } effect = effect.next; } while (effect !== finishedWork); @@ -5977,22 +6012,11 @@ function commitMutationEffects(root, firstChild) { var _effect = effect, destroy = _effect.destroy, tag = _effect.tag; - if ( - void 0 !== destroy && - (0 !== (tag & 2) || 0 !== (tag & 4)) - ) { - _effect = current; - var nearestMountedAncestor = root; - try { - destroy(); - } catch (error) { - captureCommitPhaseError( - _effect, - nearestMountedAncestor, - error - ); - } - } + void 0 !== destroy && + (0 !== (tag & 2) + ? safelyCallDestroy(current, root, destroy) + : 0 !== (tag & 4) && + safelyCallDestroy(current, root, destroy)); effect = effect.next; } while (effect !== firstEffect); } @@ -6060,8 +6084,8 @@ function commitMutationEffects(root, firstChild) { switch (root.tag) { case 13: if (null !== root.memoizedState) { - var current$84 = root.alternate; - if (null === current$84 || null === current$84.memoizedState) + var current$85 = root.alternate; + if (null === current$85 || null === current$85.memoizedState) globalMostRecentFallbackTime = now(); } } @@ -6138,8 +6162,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$81 = firstChild.updateQueue; - if (null !== updateQueue$81) { + var updateQueue$82 = firstChild.updateQueue; + if (null !== updateQueue$82) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6149,11 +6173,14 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$81, current); + commitUpdateQueue(firstChild, updateQueue$82, current); } break; case 5: - null === current && firstChild.flags & 4 && shim(); + if (null === current && firstChild.flags & 4) + throw Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ); break; case 6: break; @@ -6222,7 +6249,8 @@ var ceil = Math.ceil, workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, - workInProgressRootUpdatedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, @@ -6282,16 +6310,19 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; markRootUpdated(root, lane, eventTime); - root === workInProgressRoot && - (0 === (executionContext & 2) && (workInProgressRootUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended$1(root, workInProgressRootRenderLanes)); - ensureRootIsScheduled(root, eventTime); - 1 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks()); + 0 !== (executionContext & 2) && root === workInProgressRoot + ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) + : (root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended$1(root, workInProgressRootRenderLanes)), + ensureRootIsScheduled(root, eventTime), + 1 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + includesLegacySyncCallbacks && flushSyncCallbacks())); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6317,12 +6348,12 @@ function ensureRootIsScheduled(root, currentTime) { 0 < lanes; ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5, - expirationTime = expirationTimes[index$5]; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$5] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -6491,10 +6522,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevExecutionContext = -1; 0 < lanes; ) { - var index$4 = 31 - clz32(lanes); - prevDispatcher = 1 << index$4; - index$4 = didTimeout[index$4]; - index$4 > prevExecutionContext && (prevExecutionContext = index$4); + var index$5 = 31 - clz32(lanes); + prevDispatcher = 1 << index$5; + index$5 = didTimeout[index$5]; + index$5 > prevExecutionContext && (prevExecutionContext = index$5); lanes &= ~prevDispatcher; } lanes = prevExecutionContext; @@ -6537,10 +6568,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; - root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); - root = renderRootSync(root, errorRetryLanes); + root.isDehydrated && (root.isDehydrated = !1); + for ( + var exitStatus, i = 0; + 50 > i && + ((exitStatus = renderRootSync(root, errorRetryLanes)), + 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); + i++ + ); executionContext = prevExecutionContext; - return root; + return exitStatus; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -6578,13 +6615,13 @@ function isRenderConsistentWithExternalStores(finishedWork) { } function markRootSuspended$1(root, suspendedLanes) { suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootUpdatedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$6 = 31 - clz32(suspendedLanes), - lane = 1 << index$6; - root[index$6] = -1; + var index$7 = 31 - clz32(suspendedLanes), + lane = 1 << index$7; + root[index$7] = -1; suspendedLanes &= ~lane; } } @@ -6596,13 +6633,10 @@ function performSyncWorkOnRoot(root) { if (0 === (lanes & 1)) return ensureRootIsScheduled(root, now()), null; var exitStatus = renderRootSync(root, lanes); if (0 !== root.tag && 2 === exitStatus) { - var prevExecutionContext = executionContext; - executionContext |= 8; - root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); - executionContext = prevExecutionContext; + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError(root, errorRetryLanes))); } if (1 === exitStatus) throw ((exitStatus = workInProgressRootFatalError), @@ -6629,6 +6663,7 @@ function prepareFreshStack(root, lanes) { if (null !== workInProgress) for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { var interruptedWork = timeoutHandle; + popTreeContext(interruptedWork); switch (interruptedWork.tag) { case 1: interruptedWork = interruptedWork.type.childContextTypes; @@ -6668,7 +6703,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -6747,83 +6782,73 @@ function handleError(root$jscomp$0, thrownValue) { } b: { sourceFiber$jscomp$0 = returnFiber; - var sourceFiber$jscomp$1 = sourceFiber, - rootRenderLanes = thrownValue, - hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - node = sourceFiber$jscomp$0; do { var JSCompiler_temp; - if ((JSCompiler_temp = 13 === node.tag)) { - var nextState = node.memoizedState; + if ((JSCompiler_temp = 13 === sourceFiber$jscomp$0.tag)) { + var nextState = sourceFiber$jscomp$0.memoizedState; JSCompiler_temp = null !== nextState ? null !== nextState.dehydrated ? !0 : !1 - : !0 !== node.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 : !0; } if (JSCompiler_temp) { - if (0 === (node.mode & 1)) { - if (node === sourceFiber$jscomp$0) node.flags |= 65536; - else { - node.flags |= 128; - sourceFiber$jscomp$1.flags |= 131072; - sourceFiber$jscomp$1.flags &= -52805; - if ( - enablePersistentOffscreenHostContainer && - null === node.alternate - ) { - var offscreenContainer = node.child.child; - if (null !== offscreenContainer) { - var containerProps = getOffscreenContainerProps( - "hidden", - offscreenContainer.memoizedProps.children - ); - offscreenContainer.pendingProps = containerProps; - offscreenContainer.memoizedProps = containerProps; - } - } - if (1 === sourceFiber$jscomp$1.tag) - if (null === sourceFiber$jscomp$1.alternate) - sourceFiber$jscomp$1.tag = 17; - else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber$jscomp$1, update); - } - sourceFiber$jscomp$1.lanes |= 1; - } - var suspenseBoundary = node; - break b; - } - node.flags |= 65536; - node.lanes = rootRenderLanes; - suspenseBoundary = node; + var suspenseBoundary = sourceFiber$jscomp$0; break b; } - node = node.return; - } while (null !== node); + sourceFiber$jscomp$0 = sourceFiber$jscomp$0.return; + } while (null !== sourceFiber$jscomp$0); suspenseBoundary = null; } if (null !== suspenseBoundary) { - value = void 0; - sourceFiber = suspenseBoundary; - if (sourceFiber.mode & 1) { + suspenseBoundary.flags &= -257; + value = suspenseBoundary; + sourceFiber$jscomp$0 = thrownValue; + if (0 === (value.mode & 1)) + if (value === returnFiber) value.flags |= 65536; + else { + value.flags |= 128; + sourceFiber.flags |= 131072; + sourceFiber.flags &= -52805; + if ( + enablePersistentOffscreenHostContainer && + null === value.alternate + ) { + var offscreenContainer = value.child.child; + if (null !== offscreenContainer) { + var containerProps = getOffscreenContainerProps( + "hidden", + offscreenContainer.memoizedProps.children + ); + offscreenContainer.pendingProps = containerProps; + offscreenContainer.memoizedProps = containerProps; + } + } + if (1 === sourceFiber.tag) + if (null === sourceFiber.alternate) sourceFiber.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber, update); + } + sourceFiber.lanes |= 1; + } + else (value.flags |= 65536), (value.lanes = sourceFiber$jscomp$0); + sourceFiber = void 0; + value = suspenseBoundary; + if (value.mode & 1) { var pingCache = root.pingCache; null === pingCache ? ((pingCache = root.pingCache = new PossiblyWeakMap()), - (value = new Set()), - pingCache.set(wakeable, value)) - : ((value = pingCache.get(wakeable)), - void 0 === value && - ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(thrownValue)) { - value.add(thrownValue); + (sourceFiber = new Set()), + pingCache.set(wakeable, sourceFiber)) + : ((sourceFiber = pingCache.get(wakeable)), + void 0 === sourceFiber && + ((sourceFiber = new Set()), + pingCache.set(wakeable, sourceFiber))); + if (!sourceFiber.has(thrownValue)) { + sourceFiber.add(thrownValue); var ping = pingSuspendedRoot.bind( null, root, @@ -6833,11 +6858,11 @@ function handleError(root$jscomp$0, thrownValue) { wakeable.then(ping, ping); } } - var wakeables = sourceFiber.updateQueue; + var wakeables = value.updateQueue; if (null === wakeables) { var updateQueue = new Set(); updateQueue.add(wakeable); - sourceFiber.updateQueue = updateQueue; + value.updateQueue = updateQueue; } else wakeables.add(wakeable); break a; } else @@ -6879,12 +6904,12 @@ function handleError(root$jscomp$0, thrownValue) { root.flags |= 65536; thrownValue &= -thrownValue; root.lanes |= thrownValue; - var update$31 = createClassErrorUpdate( + var update$32 = createClassErrorUpdate( root, wakeable, thrownValue ); - enqueueCapturedUpdate(root, update$31); + enqueueCapturedUpdate(root, update$32); break a; } } @@ -7784,7 +7809,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.flags = 0), (workInProgress.subtreeFlags = 0), (workInProgress.deletions = null)); - workInProgress.flags = current.flags & 7340032; + workInProgress.flags = current.flags & 14680064; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -7924,7 +7949,7 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate) { +function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -7937,6 +7962,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.expirationTimes = createLaneMap(-1); this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); + this.identifierPrefix = identifierPrefix; } function createPortal(children, containerInfo, implementation) { var key = @@ -8140,10 +8166,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_935 = { + devToolsConfig$jscomp$inline_926 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.0.0-afcb9cdc9-20211008", + version: "18.0.0-rc.0-51947a14b-20220113", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8158,11 +8184,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1189 = { - bundleType: devToolsConfig$jscomp$inline_935.bundleType, - version: devToolsConfig$jscomp$inline_935.version, - rendererPackageName: devToolsConfig$jscomp$inline_935.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_935.rendererConfig, +var internals$jscomp$inline_1179 = { + bundleType: devToolsConfig$jscomp$inline_926.bundleType, + version: devToolsConfig$jscomp$inline_926.version, + rendererPackageName: devToolsConfig$jscomp$inline_926.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_926.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8178,26 +8204,29 @@ var internals$jscomp$inline_1189 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_935.findFiberByHostInstance || + devToolsConfig$jscomp$inline_926.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-afcb9cdc9-20211008" + reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1190 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1180 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1190.isDisabled && - hook$jscomp$inline_1190.supportsFiber + !hook$jscomp$inline_1180.isDisabled && + hook$jscomp$inline_1180.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1190.inject( - internals$jscomp$inline_1189 + (rendererID = hook$jscomp$inline_1180.inject( + Object.assign({}, internals$jscomp$inline_1179, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }) )), - (injectedHook = hook$jscomp$inline_1190); + (injectedHook = hook$jscomp$inline_1180); } catch (err) {} } exports.createPortal = function(children, containerTag) { @@ -8237,7 +8266,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) { var root = roots.get(containerTag); root || ((root = concurrentRoot ? 1 : 0), - (concurrentRoot = new FiberRootNode(containerTag, root, !1)), + (concurrentRoot = new FiberRootNode(containerTag, root, !1, "")), (root = createFiber(3, null, null, 1 === root ? 1 : 0)), (concurrentRoot.current = root), (root.stateNode = concurrentRoot), diff --git a/Libraries/Renderer/implementations/ReactFabric-prod.js b/Libraries/Renderer/implementations/ReactFabric-prod.js index de7df01710c1..058a5e178007 100644 --- a/Libraries/Renderer/implementations/ReactFabric-prod.js +++ b/Libraries/Renderer/implementations/ReactFabric-prod.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js index 1950c8517f1e..88a4d7e8f7ae 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.fb.js @@ -7,10 +7,21 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<<62430ecbf70b848b8677c9a80f79d347>> + * @generated SignedSource<> */ -"use strict"; + + 'use strict'; + +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); +} + "use strict"; require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"), @@ -927,7 +938,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_227 = { +var injectedNamesToPlugins$jscomp$inline_228 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -962,33 +973,33 @@ var injectedNamesToPlugins$jscomp$inline_227 = { } } }, - isOrderingDirty$jscomp$inline_228 = !1, - pluginName$jscomp$inline_229; -for (pluginName$jscomp$inline_229 in injectedNamesToPlugins$jscomp$inline_227) + isOrderingDirty$jscomp$inline_229 = !1, + pluginName$jscomp$inline_230; +for (pluginName$jscomp$inline_230 in injectedNamesToPlugins$jscomp$inline_228) if ( - injectedNamesToPlugins$jscomp$inline_227.hasOwnProperty( - pluginName$jscomp$inline_229 + injectedNamesToPlugins$jscomp$inline_228.hasOwnProperty( + pluginName$jscomp$inline_230 ) ) { - var pluginModule$jscomp$inline_230 = - injectedNamesToPlugins$jscomp$inline_227[pluginName$jscomp$inline_229]; + var pluginModule$jscomp$inline_231 = + injectedNamesToPlugins$jscomp$inline_228[pluginName$jscomp$inline_230]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_229) || - namesToPlugins[pluginName$jscomp$inline_229] !== - pluginModule$jscomp$inline_230 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_230) || + namesToPlugins[pluginName$jscomp$inline_230] !== + pluginModule$jscomp$inline_231 ) { - if (namesToPlugins[pluginName$jscomp$inline_229]) + if (namesToPlugins[pluginName$jscomp$inline_230]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_229 + "`.") + (pluginName$jscomp$inline_230 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_229 - ] = pluginModule$jscomp$inline_230; - isOrderingDirty$jscomp$inline_228 = !0; + pluginName$jscomp$inline_230 + ] = pluginModule$jscomp$inline_231; + isOrderingDirty$jscomp$inline_229 = !0; } } -isOrderingDirty$jscomp$inline_228 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_229 && recomputePluginOrdering(); function getInstanceFromInstance(instanceHandle) { return instanceHandle; } @@ -1608,6 +1619,7 @@ var scheduleCallback = Scheduler.unstable_scheduleCallback, IdlePriority = Scheduler.unstable_IdlePriority, rendererID = null, injectedHook = null, + injectedProfilingHooks = null, isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; function onCommitRoot(root, eventPriority) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) @@ -1637,6 +1649,80 @@ function onCommitRoot(root, eventPriority) { ); } catch (err) {} } +function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; +} +function getLaneLabelMap() { + for (var map = new Map(), lane = 1, index$3 = 0; 31 > index$3; index$3++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } + return map; +} +function markCommitStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStopped && + injectedProfilingHooks.markCommitStopped(); +} +function markComponentRenderStarted(fiber) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentRenderStarted && + injectedProfilingHooks.markComponentRenderStarted(fiber); +} +function markComponentRenderStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentRenderStopped && + injectedProfilingHooks.markComponentRenderStopped(); +} +function markComponentLayoutEffectUnmountStarted(fiber) { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted && + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); +} +function markComponentLayoutEffectUnmountStopped() { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped && + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); +} +function markRenderStarted(lanes) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStarted && + injectedProfilingHooks.markRenderStarted(lanes); +} +function markRenderStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStopped && + injectedProfilingHooks.markRenderStopped(); +} +function markStateUpdateScheduled(fiber, lane) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markStateUpdateScheduled && + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); +} +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, + log = Math.log, + LN2 = Math.LN2; +function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; +} +function getLabelForLane(lane) { + if (lane & 1) return "Sync"; + if (lane & 2) return "InputContinuousHydration"; + if (lane & 4) return "InputContinuous"; + if (lane & 8) return "DefaultHydration"; + if (lane & 16) return "Default"; + if (lane & 32) return "TransitionHydration"; + if (lane & 4194240) return "Transition"; + if (lane & 130023424) return "Retry"; + if (lane & 134217728) return "SelectiveHydration"; + if (lane & 268435456) return "IdleHydration"; + if (lane & 536870912) return "Idle"; + if (lane & 1073741824) return "Offscreen"; +} var nextTransitionLane = 64, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { @@ -1802,30 +1888,30 @@ function markRootFinished(root, remainingLanes) { remainingLanes = root.entanglements; var eventTimes = root.eventTimes; for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) { - var index$7 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$7; - remainingLanes[index$7] = 0; - eventTimes[index$7] = -1; - root[index$7] = -1; + var index$8 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$8; + remainingLanes[index$8] = 0; + eventTimes[index$8] = -1; + root[index$8] = -1; noLongerPendingLanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$8 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$8; - (lane & entangledLanes) | (root[index$8] & entangledLanes) && - (root[index$8] |= entangledLanes); + var index$9 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$9; + (lane & entangledLanes) | (root[index$9] & entangledLanes) && + (root[index$9] |= entangledLanes); rootEntangledLanes &= ~lane; } } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { - var index$9 = 31 - clz32(lanes), - lane = 1 << index$9; - root[index$9].add(fiber); + var index$10 = 31 - clz32(lanes), + lane = 1 << index$10; + root[index$10].add(fiber); lanes &= ~lane; } } @@ -1837,25 +1923,19 @@ function movePendingFibersToMemoized(root, lanes) { 0 < lanes; ) { - var index$10 = 31 - clz32(lanes); - root = 1 << index$10; - index$10 = pendingUpdatersLaneMap[index$10]; - 0 < index$10.size && - (index$10.forEach(function(fiber) { + var index$11 = 31 - clz32(lanes); + root = 1 << index$11; + index$11 = pendingUpdatersLaneMap[index$11]; + 0 < index$11.size && + (index$11.forEach(function(fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), - index$10.clear()); + index$11.clear()); lanes &= ~root; } } -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, - log = Math.log, - LN2 = Math.LN2; -function clz32Fallback(lanes) { - return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; -} var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; @@ -1867,11 +1947,6 @@ function lanesToEventPriority(lanes) { : 4 : 1; } -function shim() { - throw Error( - "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." - ); -} function shim$1() { throw Error( "The current renderer does not support hydration. This error is likely caused by a bug in React. Please file an issue." @@ -2176,12 +2251,14 @@ function shallowEqual(objA, objB) { var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; - for (keysB = 0; keysB < keysA.length; keysB++) + for (keysB = 0; keysB < keysA.length; keysB++) { + var currentKey = keysA[keysB]; if ( - !hasOwnProperty.call(objB, keysA[keysB]) || - !objectIs(objA[keysA[keysB]], objB[keysA[keysB]]) + !hasOwnProperty.call(objB, currentKey) || + !objectIs(objA[currentKey], objB[currentKey]) ) return !1; + } return !0; } function describeFiber(fiber) { @@ -2564,6 +2641,7 @@ var classComponentUpdater = { enqueueUpdate(inst, update); payload = scheduleUpdateOnFiber(inst, lane, eventTime); null !== payload && entangleTransitions(payload, inst, lane); + markStateUpdateScheduled(inst, lane); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; @@ -2576,6 +2654,7 @@ var classComponentUpdater = { enqueueUpdate(inst, update); payload = scheduleUpdateOnFiber(inst, lane, eventTime); null !== payload && entangleTransitions(payload, inst, lane); + markStateUpdateScheduled(inst, lane); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; @@ -2587,6 +2666,9 @@ var classComponentUpdater = { enqueueUpdate(inst, update); callback = scheduleUpdateOnFiber(inst, lane, eventTime); null !== callback && entangleTransitions(callback, inst, lane); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markForceUpdateScheduled && + injectedProfilingHooks.markForceUpdateScheduled(inst, lane); } }; function checkShouldComponentUpdate( @@ -2679,6 +2761,26 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { "function" === typeof instance.componentDidMount && (workInProgress.flags |= 4); } +var forkStack = [], + forkStackIndex = 0, + treeForkProvider = null, + idStack = [], + idStackIndex = 0, + treeContextProvider = null; +function popTreeContext(workInProgress) { + for (; workInProgress === treeForkProvider; ) + (treeForkProvider = forkStack[--forkStackIndex]), + (forkStack[forkStackIndex] = null), + --forkStackIndex, + (forkStack[forkStackIndex] = null); + for (; workInProgress === treeContextProvider; ) + (treeContextProvider = idStack[--idStackIndex]), + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -2773,7 +2875,8 @@ function ChildReconciler(shouldTrackSideEffects) { } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; - if (!shouldTrackSideEffects) return lastPlacedIndex; + if (!shouldTrackSideEffects) + return (newFiber.flags |= 1048576), lastPlacedIndex; newIndex = newFiber.alternate; if (null !== newIndex) return ( @@ -2864,7 +2967,10 @@ function ChildReconciler(shouldTrackSideEffects) { return current; } function createChild(returnFiber, newChild, lanes) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (newChild = createFiberFromText( "" + newChild, @@ -2918,7 +3024,10 @@ function ChildReconciler(shouldTrackSideEffects) { } function updateSlot(returnFiber, oldFiber, newChild, lanes) { var key = null !== oldFiber ? oldFiber.key : null; - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return null !== key ? null : updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); @@ -2948,7 +3057,10 @@ function ChildReconciler(shouldTrackSideEffects) { newChild, lanes ) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (existingChildren = existingChildren.get(newIdx) || null), updateTextNode(returnFiber, existingChildren, "" + newChild, lanes) @@ -3274,7 +3386,8 @@ function ChildReconciler(shouldTrackSideEffects) { ); throwOnInvalidObjectType(returnFiber, newChild); } - return "string" === typeof newChild || "number" === typeof newChild + return ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), @@ -3377,7 +3490,8 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, - didScheduleRenderPhaseUpdateDuringThisPass = !1; + didScheduleRenderPhaseUpdateDuringThisPass = !1, + globalClientIdCounter = 0; function throwInvalidHookError() { throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." @@ -3800,7 +3914,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(4196352, 8, create, deps); + return mountEffectImpl(8390656, 8, create, deps); } function updateEffect(create, deps) { return updateEffectImpl(2048, 8, create, deps); @@ -3880,6 +3994,9 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } +function updateId() { + return updateWorkInProgressHook().memoizedState; +} function dispatchReducerAction(fiber, queue, action) { var lane = requestUpdateLane(fiber); action = { @@ -3893,8 +4010,9 @@ function dispatchReducerAction(fiber, queue, action) { ? enqueueRenderPhaseUpdate(queue, action) : (enqueueUpdate$1(fiber, queue, action), (action = requestEventTime()), - (fiber = scheduleUpdateOnFiber(fiber, lane, action)), - null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); + (action = scheduleUpdateOnFiber(fiber, lane, action)), + null !== action && entangleTransitionUpdate(action, queue, lane)); + markStateUpdateScheduled(fiber, lane); } function dispatchSetState(fiber, queue, action) { var lane = requestUpdateLane(fiber), @@ -3924,9 +4042,10 @@ function dispatchSetState(fiber, queue, action) { } finally { } action = requestEventTime(); - fiber = scheduleUpdateOnFiber(fiber, lane, action); - null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + action = scheduleUpdateOnFiber(fiber, lane, action); + null !== action && entangleTransitionUpdate(action, queue, lane); } + markStateUpdateScheduled(fiber, lane); } function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; @@ -3987,7 +4106,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, + useId: throwInvalidHookError, unstable_isNewReconciler: !1 }, HooksDispatcherOnMount = { @@ -4085,8 +4204,12 @@ var ContextOnlyDispatcher = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - throw Error("Not yet implemented"); + useId: function() { + var hook = mountWorkInProgressHook(), + identifierPrefix = workInProgressRoot.identifierPrefix, + globalClientId = globalClientIdCounter++; + identifierPrefix = identifierPrefix + "r:" + globalClientId.toString(32); + return (hook.memoizedState = identifierPrefix); }, unstable_isNewReconciler: !1 }, @@ -4169,9 +4292,7 @@ var ContextOnlyDispatcher = { } return nextSnapshot; }, - useOpaqueIdentifier: function() { - return updateReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }, HooksDispatcherOnRerender = { @@ -4214,9 +4335,7 @@ var ContextOnlyDispatcher = { }, useMutableSource: updateMutableSource, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - return rerenderReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }, now$1 = Scheduler.unstable_now, @@ -4521,14 +4640,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$37 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$37 = lastTailNode), + for (var lastTailNode$38 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$38 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$37 + null === lastTailNode$38 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$37.sibling = null); + : (lastTailNode$38.sibling = null); } } function bubbleProperties(completedWork) { @@ -4540,53 +4659,53 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$39 = completedWork.selfBaseDuration, - child$40 = completedWork.child; - null !== child$40; + var treeBaseDuration$40 = completedWork.selfBaseDuration, + child$41 = completedWork.child; + null !== child$41; ) - (newChildLanes |= child$40.lanes | child$40.childLanes), - (subtreeFlags |= child$40.subtreeFlags & 7340032), - (subtreeFlags |= child$40.flags & 7340032), - (treeBaseDuration$39 += child$40.treeBaseDuration), - (child$40 = child$40.sibling); - completedWork.treeBaseDuration = treeBaseDuration$39; + (newChildLanes |= child$41.lanes | child$41.childLanes), + (subtreeFlags |= child$41.subtreeFlags & 14680064), + (subtreeFlags |= child$41.flags & 14680064), + (treeBaseDuration$40 += child$41.treeBaseDuration), + (child$41 = child$41.sibling); + completedWork.treeBaseDuration = treeBaseDuration$40; } else for ( - treeBaseDuration$39 = completedWork.child; - null !== treeBaseDuration$39; + treeBaseDuration$40 = completedWork.child; + null !== treeBaseDuration$40; ) (newChildLanes |= - treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), - (subtreeFlags |= treeBaseDuration$39.subtreeFlags & 7340032), - (subtreeFlags |= treeBaseDuration$39.flags & 7340032), - (treeBaseDuration$39.return = completedWork), - (treeBaseDuration$39 = treeBaseDuration$39.sibling); + treeBaseDuration$40.lanes | treeBaseDuration$40.childLanes), + (subtreeFlags |= treeBaseDuration$40.subtreeFlags & 14680064), + (subtreeFlags |= treeBaseDuration$40.flags & 14680064), + (treeBaseDuration$40.return = completedWork), + (treeBaseDuration$40 = treeBaseDuration$40.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$39 = completedWork.actualDuration; - child$40 = completedWork.selfBaseDuration; + treeBaseDuration$40 = completedWork.actualDuration; + child$41 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$39 += child.actualDuration), - (child$40 += child.treeBaseDuration), + (treeBaseDuration$40 += child.actualDuration), + (child$41 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$39; - completedWork.treeBaseDuration = child$40; + completedWork.actualDuration = treeBaseDuration$40; + completedWork.treeBaseDuration = child$41; } else for ( - treeBaseDuration$39 = completedWork.child; - null !== treeBaseDuration$39; + treeBaseDuration$40 = completedWork.child; + null !== treeBaseDuration$40; ) (newChildLanes |= - treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), - (subtreeFlags |= treeBaseDuration$39.subtreeFlags), - (subtreeFlags |= treeBaseDuration$39.flags), - (treeBaseDuration$39.return = completedWork), - (treeBaseDuration$39 = treeBaseDuration$39.sibling); + treeBaseDuration$40.lanes | treeBaseDuration$40.childLanes), + (subtreeFlags |= treeBaseDuration$40.subtreeFlags), + (subtreeFlags |= treeBaseDuration$40.flags), + (treeBaseDuration$40.return = completedWork), + (treeBaseDuration$40 = treeBaseDuration$40.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; @@ -4618,6 +4737,7 @@ function completeSuspendedOffscreenHostContainer(current, workInProgress) { } function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; + popTreeContext(workInProgress); switch (workInProgress.tag) { case 2: case 16: @@ -4731,11 +4851,7 @@ function completeWork(current, workInProgress, renderLanes) { !renderLanes && ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) - if ( - (null === current && - !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || - 0 !== (suspenseStackCursor.current & 1) - ) + if (null === current || 0 !== (suspenseStackCursor.current & 1)) 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 3); else { @@ -4747,7 +4863,7 @@ function completeWork(current, workInProgress, renderLanes) { workInProgressRootExitStatus = 4; null === workInProgressRoot || (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootUpdatedLanes & 268435455)) || + 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || markRootSuspended$1( workInProgressRoot, workInProgressRootRenderLanes @@ -4807,7 +4923,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (renderedTail = current), - (renderLanes.flags &= 7340034), + (renderLanes.flags &= 14680066), (type = renderLanes.alternate), null === type ? ((renderLanes.childLanes = 0), @@ -4950,6 +5066,7 @@ function updateForwardRef( Component = Component.render; var ref = workInProgress.ref; prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); nextProps = renderWithHooks( current, workInProgress, @@ -4958,6 +5075,7 @@ function updateForwardRef( ref, renderLanes ); + markComponentRenderStopped(); if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), @@ -5152,6 +5270,7 @@ function updateFunctionComponent( : contextStackCursor.current; context = getMaskedContext(workInProgress, context); prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); Component = renderWithHooks( current, workInProgress, @@ -5160,6 +5279,7 @@ function updateFunctionComponent( context, renderLanes ); + markComponentRenderStopped(); if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), @@ -5396,7 +5516,10 @@ function finishClassComponent( ) { var nextChildren = null; profilerStartTime = -1; - } else nextChildren = shouldUpdate.render(); + } else + markComponentRenderStarted(workInProgress), + (nextChildren = shouldUpdate.render()), + markComponentRenderStopped(); workInProgress.flags |= 1; null !== current && didCaptureError ? ((didCaptureError = nextChildren), @@ -5429,7 +5552,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } -var SUSPENDED_MARKER = { dehydrated: null, retryLane: 0 }; +var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: null }; } @@ -5443,11 +5566,9 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseContext & 2)); - JSCompiler_temp - ? ((showFallback = !0), (workInProgress.flags &= -129)) - : (null !== current && null === current.memoizedState) || - !0 === nextProps.unstable_avoidThisFallback || - (suspenseContext |= 1); + if (JSCompiler_temp) (showFallback = !0), (workInProgress.flags &= -129); + else if (null === current || null !== current.memoizedState) + suspenseContext |= 1; push(suspenseStackCursor, suspenseContext & 1); if (null === current) { current = nextProps.children; @@ -5666,7 +5787,7 @@ function updateSuspenseFallbackChildren( primaryChildren ))), (current.subtreeFlags = - currentPrimaryChildFragment.subtreeFlags & 7340032)); + currentPrimaryChildFragment.subtreeFlags & 14680064)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5898,6 +6019,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate( return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } function unwindWork(workInProgress) { + popTreeContext(workInProgress); switch (workInProgress.tag) { case 1: isContextProvider(workInProgress.type) && popContext(); @@ -6051,24 +6173,63 @@ function commitHookEffectListUnmount( var destroy = effect.destroy; effect.destroy = void 0; void 0 !== destroy && - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); + (0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted && + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted( + finishedWork + ) + : 0 !== (flags & 4) && + markComponentLayoutEffectUnmountStarted(finishedWork), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy), + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped && + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped() + : 0 !== (flags & 4) && markComponentLayoutEffectUnmountStopped()); } effect = effect.next; } while (effect !== updateQueue); } } -function commitHookEffectListMount(tag, finishedWork) { - finishedWork = finishedWork.updateQueue; - finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; - if (null !== finishedWork) { - var effect = (finishedWork = finishedWork.next); +function commitHookEffectListMount(flags, finishedWork) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); do { - if ((effect.tag & tag) === tag) { - var create$86 = effect.create; - effect.destroy = create$86(); + if ((effect.tag & flags) === flags) { + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted && + injectedProfilingHooks.markComponentPassiveEffectMountStarted( + finishedWork + ) + : 0 !== (flags & 4) && + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted && + injectedProfilingHooks.markComponentLayoutEffectMountStarted( + finishedWork + ); + var create$87 = effect.create; + effect.destroy = create$87(); + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped && + injectedProfilingHooks.markComponentPassiveEffectMountStopped() + : 0 !== (flags & 4) && + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped && + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); } effect = effect.next; - } while (effect !== finishedWork); + } while (effect !== updateQueue); } } function detachFiberAfterEffects(fiber) { @@ -6192,13 +6353,17 @@ function commitMutationEffects(root, firstChild, committedLanes) { var _effect = effect, destroy = _effect.destroy, tag = _effect.tag; - void 0 === destroy || - (0 === (tag & 2) && 0 === (tag & 4)) || - (current.mode & 2 - ? (startLayoutEffectTimer(), - safelyCallDestroy(current, root, destroy), - recordLayoutEffectDuration(current)) - : safelyCallDestroy(current, root, destroy)); + void 0 !== destroy && + (0 !== (tag & 2) + ? safelyCallDestroy(current, root, destroy) + : 0 !== (tag & 4) && + (markComponentLayoutEffectUnmountStarted(current), + current.mode & 2 + ? (startLayoutEffectTimer(), + safelyCallDestroy(current, root, destroy), + recordLayoutEffectDuration(current)) + : safelyCallDestroy(current, root, destroy), + markComponentLayoutEffectUnmountStopped())); effect = effect.next; } while (effect !== firstEffect); } @@ -6282,8 +6447,8 @@ function commitMutationEffects(root, firstChild, committedLanes) { switch (root.tag) { case 13: if (null !== root.memoizedState) { - var current$92 = root.alternate; - if (null === current$92 || null === current$92.memoizedState) + var current$93 = root.alternate; + if (null === current$93 || null === current$93.memoizedState) globalMostRecentFallbackTime = now(); } } @@ -6393,27 +6558,30 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { commitUpdateQueue(committedLanes, updateQueue, instance); break; case 3: - var updateQueue$88 = committedLanes.updateQueue; - if (null !== updateQueue$88) { - var instance$89 = null; + var updateQueue$89 = committedLanes.updateQueue; + if (null !== updateQueue$89) { + var instance$90 = null; if (null !== committedLanes.child) switch (committedLanes.child.tag) { case 5: - instance$89 = + instance$90 = committedLanes.child.stateNode.canonical; break; case 1: - instance$89 = committedLanes.child.stateNode; + instance$90 = committedLanes.child.stateNode; } commitUpdateQueue( committedLanes, - updateQueue$88, - instance$89 + updateQueue$89, + instance$90 ); } break; case 5: - null === current && committedLanes.flags & 4 && shim(); + if (null === current && committedLanes.flags & 4) + throw Error( + "The current renderer does not support mutation. This error is likely caused by a bug in React. Please file an issue." + ); break; case 6: break; @@ -6424,7 +6592,7 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender, effectDuration = committedLanes.stateNode.effectDuration; - instance$89 = commitTime; + instance$90 = commitTime; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof onRender && @@ -6434,14 +6602,14 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { committedLanes.actualDuration, committedLanes.treeBaseDuration, committedLanes.actualStartTime, - instance$89 + instance$90 ); "function" === typeof onCommit && onCommit( committedLanes.memoizedProps.id, current, effectDuration, - instance$89 + instance$90 ); enqueuePendingPassiveProfilerEffect(committedLanes); var parentFiber = committedLanes.return; @@ -6471,27 +6639,27 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { ); } if (committedLanes.flags & 512) { - instance$89 = void 0; + instance$90 = void 0; current = committedLanes; var ref = current.ref; if (null !== ref) { var instance$jscomp$0 = current.stateNode; switch (current.tag) { case 5: - instance$89 = instance$jscomp$0.canonical; + instance$90 = instance$jscomp$0.canonical; break; default: - instance$89 = instance$jscomp$0; + instance$90 = instance$jscomp$0; } if ("function" === typeof ref) if (current.mode & 2) try { - startLayoutEffectTimer(), ref(instance$89); + startLayoutEffectTimer(), ref(instance$90); } finally { recordLayoutEffectDuration(current); } - else ref(instance$89); - else ref.current = instance$89; + else ref(instance$90); + else ref.current = instance$90; } } } catch (error) { @@ -6506,10 +6674,10 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { nextEffect = null; break; } - instance$89 = committedLanes.sibling; - if (null !== instance$89) { - instance$89.return = committedLanes.return; - nextEffect = instance$89; + instance$90 = committedLanes.sibling; + if (null !== instance$90) { + instance$90.return = committedLanes.return; + nextEffect = instance$90; break; } nextEffect = committedLanes.return; @@ -6529,7 +6697,8 @@ var ceil = Math.ceil, workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, - workInProgressRootUpdatedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, @@ -6589,18 +6758,21 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { )); var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; - isDevToolsPresent && addFiberToLanesMap(root, fiber, lane); markRootUpdated(root, lane, eventTime); - root === workInProgressRoot && - (0 === (executionContext & 2) && (workInProgressRootUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended$1(root, workInProgressRootRenderLanes)); - ensureRootIsScheduled(root, eventTime); - 1 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks()); + 0 !== (executionContext & 2) && root === workInProgressRoot + ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) + : (isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended$1(root, workInProgressRootRenderLanes)), + ensureRootIsScheduled(root, eventTime), + 1 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + includesLegacySyncCallbacks && flushSyncCallbacks())); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6626,12 +6798,12 @@ function ensureRootIsScheduled(root, currentTime) { 0 < lanes; ) { - var index$5 = 31 - clz32(lanes), - lane = 1 << index$5, - expirationTime = expirationTimes[index$5]; + var index$6 = 31 - clz32(lanes), + lane = 1 << index$6, + expirationTime = expirationTimes[index$6]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$5] = computeExpirationTime(lane, currentTime); + expirationTimes[index$6] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -6726,6 +6898,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { workInProgressRootRenderTargetTime = now() + 500; prepareFreshStack(root, didTimeout); } + markRenderStarted(didTimeout); do try { workLoopConcurrent(); @@ -6738,8 +6911,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ReactCurrentDispatcher$2.current = prevDispatcher; executionContext = prevExecutionContext; null !== workInProgress - ? (didTimeout = 0) - : ((workInProgressRoot = null), + ? (null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderYielded && + injectedProfilingHooks.markRenderYielded(), + (didTimeout = 0)) + : (markRenderStopped(), + (workInProgressRoot = null), (workInProgressRootRenderLanes = 0), (didTimeout = workInProgressRootExitStatus)); } @@ -6855,10 +7032,16 @@ function performConcurrentWorkOnRoot(root, didTimeout) { function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; - root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); - root = renderRootSync(root, errorRetryLanes); + root.isDehydrated && (root.isDehydrated = !1); + for ( + var exitStatus, i = 0; + 50 > i && + ((exitStatus = renderRootSync(root, errorRetryLanes)), + 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); + i++ + ); executionContext = prevExecutionContext; - return root; + return exitStatus; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -6896,13 +7079,13 @@ function isRenderConsistentWithExternalStores(finishedWork) { } function markRootSuspended$1(root, suspendedLanes) { suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootUpdatedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$6 = 31 - clz32(suspendedLanes), - lane = 1 << index$6; - root[index$6] = -1; + var index$7 = 31 - clz32(suspendedLanes), + lane = 1 << index$7; + root[index$7] = -1; suspendedLanes &= ~lane; } } @@ -6916,13 +7099,10 @@ function performSyncWorkOnRoot(root) { if (0 === (lanes & 1)) return ensureRootIsScheduled(root, now()), null; var exitStatus = renderRootSync(root, lanes); if (0 !== root.tag && 2 === exitStatus) { - var prevExecutionContext = executionContext; - executionContext |= 8; - root.isDehydrated && ((root.isDehydrated = !1), shim(root.containerInfo)); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); - executionContext = prevExecutionContext; + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError(root, errorRetryLanes))); } if (1 === exitStatus) throw ((exitStatus = workInProgressRootFatalError), @@ -6949,6 +7129,7 @@ function prepareFreshStack(root, lanes) { if (null !== workInProgress) for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { var interruptedWork = timeoutHandle; + popTreeContext(interruptedWork); switch (interruptedWork.tag) { case 1: interruptedWork = interruptedWork.type.childContextTypes; @@ -6988,7 +7169,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -7009,7 +7190,7 @@ function prepareFreshStack(root, lanes) { interleavedQueues = null; } } -function handleError(root$jscomp$0, thrownValue) { +function handleError(root, thrownValue) { do { var erroredWork = workInProgress; try { @@ -7039,20 +7220,42 @@ function handleError(root$jscomp$0, thrownValue) { } erroredWork.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(erroredWork, !0); + markComponentRenderStopped(); + if ( + null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ) { + var wakeable = thrownValue; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentSuspended && + injectedProfilingHooks.markComponentSuspended( + erroredWork, + wakeable, + workInProgressRootRenderLanes + ); + } else + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentErrored && + injectedProfilingHooks.markComponentErrored( + erroredWork, + thrownValue, + workInProgressRootRenderLanes + ); a: { - var root = root$jscomp$0, - returnFiber = erroredWork.return, + wakeable = root; + var returnFiber = erroredWork.return, sourceFiber = erroredWork, value = thrownValue; thrownValue = workInProgressRootRenderLanes; sourceFiber.flags |= 32768; - isDevToolsPresent && restorePendingUpdaters(root, thrownValue); + isDevToolsPresent && restorePendingUpdaters(wakeable, thrownValue); if ( null !== value && "object" === typeof value && "function" === typeof value.then ) { - var wakeable = value, + var wakeable$jscomp$0 = value, sourceFiber$jscomp$0 = sourceFiber, tag = sourceFiber$jscomp$0.tag; if ( @@ -7070,99 +7273,90 @@ function handleError(root$jscomp$0, thrownValue) { } b: { sourceFiber$jscomp$0 = returnFiber; - var sourceFiber$jscomp$1 = sourceFiber, - rootRenderLanes = thrownValue, - hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - node = sourceFiber$jscomp$0; do { var JSCompiler_temp; - if ((JSCompiler_temp = 13 === node.tag)) { - var nextState = node.memoizedState; + if ((JSCompiler_temp = 13 === sourceFiber$jscomp$0.tag)) { + var nextState = sourceFiber$jscomp$0.memoizedState; JSCompiler_temp = null !== nextState ? null !== nextState.dehydrated ? !0 : !1 - : !0 !== node.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 : !0; } if (JSCompiler_temp) { - if (0 === (node.mode & 1)) { - if (node === sourceFiber$jscomp$0) node.flags |= 65536; - else { - node.flags |= 128; - sourceFiber$jscomp$1.flags |= 131072; - sourceFiber$jscomp$1.flags &= -52805; - if ( - enablePersistentOffscreenHostContainer && - null === node.alternate - ) { - var offscreenContainer = node.child.child; - if (null !== offscreenContainer) { - var containerProps = getOffscreenContainerProps( - "hidden", - offscreenContainer.memoizedProps.children - ); - offscreenContainer.pendingProps = containerProps; - offscreenContainer.memoizedProps = containerProps; - } - } - if (1 === sourceFiber$jscomp$1.tag) - if (null === sourceFiber$jscomp$1.alternate) - sourceFiber$jscomp$1.tag = 17; - else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber$jscomp$1, update); - } - sourceFiber$jscomp$1.lanes |= 1; - } - var suspenseBoundary = node; - break b; - } - node.flags |= 65536; - node.lanes = rootRenderLanes; - suspenseBoundary = node; + var suspenseBoundary = sourceFiber$jscomp$0; break b; } - node = node.return; - } while (null !== node); + sourceFiber$jscomp$0 = sourceFiber$jscomp$0.return; + } while (null !== sourceFiber$jscomp$0); suspenseBoundary = null; } if (null !== suspenseBoundary) { - value = void 0; - sourceFiber = suspenseBoundary; - if (sourceFiber.mode & 1) { - var pingCache = root.pingCache; + suspenseBoundary.flags &= -257; + value = suspenseBoundary; + sourceFiber$jscomp$0 = thrownValue; + if (0 === (value.mode & 1)) + if (value === returnFiber) value.flags |= 65536; + else { + value.flags |= 128; + sourceFiber.flags |= 131072; + sourceFiber.flags &= -52805; + if ( + enablePersistentOffscreenHostContainer && + null === value.alternate + ) { + var offscreenContainer = value.child.child; + if (null !== offscreenContainer) { + var containerProps = getOffscreenContainerProps( + "hidden", + offscreenContainer.memoizedProps.children + ); + offscreenContainer.pendingProps = containerProps; + offscreenContainer.memoizedProps = containerProps; + } + } + if (1 === sourceFiber.tag) + if (null === sourceFiber.alternate) sourceFiber.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber, update); + } + sourceFiber.lanes |= 1; + } + else (value.flags |= 65536), (value.lanes = sourceFiber$jscomp$0); + sourceFiber = void 0; + value = suspenseBoundary; + if (value.mode & 1) { + var pingCache = wakeable.pingCache; null === pingCache - ? ((pingCache = root.pingCache = new PossiblyWeakMap()), - (value = new Set()), - pingCache.set(wakeable, value)) - : ((value = pingCache.get(wakeable)), - void 0 === value && - ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(thrownValue)) { - value.add(thrownValue); + ? ((pingCache = wakeable.pingCache = new PossiblyWeakMap()), + (sourceFiber = new Set()), + pingCache.set(wakeable$jscomp$0, sourceFiber)) + : ((sourceFiber = pingCache.get(wakeable$jscomp$0)), + void 0 === sourceFiber && + ((sourceFiber = new Set()), + pingCache.set(wakeable$jscomp$0, sourceFiber))); + if (!sourceFiber.has(thrownValue)) { + sourceFiber.add(thrownValue); var ping = pingSuspendedRoot.bind( null, - root, wakeable, + wakeable$jscomp$0, thrownValue ); - isDevToolsPresent && restorePendingUpdaters(root, thrownValue); - wakeable.then(ping, ping); + isDevToolsPresent && + restorePendingUpdaters(wakeable, thrownValue); + wakeable$jscomp$0.then(ping, ping); } } - var wakeables = sourceFiber.updateQueue; + var wakeables = value.updateQueue; if (null === wakeables) { var updateQueue = new Set(); - updateQueue.add(wakeable); - sourceFiber.updateQueue = updateQueue; - } else wakeables.add(wakeable); + updateQueue.add(wakeable$jscomp$0); + value.updateQueue = updateQueue; + } else wakeables.add(wakeable$jscomp$0); break a; } else value = Error( @@ -7173,47 +7367,47 @@ function handleError(root$jscomp$0, thrownValue) { 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); value = createCapturedValue(value, sourceFiber); - root = returnFiber; + wakeable = returnFiber; do { - switch (root.tag) { + switch (wakeable.tag) { case 3: - wakeable = value; - root.flags |= 65536; + wakeable$jscomp$0 = value; + wakeable.flags |= 65536; thrownValue &= -thrownValue; - root.lanes |= thrownValue; + wakeable.lanes |= thrownValue; var update$jscomp$0 = createRootErrorUpdate( - root, wakeable, + wakeable$jscomp$0, thrownValue ); - enqueueCapturedUpdate(root, update$jscomp$0); + enqueueCapturedUpdate(wakeable, update$jscomp$0); break a; case 1: - wakeable = value; - var ctor = root.type, - instance = root.stateNode; + wakeable$jscomp$0 = value; + var ctor = wakeable.type, + instance = wakeable.stateNode; if ( - 0 === (root.flags & 128) && + 0 === (wakeable.flags & 128) && ("function" === typeof ctor.getDerivedStateFromError || (null !== instance && "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance)))) ) { - root.flags |= 65536; + wakeable.flags |= 65536; thrownValue &= -thrownValue; - root.lanes |= thrownValue; - var update$33 = createClassErrorUpdate( - root, + wakeable.lanes |= thrownValue; + var update$34 = createClassErrorUpdate( wakeable, + wakeable$jscomp$0, thrownValue ); - enqueueCapturedUpdate(root, update$33); + enqueueCapturedUpdate(wakeable, update$34); break a; } } - root = root.return; - } while (null !== root); + wakeable = wakeable.return; + } while (null !== wakeable); } completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { @@ -7245,6 +7439,7 @@ function renderRootSync(root, lanes) { } prepareFreshStack(root, lanes); } + markRenderStarted(lanes); do try { workLoopSync(); @@ -7260,6 +7455,7 @@ function renderRootSync(root, lanes) { throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." ); + markRenderStopped(); workInProgressRoot = null; workInProgressRootRenderLanes = 0; return workInProgressRootExitStatus; @@ -7352,7 +7548,10 @@ function commitRootImpl(root, renderPriorityLevel) { throw Error("Should not already be working."); var finishedWork = root.finishedWork, lanes = root.finishedLanes; - if (null === finishedWork) return null; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStarted && + injectedProfilingHooks.markCommitStarted(lanes); + if (null === finishedWork) return markCommitStopped(), null; root.finishedWork = null; root.finishedLanes = 0; if (finishedWork === root.current) @@ -7387,7 +7586,13 @@ function commitRootImpl(root, renderPriorityLevel) { commitTime = now$1(); commitMutationEffects(root, finishedWork, lanes); root.current = finishedWork; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted(lanes); commitLayoutEffects(finishedWork, root, lanes); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(); requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = previousPriority; @@ -7418,6 +7623,7 @@ function commitRootImpl(root, renderPriorityLevel) { : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); flushSyncCallbacks(); + markCommitStopped(); return null; } function flushPassiveEffects() { @@ -7432,11 +7638,16 @@ function flushPassiveEffects() { var JSCompiler_inline_result = !1; else { renderPriority = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; if (0 !== (executionContext & 6)) throw Error("Cannot flush passive effects while already rendering."); - var prevExecutionContext = executionContext; + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStarted && + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + lanes = executionContext; executionContext |= 4; for (nextEffect = renderPriority.current; null !== nextEffect; ) { var fiber = nextEffect, @@ -7599,7 +7810,11 @@ function flushPassiveEffects() { } } } - executionContext = prevExecutionContext; + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStopped && + injectedProfilingHooks.markPassiveEffectsStopped(); + executionContext = lanes; flushSyncCallbacks(); if ( injectedHook && @@ -7756,6 +7971,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { contextStackCursor.current ); prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); context = renderWithHooks( null, workInProgress, @@ -7764,6 +7980,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { context, renderLanes ); + markComponentRenderStopped(); workInProgress.flags |= 1; if ( "object" === typeof context && @@ -8089,7 +8306,9 @@ beginWork$1 = function(current, workInProgress, renderLanes) { (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), (context = readContext(context)), + markComponentRenderStarted(workInProgress), (Component = Component(context)), + markComponentRenderStopped(), (workInProgress.flags |= 1), reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child @@ -8220,7 +8439,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.deletions = null), (workInProgress.actualDuration = 0), (workInProgress.actualStartTime = -1)); - workInProgress.flags = current.flags & 7340032; + workInProgress.flags = current.flags & 14680064; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -8363,7 +8582,7 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate) { +function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -8376,6 +8595,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.expirationTimes = createLaneMap(-1); this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); + this.identifierPrefix = identifierPrefix; this.passiveEffectDuration = this.effectDuration = 0; this.memoizedUpdaters = new Set(); containerInfo = this.pendingUpdatersLaneMap = []; @@ -8409,6 +8629,9 @@ function updateContainer(element, container, parentComponent, callback) { var current = container.current, eventTime = requestEventTime(), lane = requestUpdateLane(current); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderScheduled && + injectedProfilingHooks.markRenderScheduled(lane); a: if (parentComponent) { parentComponent = parentComponent._reactInternals; b: { @@ -8583,10 +8806,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_965 = { + devToolsConfig$jscomp$inline_1002 = { findFiberByHostInstance: getInstanceFromInstance, bundleType: 0, - version: "18.0.0-afcb9cdc9-20211008", + version: "18.0.0-rc.0-51947a14b-20220113", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8601,11 +8824,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1239 = { - bundleType: devToolsConfig$jscomp$inline_965.bundleType, - version: devToolsConfig$jscomp$inline_965.version, - rendererPackageName: devToolsConfig$jscomp$inline_965.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_965.rendererConfig, +var internals$jscomp$inline_1279 = { + bundleType: devToolsConfig$jscomp$inline_1002.bundleType, + version: devToolsConfig$jscomp$inline_1002.version, + rendererPackageName: devToolsConfig$jscomp$inline_1002.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1002.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8621,26 +8844,29 @@ var internals$jscomp$inline_1239 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_965.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1002.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-afcb9cdc9-20211008" + reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1240 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1280 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1240.isDisabled && - hook$jscomp$inline_1240.supportsFiber + !hook$jscomp$inline_1280.isDisabled && + hook$jscomp$inline_1280.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1240.inject( - internals$jscomp$inline_1239 + (rendererID = hook$jscomp$inline_1280.inject( + Object.assign({}, internals$jscomp$inline_1279, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }) )), - (injectedHook = hook$jscomp$inline_1240); + (injectedHook = hook$jscomp$inline_1280); } catch (err) {} } exports.createPortal = function(children, containerTag) { @@ -8680,7 +8906,7 @@ exports.render = function(element, containerTag, callback, concurrentRoot) { var root = roots.get(containerTag); root || ((root = concurrentRoot ? 1 : 0), - (concurrentRoot = new FiberRootNode(containerTag, root, !1)), + (concurrentRoot = new FiberRootNode(containerTag, root, !1, "")), (root = 1 === root ? 1 : 0), isDevToolsPresent && (root |= 2), (root = createFiber(3, null, null, root)), @@ -8723,3 +8949,13 @@ exports.stopSurface = function(containerTag) { exports.unmountComponentAtNode = function(containerTag) { this.stopSurface(containerTag); }; + + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); +} + diff --git a/Libraries/Renderer/implementations/ReactFabric-profiling.js b/Libraries/Renderer/implementations/ReactFabric-profiling.js index 487e23a55b8a..791e998cda8a 100644 --- a/Libraries/Renderer/implementations/ReactFabric-profiling.js +++ b/Libraries/Renderer/implementations/ReactFabric-profiling.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js index 1c526c7f8cba..fa3df1e36c9a 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.fb.js @@ -7,14 +7,25 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<<3ab224d749aabfd2af41824a03d0c6ce>> */ 'use strict'; if (__DEV__) { (function() { -"use strict"; + + 'use strict'; + +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); +} + "use strict"; var React = require("react"); require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); @@ -145,7 +156,7 @@ var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; // when we call document.createEvent(). However this can cause confusing // errors: https://github.com/facebook/create-react-app/issues/3482 // So we preemptively throw with a better message instead. - if (typeof document === "undefined") { + if (typeof document === "undefined" || document === null) { throw new Error( "The `document` global was defined when React was initialized, but is not " + "defined anymore. This can happen in a test environment if a component " + @@ -2887,7 +2898,6 @@ var REACT_SUSPENSE_LIST_TYPE = 0xead8; var REACT_MEMO_TYPE = 0xead3; var REACT_LAZY_TYPE = 0xead4; var REACT_SCOPE_TYPE = 0xead7; -var REACT_OPAQUE_ID_TYPE = 0xeae0; var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; var REACT_OFFSCREEN_TYPE = 0xeae2; var REACT_LEGACY_HIDDEN_TYPE = 0xeae3; @@ -2908,7 +2918,6 @@ if (typeof Symbol === "function" && Symbol.for) { REACT_MEMO_TYPE = symbolFor("react.memo"); REACT_LAZY_TYPE = symbolFor("react.lazy"); REACT_SCOPE_TYPE = symbolFor("react.scope"); - REACT_OPAQUE_ID_TYPE = symbolFor("react.opaque.id"); REACT_DEBUG_TRACING_MODE_TYPE = symbolFor("react.debug_trace_mode"); REACT_OFFSCREEN_TYPE = symbolFor("react.offscreen"); REACT_LEGACY_HIDDEN_TYPE = symbolFor("react.legacy_hidden"); @@ -3141,12 +3150,13 @@ function getComponentNameFromFiber(fiber) { var enablePersistentOffscreenHostContainer = dynamicFlags.enablePersistentOffscreenHostContainer; // The rest of the flags are static for better dead code elimination. -var enableSchedulingProfiler = false; +var enableSchedulingProfiler = true; var enableProfilerTimer = true; var enableProfilerCommitHooks = true; var enableLazyElements = false; var warnAboutStringRefs = false; var warnOnSubscriptionInsideStartTransition = false; +var enableSuspenseAvoidThisFallback = false; var enableNewReconciler = false; var enableLazyContextPropagation = false; @@ -3179,6 +3189,9 @@ var Callback = var DidCapture = /* */ 128; +var ForceClientRender = + /* */ + 256; var Ref = /* */ 512; @@ -3216,6 +3229,9 @@ var ShouldCapture = var ForceUpdateForLegacySuspense = /* */ 131072; +var Forked = + /* */ + 1048576; // Static tags describe aspects of a fiber that are not specific to a render, // e.g. a fiber uses a passive effect (even if there are no updates on this particular render). // This enables us to defer more work in the unmount case, // since we can defer traversing the tree during layout to look for Passive effects, @@ -3223,22 +3239,22 @@ var ForceUpdateForLegacySuspense = var RefStatic = /* */ - 1048576; + 2097152; var LayoutStatic = /* */ - 2097152; + 4194304; var PassiveStatic = /* */ - 4194304; // These flags allow us to traverse to fibers that have effects on mount + 8388608; // These flags allow us to traverse to fibers that have effects on mount // without traversing the entire tree after every commit for // double invoking var MountLayoutDev = /* */ - 8388608; + 16777216; var MountPassiveDev = /* */ - 16777216; // Groups of flags that are used in the commit phase to skip over trees that + 33554432; // Groups of flags that are used in the commit phase to skip over trees that // don't contain effects, by checking subtreeFlags. var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility @@ -4236,6 +4252,7 @@ function reenableLogs() { var rendererID = null; var injectedHook = null; +var injectedProfilingHooks = null; var hasLoggedError = false; var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined"; function injectInternals(internals) { @@ -4266,7 +4283,12 @@ function injectInternals(internals) { } try { - rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. + rendererID = hook.inject( + Object.assign({}, internals, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }) + ); // We have successfully injected, so now it is safe to set up hooks. injectedHook = hook; } catch (err) { @@ -4393,6 +4415,272 @@ function setIsStrictModeForDevtools(newIsStrictMode) { reenableLogs(); } } +} // Profiler API hooks + +function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; +} + +function getLaneLabelMap() { + var map = new Map(); + var lane = 1; + + for (var index = 0; index < TotalLanes; index++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } + + return map; +} + +function markCommitStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markCommitStarted === "function" + ) { + injectedProfilingHooks.markCommitStarted(lanes); + } + } +} +function markCommitStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markCommitStopped === "function" + ) { + injectedProfilingHooks.markCommitStopped(); + } + } +} +function markComponentRenderStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentRenderStarted === "function" + ) { + injectedProfilingHooks.markComponentRenderStarted(fiber); + } + } +} +function markComponentRenderStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentRenderStopped === "function" + ) { + injectedProfilingHooks.markComponentRenderStopped(); + } + } +} +function markComponentPassiveEffectMountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); + } + } +} +function markComponentPassiveEffectMountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectMountStopped(); + } + } +} +function markComponentPassiveEffectUnmountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); + } + } +} +function markComponentPassiveEffectUnmountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === + "function" + ) { + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); + } + } +} +function markComponentLayoutEffectMountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); + } + } +} +function markComponentLayoutEffectMountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); + } + } +} +function markComponentLayoutEffectUnmountStarted(fiber) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); + } + } +} +function markComponentLayoutEffectUnmountStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === + "function" + ) { + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); + } + } +} +function markComponentErrored(fiber, thrownValue, lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentErrored === "function" + ) { + injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); + } + } +} +function markComponentSuspended(fiber, wakeable, lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markComponentSuspended === "function" + ) { + injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); + } + } +} +function markLayoutEffectsStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markLayoutEffectsStarted === "function" + ) { + injectedProfilingHooks.markLayoutEffectsStarted(lanes); + } + } +} +function markLayoutEffectsStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markLayoutEffectsStopped === "function" + ) { + injectedProfilingHooks.markLayoutEffectsStopped(); + } + } +} +function markPassiveEffectsStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markPassiveEffectsStarted === "function" + ) { + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + } + } +} +function markPassiveEffectsStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markPassiveEffectsStopped === "function" + ) { + injectedProfilingHooks.markPassiveEffectsStopped(); + } + } +} +function markRenderStarted(lanes) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderStarted === "function" + ) { + injectedProfilingHooks.markRenderStarted(lanes); + } + } +} +function markRenderYielded() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderYielded === "function" + ) { + injectedProfilingHooks.markRenderYielded(); + } + } +} +function markRenderStopped() { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderStopped === "function" + ) { + injectedProfilingHooks.markRenderStopped(); + } + } +} +function markRenderScheduled(lane) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markRenderScheduled === "function" + ) { + injectedProfilingHooks.markRenderScheduled(lane); + } + } +} +function markForceUpdateScheduled(fiber, lane) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markForceUpdateScheduled === "function" + ) { + injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); + } + } +} +function markStateUpdateScheduled(fiber, lane) { + { + if ( + injectedProfilingHooks !== null && + typeof injectedProfilingHooks.markStateUpdateScheduled === "function" + ) { + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); + } + } } var NoMode = @@ -4418,6 +4706,24 @@ var ConcurrentUpdatesByDefaultMode = /* */ 32; +// TODO: This is pretty well supported by browsers. Maybe we can drop it. +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. +// Based on: +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 + +var log = Math.log; +var LN2 = Math.LN2; + +function clz32Fallback(x) { + var asUint = x >>> 0; + + if (asUint === 0) { + return 32; + } + + return (31 - ((log(asUint) / LN2) | 0)) | 0; +} + // If those values are changed that package should be rebuilt and redeployed. var TotalLanes = 31; @@ -4529,7 +4835,60 @@ var IdleLane = 536870912; var OffscreenLane = /* */ - 1073741824; // This function is used for the experimental scheduling profiler (react-devtools-scheduling-profiler) + 1073741824; // This function is used for the experimental timeline (react-devtools-timeline) +// It should be kept in sync with the Lanes values above. + +function getLabelForLane(lane) { + { + if (lane & SyncLane) { + return "Sync"; + } + + if (lane & InputContinuousHydrationLane) { + return "InputContinuousHydration"; + } + + if (lane & InputContinuousLane) { + return "InputContinuous"; + } + + if (lane & DefaultHydrationLane) { + return "DefaultHydration"; + } + + if (lane & DefaultLane) { + return "Default"; + } + + if (lane & TransitionHydrationLane) { + return "TransitionHydration"; + } + + if (lane & TransitionLanes) { + return "Transition"; + } + + if (lane & RetryLanes) { + return "Retry"; + } + + if (lane & SelectiveHydrationLane) { + return "SelectiveHydration"; + } + + if (lane & IdleHydrationLane) { + return "IdleHydration"; + } + + if (lane & IdleLane) { + return "Idle"; + } + + if (lane & OffscreenLane) { + return "Offscreen"; + } + } +} var NoTimestamp = -1; var nextTransitionLane = TransitionLane1; var nextRetryLane = RetryLane1; @@ -5007,7 +5366,6 @@ function markRootFinished(root, remainingLanes) { root.expiredLanes &= remainingLanes; root.mutableReadLanes &= remainingLanes; root.entangledLanes &= remainingLanes; - var entanglements = root.entanglements; var eventTimes = root.eventTimes; var expirationTimes = root.expirationTimes; // Clear the lanes that no longer have pending work @@ -5096,20 +5454,6 @@ function movePendingFibersToMemoized(root, lanes) { lanes &= ~lane; } } -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. Only used on lanes, so assume input is an integer. -// Based on: -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 - -var log = Math.log; -var LN2 = Math.LN2; - -function clz32Fallback(lanes) { - if (lanes === 0) { - return 32; - } - - return (31 - ((log(lanes) / LN2) | 0)) | 0; -} var DiscreteEventPriority = SyncLane; var ContinuousEventPriority = InputContinuousLane; @@ -5535,9 +5879,6 @@ function clearContainer(container) { function unhideTextInstance(textInstance, text) { throw new Error("Not yet implemented."); } -function makeClientIdInDEV(warnOnAccessInDEV) { - throw new Error("Not yet implemented"); -} function preparePortalMount(portalInstance) { // noop } @@ -6173,13 +6514,6 @@ function flushSyncCallbacks() { return null; } -var ReactVersion = "18.0.0-afcb9cdc9-20211008"; - -function markComponentRenderStopped() {} -function markComponentErrored(fiber, thrownValue, lanes) {} - -function markComponentSuspended(fiber, wakeable, lanes) {} - var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; var NoTransition = 0; function requestCurrentTransition() { @@ -6214,9 +6548,11 @@ function shallowEqual(objA, objB) { } // Test for A's keys different from B. for (var i = 0; i < keysA.length; i++) { + var currentKey = keysA[i]; + if ( - !hasOwnProperty.call(objB, keysA[i]) || - !objectIs(objA[keysA[i]], objB[keysA[i]]) + !hasOwnProperty.call(objB, currentKey) || + !objectIs(objA[currentKey], objB[currentKey]) ) { return false; } @@ -6323,11 +6659,6 @@ function setIsRendering(rendering) { isRendering = rendering; } } -function getIsRendering() { - { - return isRendering; - } -} var ReactStrictModeWarnings = { recordUnsafeLifecycleWarnings: function(fiber, instance) {}, @@ -6687,7 +7018,6 @@ var ReactStrictModeWarnings = { * of the `value` object). */ // $FlowFixMe only called in DEV, so void return is not possible. - function typeName(value) { { // toStringTag is needed for namespaced types like Temporal.Instant @@ -6702,17 +7032,6 @@ function typeName(value) { function willCoercionThrow(value) { { - if ( - value !== null && - typeof value === "object" && - value.$$typeof === REACT_OPAQUE_ID_TYPE - ) { - // OpaqueID type is expected to throw, so React will handle it. Not sure if - // it's expected that string coercion will throw, but we'll assume it's OK. - // See https://github.com/facebook/react/issues/20127. - return; - } - try { testStringCoercion(value); return false; @@ -7789,6 +8108,10 @@ var classComponentUpdater = { if (root !== null) { entangleTransitions(root, fiber, lane); } + + { + markStateUpdateScheduled(fiber, lane); + } }, enqueueReplaceState: function(inst, payload, callback) { var fiber = get(inst); @@ -7812,6 +8135,10 @@ var classComponentUpdater = { if (root !== null) { entangleTransitions(root, fiber, lane); } + + { + markStateUpdateScheduled(fiber, lane); + } }, enqueueForceUpdate: function(inst, callback) { var fiber = get(inst); @@ -7834,6 +8161,10 @@ var classComponentUpdater = { if (root !== null) { entangleTransitions(root, fiber, lane); } + + { + markForceUpdateScheduled(fiber, lane); + } } }; @@ -8772,6 +9103,84 @@ function updateClassInstance( return shouldUpdate; } +// TODO: Use the unified fiber stack module instead of this local one? +// Intentionally not using it yet to derisk the initial implementation, because +// the way we push/pop these values is a bit unusual. If there's a mistake, I'd +// rather the ids be wrong than crash the whole reconciler. +var forkStack = []; +var forkStackIndex = 0; +var treeForkProvider = null; +var treeForkCount = 0; +var idStack = []; +var idStackIndex = 0; +var treeContextProvider = null; +var treeContextId = 1; +var treeContextOverflow = ""; + +function popTreeContext(workInProgress) { + // Restore the previous values. + // This is a bit more complicated than other context-like modules in Fiber + // because the same Fiber may appear on the stack multiple times and for + // different reasons. We have to keep popping until the work-in-progress is + // no longer at the top of the stack. + while (workInProgress === treeForkProvider) { + treeForkProvider = forkStack[--forkStackIndex]; + forkStack[forkStackIndex] = null; + treeForkCount = forkStack[--forkStackIndex]; + forkStack[forkStackIndex] = null; + } + + while (workInProgress === treeContextProvider) { + treeContextProvider = idStack[--idStackIndex]; + idStack[idStackIndex] = null; + treeContextOverflow = idStack[--idStackIndex]; + idStack[idStackIndex] = null; + treeContextId = idStack[--idStackIndex]; + idStack[idStackIndex] = null; + } +} + +var isHydrating = false; + +function enterHydrationState(fiber) { + { + return false; + } +} + +function prepareToHydrateHostInstance( + fiber, + rootContainerInstance, + hostContext +) { + { + throw new Error( + "Expected prepareToHydrateHostInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } +} + +function prepareToHydrateHostTextInstance(fiber) { + { + throw new Error( + "Expected prepareToHydrateHostTextInstance() to never be called. " + + "This error is likely caused by a bug in React. Please file an issue." + ); + } + var shouldUpdate = hydrateTextInstance(); +} + +function popHydrationState(fiber) { + { + return false; + } +} + +function getIsHydrating() { + return isHydrating; +} + var didWarnAboutMaps; var didWarnAboutGenerators; var didWarnAboutStringRefs; @@ -9055,7 +9464,9 @@ function ChildReconciler(shouldTrackSideEffects) { newFiber.index = newIndex; if (!shouldTrackSideEffects) { - // Noop. + // During hydration, the useId algorithm needs to know which fibers are + // part of a list of children (arrays, iterators). + newFiber.flags |= Forked; return lastPlacedIndex; } @@ -9184,7 +9595,10 @@ function ChildReconciler(shouldTrackSideEffects) { } function createChild(returnFiber, newChild, lanes) { - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. @@ -9247,7 +9661,10 @@ function ChildReconciler(shouldTrackSideEffects) { // Update the fiber if the keys match, otherwise return null. var key = oldFiber !== null ? oldFiber.key : null; - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { // Text nodes don't have keys. If the previous node is implicitly keyed // we can continue to replace it without aborting even if it is not a text // node. @@ -9304,7 +9721,10 @@ function ChildReconciler(shouldTrackSideEffects) { newChild, lanes ) { - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { // Text nodes don't have keys, so we neither have to check the old nor // new node for the key. If both are text nodes, they match. var matchedFiber = existingChildren.get(newIdx) || null; @@ -9495,6 +9915,7 @@ function ChildReconciler(shouldTrackSideEffects) { if (newIdx === newChildren.length) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; } @@ -9701,6 +10122,7 @@ function ChildReconciler(shouldTrackSideEffects) { if (step.done) { // We've reached the end of the new children. We can delete the rest. deleteRemainingChildren(returnFiber, oldFiber); + return resultingFirstChild; } @@ -9987,7 +10409,10 @@ function ChildReconciler(shouldTrackSideEffects) { throwOnInvalidObjectType(returnFiber, newChild); } - if (typeof newChild === "string" || typeof newChild === "number") { + if ( + (typeof newChild === "string" && newChild !== "") || + typeof newChild === "number" + ) { return placeSingleChild( reconcileSingleTextNode( returnFiber, @@ -10177,16 +10602,9 @@ function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { var props = workInProgress.memoizedProps; // Regular boundaries always capture. - if (props.unstable_avoidThisFallback !== true) { + { return true; } // If it's a boundary we should avoid, then we prefer to bubble up to the - // parent boundary if it is currently invisible. - - if (hasInvisibleParent) { - return false; - } // If the parent is not able to handle it, we must handle it. - - return true; } function findFirstSuspended(row) { var node = row; @@ -10259,47 +10677,6 @@ var Passive$1 = /* */ 8; -var isHydrating = false; - -function enterHydrationState(fiber) { - { - return false; - } -} - -function prepareToHydrateHostInstance( - fiber, - rootContainerInstance, - hostContext -) { - { - throw new Error( - "Expected prepareToHydrateHostInstance() to never be called. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } -} - -function prepareToHydrateHostTextInstance(fiber) { - { - throw new Error( - "Expected prepareToHydrateHostTextInstance() to never be called. " + - "This error is likely caused by a bug in React. Please file an issue." - ); - } - var shouldUpdate = hydrateTextInstance(); -} - -function popHydrationState(fiber) { - { - return false; - } -} - -function getIsHydrating() { - return isHydrating; -} - // and should be reset before starting a new render. // This tracks which mutable sources need to be reset after a render. @@ -10361,11 +10738,9 @@ function getSuspendedCachePool() { var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; var didWarnAboutMismatchedHooksForComponent; -var didWarnAboutUseOpaqueIdentifier; var didWarnUncachedGetSnapshot; { - didWarnAboutUseOpaqueIdentifier = {}; didWarnAboutMismatchedHooksForComponent = new Set(); } @@ -10389,7 +10764,13 @@ var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only // TODO: Maybe there's some way to consolidate this with // `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. -var didScheduleRenderPhaseUpdateDuringThisPass = false; +var didScheduleRenderPhaseUpdateDuringThisPass = false; // Counts the number of useId hooks in this component. + +var localIdCounter = 0; // Used for ids that are generated completely client-side (i.e. not during +// hydration). This counter is global, so client ids are not stable across +// render attempts. + +var globalClientIdCounter = 0; var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. @@ -10570,6 +10951,7 @@ function renderWithHooks( // currentHook = null; // workInProgressHook = null; // didScheduleRenderPhaseUpdate = false; + // localIdCounter = 0; // TODO Warn if no hooks are used at all during mount, then some are used during update. // Currently we will identify the update render as a mount because memoizedState === null. // This is tricky because it's valid for certain types of components (e.g. React.lazy) @@ -10601,6 +10983,7 @@ function renderWithHooks( do { didScheduleRenderPhaseUpdateDuringThisPass = false; + localIdCounter = 0; if (numberOfReRenders >= RE_RENDER_LIMIT) { throw new Error( @@ -10669,7 +11052,8 @@ function renderWithHooks( } } - didScheduleRenderPhaseUpdate = false; + didScheduleRenderPhaseUpdate = false; // This is reset by checkDidRenderIdHook + // localIdCounter = 0; if (didRenderTooFewHooks) { throw new Error( @@ -10680,6 +11064,14 @@ function renderWithHooks( return children; } +function checkDidRenderIdHook() { + // This should be called immediately after every renderWithHooks call. + // Conceptually, it's part of the return value of renderWithHooks; it's only a + // separate function to avoid using an array tuple. + var didRenderIdHook = localIdCounter !== 0; + localIdCounter = 0; + return didRenderIdHook; +} function bailoutHooks(current, workInProgress, lanes) { workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the // complete phase (bubbleProperties). @@ -10739,6 +11131,7 @@ function resetHooksAfterThrow() { } didScheduleRenderPhaseUpdateDuringThisPass = false; + localIdCounter = 0; } function mountWorkInProgressHook() { @@ -11640,13 +12033,6 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { } function mountEffect(create, deps) { - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ("undefined" !== typeof jest) { - warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); - } - } - if ((currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { return mountEffectImpl( MountPassiveDev | Passive | PassiveStatic, @@ -11660,13 +12046,6 @@ function mountEffect(create, deps) { } function updateEffect(create, deps) { - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ("undefined" !== typeof jest) { - warnIfNotCurrentlyActingEffectsInDEV(currentlyRenderingFiber$1); - } - } - return updateEffectImpl(Passive, Passive$1, create, deps); } @@ -11972,44 +12351,30 @@ function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { } } -function warnOnOpaqueIdentifierAccessInDEV(fiber) { - { - // TODO: Should warn in effects and callbacks, too - var name = getComponentNameFromFiber(fiber) || "Unknown"; - - if (getIsRendering() && !didWarnAboutUseOpaqueIdentifier[name]) { - error( - "The object passed back from useOpaqueIdentifier is meant to be " + - "passed through to attributes only. Do not read the " + - "value directly." - ); +function mountId() { + var hook = mountWorkInProgressHook(); + var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we + // should do this in Fiber, too? Deferring this decision for now because + // there's no other place to store the prefix except for an internal field on + // the public createRoot object, which the fiber tree does not currently have + // a reference to. - didWarnAboutUseOpaqueIdentifier[name] = true; - } - } -} - -function mountOpaqueIdentifier() { - var makeId = makeClientIdInDEV.bind( - null, - warnOnOpaqueIdentifierAccessInDEV.bind(null, currentlyRenderingFiber$1) - ); + var identifierPrefix = root.identifierPrefix; + var id; { - var _id = makeId(); - - mountState(_id); - return _id; + // Use a lowercase r prefix for client-generated ids. + var globalClientId = globalClientIdCounter++; + id = identifierPrefix + "r:" + globalClientId.toString(32); } -} -function updateOpaqueIdentifier() { - var id = updateState()[0]; + hook.memoizedState = id; return id; } -function rerenderOpaqueIdentifier() { - var id = rerenderState()[0]; +function updateId() { + var hook = updateWorkInProgressHook(); + var id = hook.memoizedState; return id; } @@ -12037,14 +12402,6 @@ function dispatchReducerAction(fiber, queue, action) { enqueueRenderPhaseUpdate(queue, update); } else { enqueueUpdate$1(fiber, queue, update); - - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ("undefined" !== typeof jest) { - warnIfNotCurrentlyActingUpdatesInDev(fiber); - } - } - var eventTime = requestEventTime(); var root = scheduleUpdateOnFiber(fiber, lane, eventTime); @@ -12052,6 +12409,8 @@ function dispatchReducerAction(fiber, queue, action) { entangleTransitionUpdate(root, queue, lane); } } + + markUpdateInDevTools(fiber, lane); } function dispatchSetState(fiber, queue, action) { @@ -12124,13 +12483,6 @@ function dispatchSetState(fiber, queue, action) { } } - { - // $FlowExpectedError - jest isn't a global, and isn't recognized outside of tests - if ("undefined" !== typeof jest) { - warnIfNotCurrentlyActingUpdatesInDev(fiber); - } - } - var eventTime = requestEventTime(); var root = scheduleUpdateOnFiber(fiber, lane, eventTime); @@ -12138,6 +12490,8 @@ function dispatchSetState(fiber, queue, action) { entangleTransitionUpdate(root, queue, lane); } } + + markUpdateInDevTools(fiber, lane); } function isRenderPhaseUpdate(fiber) { @@ -12216,6 +12570,12 @@ function entangleTransitionUpdate(root, queue, lane) { } } +function markUpdateInDevTools(fiber, lane, action) { + { + markStateUpdateScheduled(fiber, lane); + } +} + var ContextOnlyDispatcher = { readContext: readContext, useCallback: throwInvalidHookError, @@ -12233,7 +12593,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, + useId: throwInvalidHookError, unstable_isNewReconciler: enableNewReconciler }; @@ -12370,10 +12730,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; mountHookTypesDev(); - return mountOpaqueIdentifier(); + return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12478,10 +12838,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; updateHookTypesDev(); - return mountOpaqueIdentifier(); + return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12586,10 +12946,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; updateHookTypesDev(); - return updateOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12694,10 +13054,10 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; updateHookTypesDev(); - return rerenderOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12818,11 +13178,11 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; mountHookTypesDev(); return mountSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; warnInvalidHookAccess(); mountHookTypesDev(); - return mountOpaqueIdentifier(); + return mountId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -12943,11 +13303,11 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; warnInvalidHookAccess(); updateHookTypesDev(); - return updateOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -13068,11 +13428,11 @@ var InvalidNestedHooksDispatcherOnRerenderInDEV = null; updateHookTypesDev(); return updateSyncExternalStore(subscribe, getSnapshot); }, - useOpaqueIdentifier: function() { - currentHookNameInDev = "useOpaqueIdentifier"; + useId: function() { + currentHookNameInDev = "useId"; warnInvalidHookAccess(); updateHookTypesDev(); - return rerenderOpaqueIdentifier(); + return updateId(); }, unstable_isNewReconciler: enableNewReconciler }; @@ -13534,137 +13894,133 @@ function resetSuspendedComponent(sourceFiber, rootRenderLanes) { } } -function markNearestSuspenseBoundaryShouldCapture( - returnFiber, - sourceFiber, - root, - rootRenderLanes -) { - var hasInvisibleParentBoundary = hasSuspenseContext( - suspenseStackCursor.current, - InvisibleParentSuspenseContext - ); - var node = returnFiber; - - do { - if ( - node.tag === SuspenseComponent && - shouldCaptureSuspense(node, hasInvisibleParentBoundary) - ) { - // Found the nearest boundary. - var suspenseBoundary = node; // This marks a Suspense boundary so that when we're unwinding the stack, - // it captures the suspended "exception" and does a second (fallback) pass. - - if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { - // Legacy Mode Suspense - // - // If the boundary is in legacy mode, we should *not* - // suspend the commit. Pretend as if the suspended component rendered - // null and keep rendering. When the Suspense boundary completes, - // we'll do a second pass to render the fallback. - if (suspenseBoundary === returnFiber) { - // Special case where we suspended while reconciling the children of - // a Suspense boundary's inner Offscreen wrapper fiber. This happens - // when a React.lazy component is a direct child of a - // Suspense boundary. - // - // Suspense boundaries are implemented as multiple fibers, but they - // are a single conceptual unit. The legacy mode behavior where we - // pretend the suspended fiber committed as `null` won't work, - // because in this case the "suspended" fiber is the inner - // Offscreen wrapper. - // - // Because the contents of the boundary haven't started rendering - // yet (i.e. nothing in the tree has partially rendered) we can - // switch to the regular, concurrent mode behavior: mark the - // boundary with ShouldCapture and enter the unwind phase. - suspenseBoundary.flags |= ShouldCapture; - } else { - suspenseBoundary.flags |= DidCapture; - sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. - // But we shouldn't call any lifecycle methods or callbacks. Remove - // all lifecycle effect tags. - - sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); - - if (sourceFiber.tag === ClassComponent) { - var currentSourceFiber = sourceFiber.alternate; - - if (currentSourceFiber === null) { - // This is a new mount. Change the tag so it's not mistaken for a - // completed class component. For example, we should not call - // componentWillUnmount if it is deleted. - sourceFiber.tag = IncompleteClassComponent; - } else { - // When we try rendering again, we should not reuse the current fiber, - // since it's known to be in an inconsistent state. Use a force update to - // prevent a bail out. - var update = createUpdate(NoTimestamp, SyncLane); - update.tag = ForceUpdate; - enqueueUpdate(sourceFiber, update); - } - } // The source fiber did not complete. Mark it with Sync priority to - // indicate that it still has pending work. - - sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); - } - - return suspenseBoundary; - } // Confirmed that the boundary is in a concurrent mode tree. Continue - // with the normal suspend path. - // - // After this we'll use a set of heuristics to determine whether this - // render pass will run to completion or restart or "suspend" the commit. - // The actual logic for this is spread out in different places. - // - // This first principle is that if we're going to suspend when we complete - // a root, then we should also restart if we get an update or ping that - // might unsuspend it, and vice versa. The only reason to suspend is - // because you think you might want to restart before committing. However, - // it doesn't make sense to restart only while in the period we're suspended. - // - // Restarting too aggressively is also not good because it starves out any - // intermediate loading state. So we use heuristics to determine when. - // Suspense Heuristics - // - // If nothing threw a Promise or all the same fallbacks are already showing, - // then don't suspend/restart. - // - // If this is an initial render of a new tree of Suspense boundaries and - // those trigger a fallback, then don't suspend/restart. We want to ensure - // that we can show the initial loading state as quickly as possible. - // - // If we hit a "Delayed" case, such as when we'd switch from content back into - // a fallback, then we should always suspend/restart. Transitions apply - // to this case. If none is defined, JND is used instead. - // - // If we're already showing a fallback and it gets "retried", allowing us to show - // another level, but there's still an inner boundary that would show a fallback, - // then we suspend/restart for 500ms since the last time we showed a fallback - // anywhere in the tree. This effectively throttles progressive loading into a - // consistent train of commits. This also gives us an opportunity to restart to - // get to the completed state slightly earlier. - // - // If there's ambiguity due to batching it's resolved in preference of: - // 1) "delayed", 2) "initial render", 3) "retry". - // - // We want to ensure that a "busy" state doesn't get force committed. We want to - // ensure that new initial loading states can commit as soon as possible. - - suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in - // the begin phase to prevent an early bailout. +function getNearestSuspenseBoundaryToCapture(returnFiber) { + var node = returnFiber; - suspenseBoundary.lanes = rootRenderLanes; - return suspenseBoundary; + do { + if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) { + return node; } // This boundary already captured during this render. Continue to the next // boundary. node = node.return; - } while (node !== null); // Could not find a Suspense boundary capable of capturing. + } while (node !== null); return null; } +function markSuspenseBoundaryShouldCapture( + suspenseBoundary, + returnFiber, + sourceFiber, + root, + rootRenderLanes +) { + // This marks a Suspense boundary so that when we're unwinding the stack, + // it captures the suspended "exception" and does a second (fallback) pass. + if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { + // Legacy Mode Suspense + // + // If the boundary is in legacy mode, we should *not* + // suspend the commit. Pretend as if the suspended component rendered + // null and keep rendering. When the Suspense boundary completes, + // we'll do a second pass to render the fallback. + if (suspenseBoundary === returnFiber) { + // Special case where we suspended while reconciling the children of + // a Suspense boundary's inner Offscreen wrapper fiber. This happens + // when a React.lazy component is a direct child of a + // Suspense boundary. + // + // Suspense boundaries are implemented as multiple fibers, but they + // are a single conceptual unit. The legacy mode behavior where we + // pretend the suspended fiber committed as `null` won't work, + // because in this case the "suspended" fiber is the inner + // Offscreen wrapper. + // + // Because the contents of the boundary haven't started rendering + // yet (i.e. nothing in the tree has partially rendered) we can + // switch to the regular, concurrent mode behavior: mark the + // boundary with ShouldCapture and enter the unwind phase. + suspenseBoundary.flags |= ShouldCapture; + } else { + suspenseBoundary.flags |= DidCapture; + sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. + // But we shouldn't call any lifecycle methods or callbacks. Remove + // all lifecycle effect tags. + + sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); + + if (sourceFiber.tag === ClassComponent) { + var currentSourceFiber = sourceFiber.alternate; + + if (currentSourceFiber === null) { + // This is a new mount. Change the tag so it's not mistaken for a + // completed class component. For example, we should not call + // componentWillUnmount if it is deleted. + sourceFiber.tag = IncompleteClassComponent; + } else { + // When we try rendering again, we should not reuse the current fiber, + // since it's known to be in an inconsistent state. Use a force update to + // prevent a bail out. + var update = createUpdate(NoTimestamp, SyncLane); + update.tag = ForceUpdate; + enqueueUpdate(sourceFiber, update); + } + } // The source fiber did not complete. Mark it with Sync priority to + // indicate that it still has pending work. + + sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); + } + + return suspenseBoundary; + } // Confirmed that the boundary is in a concurrent mode tree. Continue + // with the normal suspend path. + // + // After this we'll use a set of heuristics to determine whether this + // render pass will run to completion or restart or "suspend" the commit. + // The actual logic for this is spread out in different places. + // + // This first principle is that if we're going to suspend when we complete + // a root, then we should also restart if we get an update or ping that + // might unsuspend it, and vice versa. The only reason to suspend is + // because you think you might want to restart before committing. However, + // it doesn't make sense to restart only while in the period we're suspended. + // + // Restarting too aggressively is also not good because it starves out any + // intermediate loading state. So we use heuristics to determine when. + // Suspense Heuristics + // + // If nothing threw a Promise or all the same fallbacks are already showing, + // then don't suspend/restart. + // + // If this is an initial render of a new tree of Suspense boundaries and + // those trigger a fallback, then don't suspend/restart. We want to ensure + // that we can show the initial loading state as quickly as possible. + // + // If we hit a "Delayed" case, such as when we'd switch from content back into + // a fallback, then we should always suspend/restart. Transitions apply + // to this case. If none is defined, JND is used instead. + // + // If we're already showing a fallback and it gets "retried", allowing us to show + // another level, but there's still an inner boundary that would show a fallback, + // then we suspend/restart for 500ms since the last time we showed a fallback + // anywhere in the tree. This effectively throttles progressive loading into a + // consistent train of commits. This also gives us an opportunity to restart to + // get to the completed state slightly earlier. + // + // If there's ambiguity due to batching it's resolved in preference of: + // 1) "delayed", 2) "initial render", 3) "retry". + // + // We want to ensure that a "busy" state doesn't get force committed. We want to + // ensure that new initial loading states can commit as soon as possible. + + suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in + // the begin phase to prevent an early bailout. + + suspenseBoundary.lanes = rootRenderLanes; + return suspenseBoundary; +} + function throwException( root, returnFiber, @@ -13691,14 +14047,17 @@ function throwException( var wakeable = value; resetSuspendedComponent(sourceFiber); - var suspenseBoundary = markNearestSuspenseBoundaryShouldCapture( - returnFiber, - sourceFiber, - root, - rootRenderLanes - ); + var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber); if (suspenseBoundary !== null) { + suspenseBoundary.flags &= ~ForceClientRender; + markSuspenseBoundaryShouldCapture( + suspenseBoundary, + returnFiber, + sourceFiber, + root, + rootRenderLanes + ); attachWakeableListeners( suspenseBoundary, root, @@ -14102,7 +14461,12 @@ function completeSuspendedOffscreenHostContainer(current, workInProgress) { } function completeWork(current, workInProgress, renderLanes) { - var newProps = workInProgress.pendingProps; + var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing + // to the current tree provider fiber is just as fast and less error-prone. + // Ideally we would have a special version of the work loop only + // for hydration. + + popTreeContext(workInProgress); switch (workInProgress.tag) { case IndeterminateComponent: @@ -14154,7 +14518,7 @@ function completeWork(current, workInProgress, renderLanes) { // Schedule an effect to clear this container at the start of the next commit. // This handles the case of React rendering into a container with previous children. // It's also safe to do for updates too, because current.child would only be null - // if the previous render was null (so the the container would already be empty). + // if the previous render was null (so the container would already be empty). workInProgress.flags |= Snapshot; } } @@ -14301,7 +14665,7 @@ function completeWork(current, workInProgress, renderLanes) { else { var prevState = current.memoizedState; prevDidTimeout = prevState !== null; - } // If the suspended state of the boundary changes, we need to schedule + } // an effect to toggle the subtree's visibility. When we switch from // fallback -> primary, the inner Offscreen fiber schedules this effect // as part of its normal complete phase. But when we switch from @@ -14314,8 +14678,8 @@ function completeWork(current, workInProgress, renderLanes) { // is active that we have to do anything special. if (nextDidTimeout && !prevDidTimeout) { - var offscreenFiber = workInProgress.child; - offscreenFiber.flags |= Visibility; // TODO: This will still suspend a synchronous tree if anything + var _offscreenFiber = workInProgress.child; + _offscreenFiber.flags |= Visibility; // TODO: This will still suspend a synchronous tree if anything // in the concurrent tree already suspended during this render. // This is a known bug. @@ -14329,7 +14693,8 @@ function completeWork(current, workInProgress, renderLanes) { // should be able to immediately restart from within throwException. var hasInvisibleChildContext = current === null && - workInProgress.memoizedProps.unstable_avoidThisFallback !== true; + (workInProgress.memoizedProps.unstable_avoidThisFallback !== true || + !enableSuspenseAvoidThisFallback); if ( hasInvisibleChildContext || @@ -14787,8 +15152,13 @@ function updateForwardRef( var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent var nextChildren; + var hasId; prepareToReadContext(workInProgress, renderLanes); + { + markComponentRenderStarted(workInProgress); + } + { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); @@ -14800,6 +15170,7 @@ function updateForwardRef( ref, renderLanes ); + hasId = checkDidRenderIdHook(); if (workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); @@ -14813,6 +15184,7 @@ function updateForwardRef( ref, renderLanes ); + hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } @@ -14821,10 +15193,14 @@ function updateForwardRef( setIsRendering(false); } + { + markComponentRenderStopped(); + } + if (current !== null && !didReceiveUpdate) { bailoutHooks(current, workInProgress, renderLanes); return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. + } workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, nextChildren, renderLanes); @@ -15247,8 +15623,13 @@ function updateFunctionComponent( } var nextChildren; + var hasId; prepareToReadContext(workInProgress, renderLanes); + { + markComponentRenderStarted(workInProgress); + } + { ReactCurrentOwner$1.current = workInProgress; setIsRendering(true); @@ -15260,6 +15641,7 @@ function updateFunctionComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); if (workInProgress.mode & StrictLegacyMode) { setIsStrictModeForDevtools(true); @@ -15273,6 +15655,7 @@ function updateFunctionComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } @@ -15281,10 +15664,14 @@ function updateFunctionComponent( setIsRendering(false); } + { + markComponentRenderStopped(); + } + if (current !== null && !didReceiveUpdate) { bailoutHooks(current, workInProgress, renderLanes); return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); - } // React DevTools reads this flag. + } workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, nextChildren, renderLanes); @@ -15468,6 +15855,10 @@ function finishClassComponent( stopProfilerTimerIfRunning(); } } else { + { + markComponentRenderStarted(workInProgress); + } + { setIsRendering(true); nextChildren = instance.render(); @@ -15484,6 +15875,10 @@ function finishClassComponent( setIsRendering(false); } + + { + markComponentRenderStopped(); + } } // React DevTools reads this flag. workInProgress.flags |= PerformedWork; @@ -15813,6 +16208,11 @@ function mountIndeterminateComponent( prepareToReadContext(workInProgress, renderLanes); var value; + var hasId; + + { + markComponentRenderStarted(workInProgress); + } { if ( @@ -15847,9 +16247,14 @@ function mountIndeterminateComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); setIsRendering(false); } + { + markComponentRenderStopped(); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; { @@ -15953,6 +16358,7 @@ function mountIndeterminateComponent( context, renderLanes ); + hasId = checkDidRenderIdHook(); } finally { setIsStrictModeForDevtools(false); } @@ -16040,6 +16446,7 @@ function validateFunctionComponentInDev(workInProgress, Component) { var SUSPENDED_MARKER = { dehydrated: null, + treeContext: null, retryLane: NoLane }; @@ -16113,7 +16520,7 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { // Mark this subtree context as having at least one invisible parent that could // handle the fallback state. // Avoided boundaries are not considered since they cannot handle preferred fallback states. - if (nextProps.unstable_avoidThisFallback !== true) { + { suspenseContext = addSubtreeSuspenseContext( suspenseContext, InvisibleParentSuspenseContext @@ -17064,6 +17471,10 @@ function updateContextConsumer(current, workInProgress, renderLanes) { prepareToReadContext(workInProgress, renderLanes); var newValue = readContext(context); + { + markComponentRenderStarted(workInProgress); + } + var newChildren; { @@ -17073,6 +17484,10 @@ function updateContextConsumer(current, workInProgress, renderLanes) { setIsRendering(false); } + { + markComponentRenderStopped(); + } // React DevTools reads this flag. + workInProgress.flags |= PerformedWork; reconcileChildren(current, workInProgress, newChildren, renderLanes); return workInProgress.child; @@ -17620,6 +18035,12 @@ function beginWork(current, workInProgress, renderLanes) { } function unwindWork(workInProgress, renderLanes) { + // Note: This intentionally doesn't check if we're hydrating because comparing + // to the current tree provider fiber is just as fast and less error-prone. + // Ideally we would have a special version of the work loop only + // for hydration. + popTreeContext(workInProgress); + switch (workInProgress.tag) { case ClassComponent: { var Component = workInProgress.type; @@ -17715,6 +18136,12 @@ function unwindWork(workInProgress, renderLanes) { } function unwindInterruptedWork(interruptedWork, renderLanes) { + // Note: This intentionally doesn't check if we're hydrating because comparing + // to the current tree provider fiber is just as fast and less error-prone. + // Ideally we would have a special version of the work loop only + // for hydration. + popTreeContext(interruptedWork); + switch (interruptedWork.tag) { case ClassComponent: { var childContextTypes = interruptedWork.type.childContextTypes; @@ -18039,7 +18466,23 @@ function commitHookEffectListUnmount( effect.destroy = undefined; if (destroy !== undefined) { + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectUnmountStarted(finishedWork); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectUnmountStarted(finishedWork); + } + } + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); + + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectUnmountStopped(); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectUnmountStopped(); + } + } } } @@ -18048,7 +18491,7 @@ function commitHookEffectListUnmount( } } -function commitHookEffectListMount(tag, finishedWork) { +function commitHookEffectListMount(flags, finishedWork) { var updateQueue = finishedWork.updateQueue; var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; @@ -18057,11 +18500,26 @@ function commitHookEffectListMount(tag, finishedWork) { var effect = firstEffect; do { - if ((effect.tag & tag) === tag) { - // Mount + if ((effect.tag & flags) === flags) { + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectMountStarted(finishedWork); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectMountStarted(finishedWork); + } + } // Mount + var create = effect.create; effect.destroy = create(); + { + if ((flags & Passive$1) !== NoFlags$1) { + markComponentPassiveEffectMountStopped(); + } else if ((flags & Layout) !== NoFlags$1) { + markComponentLayoutEffectMountStopped(); + } + } + { var destroy = effect.destroy; @@ -18655,10 +19113,13 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor) { tag = _effect.tag; if (destroy !== undefined) { - if ( - (tag & Insertion) !== NoFlags$1 || - (tag & Layout) !== NoFlags$1 - ) { + if ((tag & Insertion) !== NoFlags$1) { + safelyCallDestroy(current, nearestMountedAncestor, destroy); + } else if ((tag & Layout) !== NoFlags$1) { + { + markComponentLayoutEffectUnmountStarted(current); + } + if (current.mode & ProfileMode) { startLayoutEffectTimer(); safelyCallDestroy(current, nearestMountedAncestor, destroy); @@ -18666,6 +19127,10 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor) { } else { safelyCallDestroy(current, nearestMountedAncestor, destroy); } + + { + markComponentLayoutEffectUnmountStopped(); + } } } @@ -19927,11 +20392,46 @@ if (typeof Symbol === "function" && Symbol.for) { TEXT_TYPE = symbolFor$1("selector.text"); } +var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; +function isLegacyActEnvironment(fiber) { + { + // Legacy mode. We preserve the behavior of React 17's act. It assumes an + // act environment whenever `jest` is defined, but you can still turn off + // spurious warnings by setting IS_REACT_ACT_ENVIRONMENT explicitly + // to false. + var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" + ? IS_REACT_ACT_ENVIRONMENT + : undefined; // $FlowExpectedError - Flow doesn't know about jest + + var jestIsDefined = typeof jest !== "undefined"; + return jestIsDefined && isReactActEnvironmentGlobal !== false; + } +} +function isConcurrentActEnvironment() { + { + var isReactActEnvironmentGlobal = // $FlowExpectedError – Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global + typeof IS_REACT_ACT_ENVIRONMENT !== "undefined" + ? IS_REACT_ACT_ENVIRONMENT + : undefined; + + if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) { + // TODO: Include link to relevant documentation page. + error( + "The current testing environment is not configured to support " + + "act(...)" + ); + } + + return isReactActEnvironmentGlobal; + } +} + var ceil = Math.ceil; var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig, - ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; + ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; var NoContext = /* */ 0; @@ -19984,7 +20484,9 @@ var workInProgressRootIncludedLanes = NoLanes; // The work left over by componen var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. -var workInProgressRootUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. +var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). + +var workInProgressRootRenderPhaseUpdatedLanes = NoLanes; // Lanes that were pinged (in an interleaved event) during this render. var workInProgressRootPingedLanes = NoLanes; // The most recent time we committed a fallback. This lets us ensure a train // model where we don't commit new loading states in too quick succession. @@ -20011,7 +20513,7 @@ var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfi var rootDoesHavePassiveEffects = false; var rootWithPendingPassiveEffects = null; var pendingPassiveEffectsLanes = NoLanes; -var pendingPassiveProfilerEffects = []; // Use these to prevent an infinite loop of nested updates +var pendingPassiveProfilerEffects = []; var NESTED_UPDATE_LIMIT = 50; var nestedUpdateCount = 0; @@ -20116,60 +20618,80 @@ function requestRetryLane(fiber) { function scheduleUpdateOnFiber(fiber, lane, eventTime) { checkForNestedUpdates(); - warnAboutRenderPhaseUpdatesInDEV(fiber); var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (root === null) { return null; - } - - { - if (isDevToolsPresent) { - addFiberToLanesMap(root, fiber, lane); - } } // Mark that the root has a pending update. markRootUpdated(root, lane, eventTime); - if (root === workInProgressRoot) { - // Received an update to a tree that's in the middle of rendering. Mark - // that there was an interleaved update work on this root. Unless the - // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render - // phase update. In that case, we don't treat render phase updates as if - // they were interleaved, for backwards compat reasons. - if ((executionContext & RenderContext) === NoContext) { - workInProgressRootUpdatedLanes = mergeLanes( - workInProgressRootUpdatedLanes, - lane - ); + if ( + (executionContext & RenderContext) !== NoLanes && + root === workInProgressRoot + ) { + // This update was dispatched during the render phase. This is a mistake + // if the update originates from user space (with the exception of local + // hook updates, which are handled differently and don't reach this + // function), but there are some internal React features that use this as + // an implementation detail, like selective hydration. + warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase + + workInProgressRootRenderPhaseUpdatedLanes = mergeLanes( + workInProgressRootRenderPhaseUpdatedLanes, + lane + ); + } else { + // This is a normal update, scheduled from outside the render phase. For + // example, during an input event. + { + if (isDevToolsPresent) { + addFiberToLanesMap(root, fiber, lane); + } } - if (workInProgressRootExitStatus === RootSuspendedWithDelay) { - // The root already suspended with a delay, which means this render - // definitely won't finish. Since we have a new update, let's mark it as - // suspended now, right before marking the incoming update. This has the - // effect of interrupting the current render and switching to the update. - // TODO: Make sure this doesn't override pings that happen while we've - // already started rendering. - markRootSuspended$1(root, workInProgressRootRenderLanes); + warnIfUpdatesNotWrappedWithActDEV(fiber); + + if (root === workInProgressRoot) { + // Received an update to a tree that's in the middle of rendering. Mark + // that there was an interleaved update work on this root. Unless the + // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render + // phase update. In that case, we don't treat render phase updates as if + // they were interleaved, for backwards compat reasons. + if ((executionContext & RenderContext) === NoContext) { + workInProgressRootInterleavedUpdatedLanes = mergeLanes( + workInProgressRootInterleavedUpdatedLanes, + lane + ); + } + + if (workInProgressRootExitStatus === RootSuspendedWithDelay) { + // The root already suspended with a delay, which means this render + // definitely won't finish. Since we have a new update, let's mark it as + // suspended now, right before marking the incoming update. This has the + // effect of interrupting the current render and switching to the update. + // TODO: Make sure this doesn't override pings that happen while we've + // already started rendering. + markRootSuspended$1(root, workInProgressRootRenderLanes); + } } - } - ensureRootIsScheduled(root, eventTime); + ensureRootIsScheduled(root, eventTime); - if ( - lane === SyncLane && - executionContext === NoContext && - (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy - ) { - // Flush the synchronous work now, unless we're already working or inside - // a batch. This is intentionally inside scheduleUpdateOnFiber instead of - // scheduleCallbackForFiber to preserve the ability to schedule a callback - // without immediately flushing it. We only do this for user-initiated - // updates, to preserve historical behavior of legacy mode. - resetRenderTimer(); - flushSyncCallbacksOnlyInLegacyMode(); + if ( + lane === SyncLane && + executionContext === NoContext && + (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. + !ReactCurrentActQueue$1.isBatchingLegacy + ) { + // Flush the synchronous work now, unless we're already working or inside + // a batch. This is intentionally inside scheduleUpdateOnFiber instead of + // scheduleCallbackForFiber to preserve the ability to schedule a callback + // without immediately flushing it. We only do this for user-initiated + // updates, to preserve historical behavior of legacy mode. + resetRenderTimer(); + flushSyncCallbacksOnlyInLegacyMode(); + } } return root; @@ -20274,7 +20796,7 @@ function ensureRootIsScheduled(root, currentTime) { // Scheduler task, rather than an `act` task, cancel it and re-scheduled // on the `act` queue. !( - ReactCurrentActQueue.current !== null && + ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode ) ) { @@ -20306,8 +20828,8 @@ function ensureRootIsScheduled(root, currentTime) { // Special case: Sync React callbacks are scheduled on a special // internal queue if (root.tag === LegacyRoot) { - if (ReactCurrentActQueue.isBatchingLegacy !== null) { - ReactCurrentActQueue.didScheduleLegacyUpdate = true; + if (ReactCurrentActQueue$1.isBatchingLegacy !== null) { + ReactCurrentActQueue$1.didScheduleLegacyUpdate = true; } scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root)); @@ -20493,11 +21015,28 @@ function recoverFromConcurrentError(root, errorRetryLanes) { { errorHydratingContainer(root.containerInfo); } + } + + var exitStatus; + var MAX_ERROR_RETRY_ATTEMPTS = 50; + + for (var i = 0; i < MAX_ERROR_RETRY_ATTEMPTS; i++) { + exitStatus = renderRootSync(root, errorRetryLanes); + + if ( + exitStatus === RootErrored && + workInProgressRootRenderPhaseUpdatedLanes !== NoLanes + ) { + // There was a render phase update during this render. Some internal React + // implementation details may use this as a trick to schedule another + // render pass. To protect against an inifinite loop, eventually + // we'll give up. + continue; + } - clearContainer(root.containerInfo); + break; } - var exitStatus = renderRootSync(root, errorRetryLanes); executionContext = prevExecutionContext; return exitStatus; } @@ -20618,7 +21157,7 @@ function finishConcurrentRender(root, exitStatus, lanes) { function isRenderConsistentWithExternalStores(finishedWork) { // Search the rendered tree for external store reads, and check whether the - // stores were mutated in a concurrent event. Intentionally using a iterative + // stores were mutated in a concurrent event. Intentionally using an iterative // loop instead of recursion so we can exit early. var node = finishedWork; @@ -20684,7 +21223,10 @@ function markRootSuspended$1(root, suspendedLanes) { // TODO: Lol maybe there's a better way to factor this besides this // obnoxiously named function :) suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); - suspendedLanes = removeLanes(suspendedLanes, workInProgressRootUpdatedLanes); + suspendedLanes = removeLanes( + suspendedLanes, + workInProgressRootInterleavedUpdatedLanes + ); markRootSuspended(root, suspendedLanes); } // This is the entry point for synchronous tasks that don't go // through Scheduler @@ -20710,31 +21252,16 @@ function performSyncWorkOnRoot(root) { var exitStatus = renderRootSync(root, lanes); if (root.tag !== LegacyRoot && exitStatus === RootErrored) { - var prevExecutionContext = executionContext; - executionContext |= RetryAfterError; // If an error occurred during hydration, - // discard server response and fall back to client side render. - - if (root.isDehydrated) { - root.isDehydrated = false; - - { - errorHydratingContainer(root.containerInfo); - } - - clearContainer(root.containerInfo); - } // If something threw an error, try rendering one more time. We'll render + // If something threw an error, try rendering one more time. We'll render // synchronously to block concurrent data mutations, and we'll includes // all pending updates are included. If it still fails after the second // attempt, we'll give up and commit the resulting tree. - var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); if (errorRetryLanes !== NoLanes) { lanes = errorRetryLanes; - exitStatus = renderRootSync(root, lanes); + exitStatus = recoverFromConcurrentError(root, errorRetryLanes); } - - executionContext = prevExecutionContext; } if (exitStatus === RootFatalErrored) { @@ -20767,7 +21294,7 @@ function batchedUpdates$1(fn, a) { if ( executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. - !ReactCurrentActQueue.isBatchingLegacy + !ReactCurrentActQueue$1.isBatchingLegacy ) { resetRenderTimer(); flushSyncCallbacksOnlyInLegacyMode(); @@ -20855,7 +21382,8 @@ function prepareFreshStack(root, lanes) { workInProgressRootExitStatus = RootIncomplete; workInProgressRootFatalError = null; workInProgressRootSkippedLanes = NoLanes; - workInProgressRootUpdatedLanes = NoLanes; + workInProgressRootInterleavedUpdatedLanes = NoLanes; + workInProgressRootRenderPhaseUpdatedLanes = NoLanes; workInProgressRootPingedLanes = NoLanes; enqueueInterleavedUpdates(); @@ -20997,7 +21525,7 @@ function renderDidSuspendDelayIfPossible() { if ( workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || - includesNonIdleWork(workInProgressRootUpdatedLanes)) + includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes)) ) { // Mark the current render as suspended so that we switch to working on // the updates that were skipped. Usually we only suspend at the end of @@ -21048,6 +21576,10 @@ function renderRootSync(root, lanes) { prepareFreshStack(root, lanes); } + { + markRenderStarted(lanes); + } + do { try { workLoopSync(); @@ -21069,6 +21601,10 @@ function renderRootSync(root, lanes) { ); } + { + markRenderStopped(); + } // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; workInProgressRootRenderLanes = NoLanes; return workInProgressRootExitStatus; @@ -21110,6 +21646,10 @@ function renderRootConcurrent(root, lanes) { prepareFreshStack(root, lanes); } + { + markRenderStarted(lanes); + } + do { try { workLoopConcurrent(); @@ -21124,8 +21664,18 @@ function renderRootConcurrent(root, lanes) { executionContext = prevExecutionContext; if (workInProgress !== null) { + // Still work remaining. + { + markRenderYielded(); + } + return RootIncomplete; } else { + // Completed the tree. + { + markRenderStopped(); + } // Set this to null to indicate there's no in-progress render. + workInProgressRoot = null; workInProgressRootRenderLanes = NoLanes; // Return the final exit status. @@ -21297,7 +21847,15 @@ function commitRootImpl(root, renderPriorityLevel) { var finishedWork = root.finishedWork; var lanes = root.finishedLanes; + { + markCommitStarted(lanes); + } + if (finishedWork === null) { + { + markCommitStopped(); + } + return null; } else { { @@ -21346,7 +21904,10 @@ function commitRootImpl(root, renderPriorityLevel) { if (!rootDoesHavePassiveEffects) { rootDoesHavePassiveEffects = true; scheduleCallback$1(NormalPriority, function() { - flushPassiveEffects(); + flushPassiveEffects(); // This render triggered passive effects: release the root cache pool + // *after* passive effects fire to avoid freeing a cache pool that may + // be referenced by a node in the tree (HostRoot, Cache boundary etc) + return null; }); } @@ -21400,7 +21961,15 @@ function commitRootImpl(root, renderPriorityLevel) { root.current = finishedWork; // The next phase is the layout phase, where we call effects that read + { + markLayoutEffectsStarted(lanes); + } + commitLayoutEffects(finishedWork, root, lanes); + + { + markLayoutEffectsStopped(); + } // opportunity to paint. requestPaint(); @@ -21504,6 +22073,10 @@ function commitRootImpl(root, renderPriorityLevel) { flushSyncCallbacks(); + { + markCommitStopped(); + } + return null; } @@ -21526,7 +22099,7 @@ function flushPassiveEffects() { return flushPassiveEffectsImpl(); } finally { setCurrentUpdatePriority(previousPriority); - ReactCurrentBatchConfig$2.transition = prevTransition; + ReactCurrentBatchConfig$2.transition = prevTransition; // Once passive effects have run for the tree - giving components a } } @@ -21552,6 +22125,7 @@ function flushPassiveEffectsImpl() { } var root = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; // TODO: This is sometimes out of sync with rootWithPendingPassiveEffects. // Figure out why and fix it. It's not causing any known issues (probably // because it's only used for profiling), but it's a refactor hazard. @@ -21562,6 +22136,10 @@ function flushPassiveEffectsImpl() { throw new Error("Cannot flush passive effects while already rendering."); } + { + markPassiveEffectsStarted(lanes); + } + var prevExecutionContext = executionContext; executionContext |= CommitContext; commitPassiveUnmountEffects(root.current); @@ -21577,6 +22155,10 @@ function flushPassiveEffectsImpl() { } } + { + markPassiveEffectsStopped(); + } + { commitDoubleInvokeEffectsInDEV(root.current, true); } @@ -21707,6 +22289,7 @@ function pingSuspendedRoot(root, wakeable, pingedLanes) { var eventTime = requestEventTime(); markRootPinged(root, pingedLanes); + warnIfSuspenseResolutionNotWrappedWithActDEV(root); if ( workInProgressRoot === root && @@ -22032,11 +22615,7 @@ var didWarnAboutUpdateInRenderForAnotherComponent; function warnAboutRenderPhaseUpdatesInDEV(fiber) { { - if ( - isRendering && - (executionContext & RenderContext) !== NoContext && - !getIsUpdatingOpaqueValueInRenderPhaseInDEV() - ) { + if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { switch (fiber.tag) { case FunctionComponent: case ForwardRef: @@ -22101,7 +22680,7 @@ function scheduleCallback$1(priorityLevel, callback) { { // If we're currently inside an `act` scope, bypass Scheduler and push to // the `act` queue instead. - var actQueue = ReactCurrentActQueue.current; + var actQueue = ReactCurrentActQueue$1.current; if (actQueue !== null) { actQueue.push(callback); @@ -22122,48 +22701,41 @@ function cancelCallback$1(callbackNode) { function shouldForceFlushFallbacksInDEV() { // Never force flush in production. This function should get stripped out. - return ReactCurrentActQueue.current !== null; + return ReactCurrentActQueue$1.current !== null; } -function warnIfNotCurrentlyActingEffectsInDEV(fiber) { +function warnIfUpdatesNotWrappedWithActDEV(fiber) { { - if ( - (fiber.mode & StrictLegacyMode) !== NoMode && - ReactCurrentActQueue.current === null && // Our internal tests use a custom implementation of `act` that works by - // mocking the Scheduler package. Disable the `act` warning. - // TODO: Maybe the warning should be disabled by default, and then turned - // on at the testing frameworks layer? Instead of what we do now, which - // is check if a `jest` global is defined. - ReactCurrentActQueue.disableActWarning === false - ) { - error( - "An update to %s ran an effect, but was not wrapped in act(...).\n\n" + - "When testing, code that causes React state updates should be " + - "wrapped into act(...):\n\n" + - "act(() => {\n" + - " /* fire events that update state */\n" + - "});\n" + - "/* assert on the output */\n\n" + - "This ensures that you're testing the behavior the user would see " + - "in the browser." + - " Learn more at https://reactjs.org/link/wrap-tests-with-act", - getComponentNameFromFiber(fiber) - ); + if (fiber.mode & ConcurrentMode) { + if (!isConcurrentActEnvironment()) { + // Not in an act environment. No need to warn. + return; + } + } else { + // Legacy mode has additional cases where we suppress a warning. + if (!isLegacyActEnvironment()) { + // Not in an act environment. No need to warn. + return; + } + + if (executionContext !== NoContext) { + // Legacy mode doesn't warn if the update is batched, i.e. + // batchedUpdates or flushSync. + return; + } + + if ( + fiber.tag !== FunctionComponent && + fiber.tag !== ForwardRef && + fiber.tag !== SimpleMemoComponent + ) { + // For backwards compatibility with pre-hooks code, legacy mode only + // warns for updates that originate from a hook. + return; + } } - } -} -function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { - { - if ( - executionContext === NoContext && - ReactCurrentActQueue.current === null && // Our internal tests use a custom implementation of `act` that works by - // mocking the Scheduler package. Disable the `act` warning. - // TODO: Maybe the warning should be disabled by default, and then turned - // on at the testing frameworks layer? Instead of what we do now, which - // is check if a `jest` global is defined. - ReactCurrentActQueue.disableActWarning === false - ) { + if (ReactCurrentActQueue$1.current === null) { var previousFiber = current; try { @@ -22193,7 +22765,29 @@ function warnIfNotCurrentlyActingUpdatesInDEV(fiber) { } } -var warnIfNotCurrentlyActingUpdatesInDev = warnIfNotCurrentlyActingUpdatesInDEV; +function warnIfSuspenseResolutionNotWrappedWithActDEV(root) { + { + if ( + root.tag !== LegacyRoot && + isConcurrentActEnvironment() && + ReactCurrentActQueue$1.current === null + ) { + error( + "A suspended resource finished loading inside a test, but the event " + + "was not wrapped in act(...).\n\n" + + "When testing, code that resolves suspended data should be wrapped " + + "into act(...):\n\n" + + "act(() => {\n" + + " /* finish loading suspended data */\n" + + "});\n" + + "/* assert on the output */\n\n" + + "This ensures that you're testing the behavior the user would see " + + "in the browser." + + " Learn more at https://reactjs.org/link/wrap-tests-with-act" + ); + } + } +} /* eslint-disable react-internal/prod-error-codes */ var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. @@ -23261,7 +23855,7 @@ function assignFiberPropertiesInDEV(target, source) { return target; } -function FiberRootNode(containerInfo, tag, hydrate) { +function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.tag = tag; this.containerInfo = containerInfo; this.pendingChildren = null; @@ -23284,6 +23878,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.finishedLanes = NoLanes; this.entangledLanes = NoLanes; this.entanglements = createLaneMap(NoLanes); + this.identifierPrefix = identifierPrefix; { this.effectDuration = 0; @@ -23318,9 +23913,10 @@ function createFiberRoot( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride + concurrentUpdatesByDefaultOverride, + identifierPrefix ) { - var root = new FiberRootNode(containerInfo, tag, hydrate); + var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix); // stateNode is any. var uninitializedFiber = createHostRootFiber( @@ -23342,6 +23938,8 @@ function createFiberRoot( return root; } +var ReactVersion = "18.0.0-rc.0-51947a14b-20220113"; + function createPortal( children, containerInfo, // TODO: figure out the API for cross-renderer implementation. @@ -23467,7 +24065,8 @@ function createContainer( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride + concurrentUpdatesByDefaultOverride, + identifierPrefix ) { return createFiberRoot( containerInfo, @@ -23475,7 +24074,8 @@ function createContainer( hydrate, hydrationCallbacks, isStrictMode, - concurrentUpdatesByDefaultOverride + concurrentUpdatesByDefaultOverride, + identifierPrefix ); } function updateContainer(element, container, parentComponent, callback) { @@ -23487,6 +24087,10 @@ function updateContainer(element, container, parentComponent, callback) { var eventTime = requestEventTime(); var lane = requestUpdateLane(current$1); + { + markRenderScheduled(lane); + } + var context = getContextForSubtree(parentComponent); if (container.context === null) { @@ -24250,7 +24854,15 @@ function render(element, containerTag, callback) { if (!root) { // TODO (bvaughn): If we decide to keep the wrapper component, // We could create a wrapper for containerTag as well to reduce special casing. - root = createContainer(containerTag, LegacyRoot, false, null, false, null); + root = createContainer( + containerTag, + LegacyRoot, + false, + null, + false, + null, + "" + ); roots.set(containerTag, root); } @@ -24323,5 +24935,14 @@ exports.unmountComponentAtNode = unmountComponentAtNode; exports.unmountComponentAtNodeAndRemoveContainer = unmountComponentAtNodeAndRemoveContainer; exports.unstable_batchedUpdates = batchedUpdates; + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); +} + })(); } diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js index 557e1efd6dc4..3772e42c4740 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js index fc9aa87d9e93..34c20b44f2e7 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.fb.js @@ -7,7 +7,7 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ "use strict"; @@ -926,7 +926,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_222 = { +var injectedNamesToPlugins$jscomp$inline_223 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -961,33 +961,33 @@ var injectedNamesToPlugins$jscomp$inline_222 = { } } }, - isOrderingDirty$jscomp$inline_223 = !1, - pluginName$jscomp$inline_224; -for (pluginName$jscomp$inline_224 in injectedNamesToPlugins$jscomp$inline_222) + isOrderingDirty$jscomp$inline_224 = !1, + pluginName$jscomp$inline_225; +for (pluginName$jscomp$inline_225 in injectedNamesToPlugins$jscomp$inline_223) if ( - injectedNamesToPlugins$jscomp$inline_222.hasOwnProperty( - pluginName$jscomp$inline_224 + injectedNamesToPlugins$jscomp$inline_223.hasOwnProperty( + pluginName$jscomp$inline_225 ) ) { - var pluginModule$jscomp$inline_225 = - injectedNamesToPlugins$jscomp$inline_222[pluginName$jscomp$inline_224]; + var pluginModule$jscomp$inline_226 = + injectedNamesToPlugins$jscomp$inline_223[pluginName$jscomp$inline_225]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_224) || - namesToPlugins[pluginName$jscomp$inline_224] !== - pluginModule$jscomp$inline_225 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_225) || + namesToPlugins[pluginName$jscomp$inline_225] !== + pluginModule$jscomp$inline_226 ) { - if (namesToPlugins[pluginName$jscomp$inline_224]) + if (namesToPlugins[pluginName$jscomp$inline_225]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_224 + "`.") + (pluginName$jscomp$inline_225 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_224 - ] = pluginModule$jscomp$inline_225; - isOrderingDirty$jscomp$inline_223 = !0; + pluginName$jscomp$inline_225 + ] = pluginModule$jscomp$inline_226; + isOrderingDirty$jscomp$inline_224 = !0; } } -isOrderingDirty$jscomp$inline_223 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_224 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1697,6 +1697,19 @@ function onCommitRoot(root) { ); } catch (err) {} } +function injectProfilingHooks() {} +function getLaneLabelMap() { + for (var map = new Map(), lane = 1, index$4 = 0; 31 > index$4; index$4++) + map.set(lane, void 0), (lane *= 2); + return map; +} +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, + log = Math.log, + LN2 = Math.LN2; +function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; +} var nextTransitionLane = 64, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { @@ -1862,30 +1875,24 @@ function markRootFinished(root, remainingLanes) { remainingLanes = root.entanglements; var eventTimes = root.eventTimes; for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) { - var index$8 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$8; - remainingLanes[index$8] = 0; - eventTimes[index$8] = -1; - root[index$8] = -1; + var index$9 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$9; + remainingLanes[index$9] = 0; + eventTimes[index$9] = -1; + root[index$9] = -1; noLongerPendingLanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$9 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$9; - (lane & entangledLanes) | (root[index$9] & entangledLanes) && - (root[index$9] |= entangledLanes); + var index$10 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$10; + (lane & entangledLanes) | (root[index$10] & entangledLanes) && + (root[index$10] |= entangledLanes); rootEntangledLanes &= ~lane; } } -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, - log = Math.log, - LN2 = Math.LN2; -function clz32Fallback(lanes) { - return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; -} var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; @@ -2087,12 +2094,14 @@ function shallowEqual(objA, objB) { var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; - for (keysB = 0; keysB < keysA.length; keysB++) + for (keysB = 0; keysB < keysA.length; keysB++) { + var currentKey = keysA[keysB]; if ( - !hasOwnProperty.call(objB, keysA[keysB]) || - !objectIs(objA[keysA[keysB]], objB[keysA[keysB]]) + !hasOwnProperty.call(objB, currentKey) || + !objectIs(objA[currentKey], objB[currentKey]) ) return !1; + } return !0; } function describeFiber(fiber) { @@ -2602,6 +2611,26 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { "function" === typeof instance.componentDidMount && (workInProgress.flags |= 4); } +var forkStack = [], + forkStackIndex = 0, + treeForkProvider = null, + idStack = [], + idStackIndex = 0, + treeContextProvider = null; +function popTreeContext(workInProgress) { + for (; workInProgress === treeForkProvider; ) + (treeForkProvider = forkStack[--forkStackIndex]), + (forkStack[forkStackIndex] = null), + --forkStackIndex, + (forkStack[forkStackIndex] = null); + for (; workInProgress === treeContextProvider; ) + (treeContextProvider = idStack[--idStackIndex]), + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -2696,7 +2725,8 @@ function ChildReconciler(shouldTrackSideEffects) { } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; - if (!shouldTrackSideEffects) return lastPlacedIndex; + if (!shouldTrackSideEffects) + return (newFiber.flags |= 1048576), lastPlacedIndex; newIndex = newFiber.alternate; if (null !== newIndex) return ( @@ -2787,7 +2817,10 @@ function ChildReconciler(shouldTrackSideEffects) { return current; } function createChild(returnFiber, newChild, lanes) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (newChild = createFiberFromText( "" + newChild, @@ -2841,7 +2874,10 @@ function ChildReconciler(shouldTrackSideEffects) { } function updateSlot(returnFiber, oldFiber, newChild, lanes) { var key = null !== oldFiber ? oldFiber.key : null; - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return null !== key ? null : updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); @@ -2871,7 +2907,10 @@ function ChildReconciler(shouldTrackSideEffects) { newChild, lanes ) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (existingChildren = existingChildren.get(newIdx) || null), updateTextNode(returnFiber, existingChildren, "" + newChild, lanes) @@ -3197,7 +3236,8 @@ function ChildReconciler(shouldTrackSideEffects) { ); throwOnInvalidObjectType(returnFiber, newChild); } - return "string" === typeof newChild || "number" === typeof newChild + return ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), @@ -3300,7 +3340,8 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, - didScheduleRenderPhaseUpdateDuringThisPass = !1; + didScheduleRenderPhaseUpdateDuringThisPass = !1, + globalClientIdCounter = 0; function throwInvalidHookError() { throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." @@ -3723,7 +3764,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(4196352, 8, create, deps); + return mountEffectImpl(8390656, 8, create, deps); } function updateEffect(create, deps) { return updateEffectImpl(2048, 8, create, deps); @@ -3803,6 +3844,9 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } +function updateId() { + return updateWorkInProgressHook().memoizedState; +} function dispatchReducerAction(fiber, queue, action) { var lane = requestUpdateLane(fiber); action = { @@ -3910,7 +3954,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, + useId: throwInvalidHookError, unstable_isNewReconciler: !1 }, HooksDispatcherOnMount = { @@ -4008,8 +4052,12 @@ var ContextOnlyDispatcher = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - throw Error("Not yet implemented"); + useId: function() { + var hook = mountWorkInProgressHook(), + identifierPrefix = workInProgressRoot.identifierPrefix, + globalClientId = globalClientIdCounter++; + identifierPrefix = identifierPrefix + "r:" + globalClientId.toString(32); + return (hook.memoizedState = identifierPrefix); }, unstable_isNewReconciler: !1 }, @@ -4092,9 +4140,7 @@ var ContextOnlyDispatcher = { } return nextSnapshot; }, - useOpaqueIdentifier: function() { - return updateReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }, HooksDispatcherOnRerender = { @@ -4137,9 +4183,7 @@ var ContextOnlyDispatcher = { }, useMutableSource: updateMutableSource, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - return rerenderReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }; function createCapturedValue(value, source) { @@ -4254,14 +4298,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$35 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$35 = lastTailNode), + for (var lastTailNode$36 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$36 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$35 + null === lastTailNode$36 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$35.sibling = null); + : (lastTailNode$36.sibling = null); } } function bubbleProperties(completedWork) { @@ -4271,25 +4315,26 @@ function bubbleProperties(completedWork) { newChildLanes = 0, subtreeFlags = 0; if (didBailout) - for (var child$36 = completedWork.child; null !== child$36; ) - (newChildLanes |= child$36.lanes | child$36.childLanes), - (subtreeFlags |= child$36.subtreeFlags & 7340032), - (subtreeFlags |= child$36.flags & 7340032), - (child$36.return = completedWork), - (child$36 = child$36.sibling); + for (var child$37 = completedWork.child; null !== child$37; ) + (newChildLanes |= child$37.lanes | child$37.childLanes), + (subtreeFlags |= child$37.subtreeFlags & 14680064), + (subtreeFlags |= child$37.flags & 14680064), + (child$37.return = completedWork), + (child$37 = child$37.sibling); else - for (child$36 = completedWork.child; null !== child$36; ) - (newChildLanes |= child$36.lanes | child$36.childLanes), - (subtreeFlags |= child$36.subtreeFlags), - (subtreeFlags |= child$36.flags), - (child$36.return = completedWork), - (child$36 = child$36.sibling); + for (child$37 = completedWork.child; null !== child$37; ) + (newChildLanes |= child$37.lanes | child$37.childLanes), + (subtreeFlags |= child$37.subtreeFlags), + (subtreeFlags |= child$37.flags), + (child$37.return = completedWork), + (child$37 = child$37.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; } function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; + popTreeContext(workInProgress); switch (workInProgress.tag) { case 2: case 16: @@ -4418,11 +4463,7 @@ function completeWork(current, workInProgress, renderLanes) { !renderLanes && ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) - if ( - (null === current && - !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || - 0 !== (suspenseStackCursor.current & 1) - ) + if (null === current || 0 !== (suspenseStackCursor.current & 1)) 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 3); else { @@ -4434,7 +4475,7 @@ function completeWork(current, workInProgress, renderLanes) { workInProgressRootExitStatus = 4; null === workInProgressRoot || (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootUpdatedLanes & 268435455)) || + 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || markRootSuspended$1( workInProgressRoot, workInProgressRootRenderLanes @@ -4489,7 +4530,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (type = current), - (renderLanes.flags &= 7340034), + (renderLanes.flags &= 14680066), (updatePayload = renderLanes.alternate), null === updatePayload ? ((renderLanes.childLanes = 0), @@ -5070,7 +5111,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } -var SUSPENDED_MARKER = { dehydrated: null, retryLane: 0 }; +var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: null }; } @@ -5084,11 +5125,9 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseContext & 2)); - JSCompiler_temp - ? ((showFallback = !0), (workInProgress.flags &= -129)) - : (null !== current && null === current.memoizedState) || - !0 === nextProps.unstable_avoidThisFallback || - (suspenseContext |= 1); + if (JSCompiler_temp) (showFallback = !0), (workInProgress.flags &= -129); + else if (null === current || null !== current.memoizedState) + suspenseContext |= 1; push(suspenseStackCursor, suspenseContext & 1); if (null === current) { current = nextProps.children; @@ -5263,7 +5302,7 @@ function updateSuspenseFallbackChildren( (primaryChildren.pendingProps = primaryChildProps), (workInProgress.deletions = null)) : ((primaryChildren = createWorkInProgress(current, primaryChildProps)), - (primaryChildren.subtreeFlags = current.subtreeFlags & 7340032)); + (primaryChildren.subtreeFlags = current.subtreeFlags & 14680064)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5487,6 +5526,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate( return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } function unwindWork(workInProgress) { + popTreeContext(workInProgress); switch (workInProgress.tag) { case 1: isContextProvider(workInProgress.type) && popContext(); @@ -5544,6 +5584,13 @@ function safelyDetachRef(current, nearestMountedAncestor) { } else ref.current = null; } +function safelyCallDestroy(current, nearestMountedAncestor, destroy) { + try { + destroy(); + } catch (error) { + captureCommitPhaseError(current, nearestMountedAncestor, error); + } +} var shouldFireAfterActiveInstanceBlur = !1; function commitBeforeMutationEffects(root, firstChild) { for (nextEffect = firstChild; null !== nextEffect; ) @@ -5608,7 +5655,7 @@ function commitBeforeMutationEffects(root, firstChild) { function commitHookEffectListUnmount( flags, finishedWork, - nearestMountedAncestor$jscomp$0 + nearestMountedAncestor ) { var updateQueue = finishedWork.updateQueue; updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; @@ -5618,35 +5665,28 @@ function commitHookEffectListUnmount( if ((effect.tag & flags) === flags) { var destroy = effect.destroy; effect.destroy = void 0; - if (void 0 !== destroy) { - var current = finishedWork, - nearestMountedAncestor = nearestMountedAncestor$jscomp$0; - try { - destroy(); - } catch (error) { - captureCommitPhaseError(current, nearestMountedAncestor, error); - } - } + void 0 !== destroy && + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); } effect = effect.next; } while (effect !== updateQueue); } } -function commitHookEffectListMount(tag, finishedWork) { +function commitHookEffectListMount(flags, finishedWork) { finishedWork = finishedWork.updateQueue; finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; if (null !== finishedWork) { var effect = (finishedWork = finishedWork.next); do { - if ((effect.tag & tag) === tag) { - var create$80 = effect.create; - effect.destroy = create$80(); + if ((effect.tag & flags) === flags) { + var create$81 = effect.create; + effect.destroy = create$81(); } effect = effect.next; } while (effect !== finishedWork); } } -function commitUnmount(finishedRoot, current, nearestMountedAncestor$jscomp$0) { +function commitUnmount(finishedRoot, current, nearestMountedAncestor) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberUnmount) try { injectedHook.onCommitFiberUnmount(rendererID, current); @@ -5666,24 +5706,17 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor$jscomp$0) { var _effect = effect, destroy = _effect.destroy; _effect = _effect.tag; - if ( - void 0 !== destroy && - (0 !== (_effect & 2) || 0 !== (_effect & 4)) - ) { - _effect = current; - var nearestMountedAncestor = nearestMountedAncestor$jscomp$0; - try { - destroy(); - } catch (error) { - captureCommitPhaseError(_effect, nearestMountedAncestor, error); - } - } + void 0 !== destroy && + (0 !== (_effect & 2) + ? safelyCallDestroy(current, nearestMountedAncestor, destroy) + : 0 !== (_effect & 4) && + safelyCallDestroy(current, nearestMountedAncestor, destroy)); effect = effect.next; } while (effect !== finishedRoot); } break; case 1: - safelyDetachRef(current, nearestMountedAncestor$jscomp$0); + safelyDetachRef(current, nearestMountedAncestor); finishedRoot = current.stateNode; if ("function" === typeof finishedRoot.componentWillUnmount) try { @@ -5691,22 +5724,14 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor$jscomp$0) { (finishedRoot.state = current.memoizedState), finishedRoot.componentWillUnmount(); } catch (error) { - captureCommitPhaseError( - current, - nearestMountedAncestor$jscomp$0, - error - ); + captureCommitPhaseError(current, nearestMountedAncestor, error); } break; case 5: - safelyDetachRef(current, nearestMountedAncestor$jscomp$0); + safelyDetachRef(current, nearestMountedAncestor); break; case 4: - unmountHostComponents( - finishedRoot, - current, - nearestMountedAncestor$jscomp$0 - ); + unmountHostComponents(finishedRoot, current, nearestMountedAncestor); } } function detachFiberAfterEffects(fiber) { @@ -6105,8 +6130,8 @@ function commitMutationEffects(root, firstChild) { switch (firstChild.tag) { case 13: if (null !== firstChild.memoizedState) { - var current$85 = firstChild.alternate; - if (null === current$85 || null === current$85.memoizedState) + var current$86 = firstChild.alternate; + if (null === current$86 || null === current$86.memoizedState) globalMostRecentFallbackTime = now(); } break; @@ -6257,8 +6282,8 @@ function commitLayoutEffects(finishedWork) { commitUpdateQueue(firstChild, updateQueue, instance); break; case 3: - var updateQueue$81 = firstChild.updateQueue; - if (null !== updateQueue$81) { + var updateQueue$82 = firstChild.updateQueue; + if (null !== updateQueue$82) { current = null; if (null !== firstChild.child) switch (firstChild.child.tag) { @@ -6268,7 +6293,7 @@ function commitLayoutEffects(finishedWork) { case 1: current = firstChild.child.stateNode; } - commitUpdateQueue(firstChild, updateQueue$81, current); + commitUpdateQueue(firstChild, updateQueue$82, current); } break; case 5: @@ -6340,7 +6365,8 @@ var ceil = Math.ceil, workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, - workInProgressRootUpdatedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, @@ -6387,16 +6413,19 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; markRootUpdated(root, lane, eventTime); - root === workInProgressRoot && - (0 === (executionContext & 2) && (workInProgressRootUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended$1(root, workInProgressRootRenderLanes)); - ensureRootIsScheduled(root, eventTime); - 1 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks()); + 0 !== (executionContext & 2) && root === workInProgressRoot + ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) + : (root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended$1(root, workInProgressRootRenderLanes)), + ensureRootIsScheduled(root, eventTime), + 1 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + includesLegacySyncCallbacks && flushSyncCallbacks())); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6422,12 +6451,12 @@ function ensureRootIsScheduled(root, currentTime) { 0 < lanes; ) { - var index$6 = 31 - clz32(lanes), - lane = 1 << index$6, - expirationTime = expirationTimes[index$6]; + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7, + expirationTime = expirationTimes[index$7]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$6] = computeExpirationTime(lane, currentTime); + expirationTimes[index$7] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -6596,10 +6625,10 @@ function performConcurrentWorkOnRoot(root, didTimeout) { if ((lanes & 4194240) === lanes) break; didTimeout = root.eventTimes; for (prevExecutionContext = -1; 0 < lanes; ) { - var index$5 = 31 - clz32(lanes); - prevDispatcher = 1 << index$5; - index$5 = didTimeout[index$5]; - index$5 > prevExecutionContext && (prevExecutionContext = index$5); + var index$6 = 31 - clz32(lanes); + prevDispatcher = 1 << index$6; + index$6 = didTimeout[index$6]; + index$6 > prevExecutionContext && (prevExecutionContext = index$6); lanes &= ~prevDispatcher; } lanes = prevExecutionContext; @@ -6643,9 +6672,15 @@ function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; root.isDehydrated && (root.isDehydrated = !1); - root = renderRootSync(root, errorRetryLanes); + for ( + var exitStatus, i = 0; + 50 > i && + ((exitStatus = renderRootSync(root, errorRetryLanes)), + 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); + i++ + ); executionContext = prevExecutionContext; - return root; + return exitStatus; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -6683,13 +6718,13 @@ function isRenderConsistentWithExternalStores(finishedWork) { } function markRootSuspended$1(root, suspendedLanes) { suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootUpdatedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$7 = 31 - clz32(suspendedLanes), - lane = 1 << index$7; - root[index$7] = -1; + var index$8 = 31 - clz32(suspendedLanes), + lane = 1 << index$8; + root[index$8] = -1; suspendedLanes &= ~lane; } } @@ -6701,13 +6736,10 @@ function performSyncWorkOnRoot(root) { if (0 === (lanes & 1)) return ensureRootIsScheduled(root, now()), null; var exitStatus = renderRootSync(root, lanes); if (0 !== root.tag && 2 === exitStatus) { - var prevExecutionContext = executionContext; - executionContext |= 8; - root.isDehydrated && (root.isDehydrated = !1); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); - executionContext = prevExecutionContext; + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError(root, errorRetryLanes))); } if (1 === exitStatus) throw ((exitStatus = workInProgressRootFatalError), @@ -6734,6 +6766,7 @@ function prepareFreshStack(root, lanes) { if (null !== workInProgress) for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { var interruptedWork = timeoutHandle; + popTreeContext(interruptedWork); switch (interruptedWork.tag) { case 1: interruptedWork = interruptedWork.type.childContextTypes; @@ -6773,7 +6806,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -6852,69 +6885,59 @@ function handleError(root$jscomp$0, thrownValue) { } b: { sourceFiber$jscomp$0 = returnFiber; - var sourceFiber$jscomp$1 = sourceFiber, - rootRenderLanes = thrownValue, - hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - node = sourceFiber$jscomp$0; do { var JSCompiler_temp; - if ((JSCompiler_temp = 13 === node.tag)) { - var nextState = node.memoizedState; + if ((JSCompiler_temp = 13 === sourceFiber$jscomp$0.tag)) { + var nextState = sourceFiber$jscomp$0.memoizedState; JSCompiler_temp = null !== nextState ? null !== nextState.dehydrated ? !0 : !1 - : !0 !== node.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 : !0; } if (JSCompiler_temp) { - if (0 === (node.mode & 1)) { - if (node === sourceFiber$jscomp$0) node.flags |= 65536; - else { - node.flags |= 128; - sourceFiber$jscomp$1.flags |= 131072; - sourceFiber$jscomp$1.flags &= -52805; - if (1 === sourceFiber$jscomp$1.tag) - if (null === sourceFiber$jscomp$1.alternate) - sourceFiber$jscomp$1.tag = 17; - else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber$jscomp$1, update); - } - sourceFiber$jscomp$1.lanes |= 1; - } - var suspenseBoundary = node; - break b; - } - node.flags |= 65536; - node.lanes = rootRenderLanes; - suspenseBoundary = node; + var suspenseBoundary = sourceFiber$jscomp$0; break b; } - node = node.return; - } while (null !== node); + sourceFiber$jscomp$0 = sourceFiber$jscomp$0.return; + } while (null !== sourceFiber$jscomp$0); suspenseBoundary = null; } if (null !== suspenseBoundary) { - value = void 0; - sourceFiber = suspenseBoundary; - if (sourceFiber.mode & 1) { + suspenseBoundary.flags &= -257; + value = suspenseBoundary; + sourceFiber$jscomp$0 = thrownValue; + if (0 === (value.mode & 1)) + if (value === returnFiber) value.flags |= 65536; + else { + value.flags |= 128; + sourceFiber.flags |= 131072; + sourceFiber.flags &= -52805; + if (1 === sourceFiber.tag) + if (null === sourceFiber.alternate) sourceFiber.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber, update); + } + sourceFiber.lanes |= 1; + } + else (value.flags |= 65536), (value.lanes = sourceFiber$jscomp$0); + sourceFiber = void 0; + value = suspenseBoundary; + if (value.mode & 1) { var pingCache = root.pingCache; null === pingCache ? ((pingCache = root.pingCache = new PossiblyWeakMap()), - (value = new Set()), - pingCache.set(wakeable, value)) - : ((value = pingCache.get(wakeable)), - void 0 === value && - ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(thrownValue)) { - value.add(thrownValue); + (sourceFiber = new Set()), + pingCache.set(wakeable, sourceFiber)) + : ((sourceFiber = pingCache.get(wakeable)), + void 0 === sourceFiber && + ((sourceFiber = new Set()), + pingCache.set(wakeable, sourceFiber))); + if (!sourceFiber.has(thrownValue)) { + sourceFiber.add(thrownValue); var ping = pingSuspendedRoot.bind( null, root, @@ -6924,11 +6947,11 @@ function handleError(root$jscomp$0, thrownValue) { wakeable.then(ping, ping); } } - var wakeables = sourceFiber.updateQueue; + var wakeables = value.updateQueue; if (null === wakeables) { var updateQueue = new Set(); updateQueue.add(wakeable); - sourceFiber.updateQueue = updateQueue; + value.updateQueue = updateQueue; } else wakeables.add(wakeable); break a; } else @@ -6970,12 +6993,12 @@ function handleError(root$jscomp$0, thrownValue) { root.flags |= 65536; thrownValue &= -thrownValue; root.lanes |= thrownValue; - var update$33 = createClassErrorUpdate( + var update$34 = createClassErrorUpdate( root, wakeable, thrownValue ); - enqueueCapturedUpdate(root, update$33); + enqueueCapturedUpdate(root, update$34); break a; } } @@ -7875,7 +7898,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.flags = 0), (workInProgress.subtreeFlags = 0), (workInProgress.deletions = null)); - workInProgress.flags = current.flags & 7340032; + workInProgress.flags = current.flags & 14680064; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -8008,7 +8031,7 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate) { +function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -8021,6 +8044,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.expirationTimes = createLaneMap(-1); this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); + this.identifierPrefix = identifierPrefix; } function createPortal(children, containerInfo, implementation) { var key = @@ -8231,10 +8255,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_976 = { + devToolsConfig$jscomp$inline_967 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.0.0-afcb9cdc9-20211008", + version: "18.0.0-rc.0-51947a14b-20220113", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8249,11 +8273,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1240 = { - bundleType: devToolsConfig$jscomp$inline_976.bundleType, - version: devToolsConfig$jscomp$inline_976.version, - rendererPackageName: devToolsConfig$jscomp$inline_976.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_976.rendererConfig, +var internals$jscomp$inline_1230 = { + bundleType: devToolsConfig$jscomp$inline_967.bundleType, + version: devToolsConfig$jscomp$inline_967.version, + rendererPackageName: devToolsConfig$jscomp$inline_967.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_967.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8269,26 +8293,29 @@ var internals$jscomp$inline_1240 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_976.findFiberByHostInstance || + devToolsConfig$jscomp$inline_967.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-afcb9cdc9-20211008" + reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1241 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1231 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1241.isDisabled && - hook$jscomp$inline_1241.supportsFiber + !hook$jscomp$inline_1231.isDisabled && + hook$jscomp$inline_1231.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1241.inject( - internals$jscomp$inline_1240 + (rendererID = hook$jscomp$inline_1231.inject( + Object.assign({}, internals$jscomp$inline_1230, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }) )), - (injectedHook = hook$jscomp$inline_1241); + (injectedHook = hook$jscomp$inline_1231); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { @@ -8334,7 +8361,7 @@ exports.findNodeHandle = findNodeHandle; exports.render = function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, 0, !1); + root = new FiberRootNode(containerTag, 0, !1, ""); var JSCompiler_inline_result = createFiber(3, null, null, 0); root.current = JSCompiler_inline_result; JSCompiler_inline_result.stateNode = root; diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js index 1d79146054d3..3fb794d73a78 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js index 8916f57175fe..f9734c0a9508 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.fb.js @@ -7,10 +7,21 @@ * @noflow * @nolint * @preventMunge - * @generated SignedSource<> + * @generated SignedSource<> */ -"use strict"; + + 'use strict'; + +/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); +} + "use strict"; require("react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore"); var ReactNativePrivateInterface = require("react-native/Libraries/ReactPrivate/ReactNativePrivateInterface"), React = require("react"); @@ -926,7 +937,7 @@ eventPluginOrder = Array.prototype.slice.call([ "ReactNativeBridgeEventPlugin" ]); recomputePluginOrdering(); -var injectedNamesToPlugins$jscomp$inline_230 = { +var injectedNamesToPlugins$jscomp$inline_231 = { ResponderEventPlugin: ResponderEventPlugin, ReactNativeBridgeEventPlugin: { eventTypes: {}, @@ -961,33 +972,33 @@ var injectedNamesToPlugins$jscomp$inline_230 = { } } }, - isOrderingDirty$jscomp$inline_231 = !1, - pluginName$jscomp$inline_232; -for (pluginName$jscomp$inline_232 in injectedNamesToPlugins$jscomp$inline_230) + isOrderingDirty$jscomp$inline_232 = !1, + pluginName$jscomp$inline_233; +for (pluginName$jscomp$inline_233 in injectedNamesToPlugins$jscomp$inline_231) if ( - injectedNamesToPlugins$jscomp$inline_230.hasOwnProperty( - pluginName$jscomp$inline_232 + injectedNamesToPlugins$jscomp$inline_231.hasOwnProperty( + pluginName$jscomp$inline_233 ) ) { - var pluginModule$jscomp$inline_233 = - injectedNamesToPlugins$jscomp$inline_230[pluginName$jscomp$inline_232]; + var pluginModule$jscomp$inline_234 = + injectedNamesToPlugins$jscomp$inline_231[pluginName$jscomp$inline_233]; if ( - !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_232) || - namesToPlugins[pluginName$jscomp$inline_232] !== - pluginModule$jscomp$inline_233 + !namesToPlugins.hasOwnProperty(pluginName$jscomp$inline_233) || + namesToPlugins[pluginName$jscomp$inline_233] !== + pluginModule$jscomp$inline_234 ) { - if (namesToPlugins[pluginName$jscomp$inline_232]) + if (namesToPlugins[pluginName$jscomp$inline_233]) throw Error( "EventPluginRegistry: Cannot inject two different event plugins using the same name, `" + - (pluginName$jscomp$inline_232 + "`.") + (pluginName$jscomp$inline_233 + "`.") ); namesToPlugins[ - pluginName$jscomp$inline_232 - ] = pluginModule$jscomp$inline_233; - isOrderingDirty$jscomp$inline_231 = !0; + pluginName$jscomp$inline_233 + ] = pluginModule$jscomp$inline_234; + isOrderingDirty$jscomp$inline_232 = !0; } } -isOrderingDirty$jscomp$inline_231 && recomputePluginOrdering(); +isOrderingDirty$jscomp$inline_232 && recomputePluginOrdering(); var instanceCache = new Map(), instanceProps = new Map(); function getInstanceFromTag(tag) { @@ -1686,6 +1697,7 @@ var ReactNativeFiberHostComponent = (function() { IdlePriority = Scheduler.unstable_IdlePriority, rendererID = null, injectedHook = null, + injectedProfilingHooks = null, isDevToolsPresent = "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__; function onCommitRoot(root, eventPriority) { if (injectedHook && "function" === typeof injectedHook.onCommitFiberRoot) @@ -1715,6 +1727,80 @@ function onCommitRoot(root, eventPriority) { ); } catch (err) {} } +function injectProfilingHooks(profilingHooks) { + injectedProfilingHooks = profilingHooks; +} +function getLaneLabelMap() { + for (var map = new Map(), lane = 1, index$4 = 0; 31 > index$4; index$4++) { + var label = getLabelForLane(lane); + map.set(lane, label); + lane *= 2; + } + return map; +} +function markCommitStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStopped && + injectedProfilingHooks.markCommitStopped(); +} +function markComponentRenderStarted(fiber) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentRenderStarted && + injectedProfilingHooks.markComponentRenderStarted(fiber); +} +function markComponentRenderStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentRenderStopped && + injectedProfilingHooks.markComponentRenderStopped(); +} +function markComponentLayoutEffectUnmountStarted(fiber) { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted && + injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); +} +function markComponentLayoutEffectUnmountStopped() { + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped && + injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); +} +function markRenderStarted(lanes) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStarted && + injectedProfilingHooks.markRenderStarted(lanes); +} +function markRenderStopped() { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderStopped && + injectedProfilingHooks.markRenderStopped(); +} +function markStateUpdateScheduled(fiber, lane) { + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markStateUpdateScheduled && + injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); +} +var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, + log = Math.log, + LN2 = Math.LN2; +function clz32Fallback(x) { + x >>>= 0; + return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0; +} +function getLabelForLane(lane) { + if (lane & 1) return "Sync"; + if (lane & 2) return "InputContinuousHydration"; + if (lane & 4) return "InputContinuous"; + if (lane & 8) return "DefaultHydration"; + if (lane & 16) return "Default"; + if (lane & 32) return "TransitionHydration"; + if (lane & 4194240) return "Transition"; + if (lane & 130023424) return "Retry"; + if (lane & 134217728) return "SelectiveHydration"; + if (lane & 268435456) return "IdleHydration"; + if (lane & 536870912) return "Idle"; + if (lane & 1073741824) return "Offscreen"; +} var nextTransitionLane = 64, nextRetryLane = 4194304; function getHighestPriorityLanes(lanes) { @@ -1880,30 +1966,30 @@ function markRootFinished(root, remainingLanes) { remainingLanes = root.entanglements; var eventTimes = root.eventTimes; for (root = root.expirationTimes; 0 < noLongerPendingLanes; ) { - var index$8 = 31 - clz32(noLongerPendingLanes), - lane = 1 << index$8; - remainingLanes[index$8] = 0; - eventTimes[index$8] = -1; - root[index$8] = -1; + var index$9 = 31 - clz32(noLongerPendingLanes), + lane = 1 << index$9; + remainingLanes[index$9] = 0; + eventTimes[index$9] = -1; + root[index$9] = -1; noLongerPendingLanes &= ~lane; } } function markRootEntangled(root, entangledLanes) { var rootEntangledLanes = (root.entangledLanes |= entangledLanes); for (root = root.entanglements; rootEntangledLanes; ) { - var index$9 = 31 - clz32(rootEntangledLanes), - lane = 1 << index$9; - (lane & entangledLanes) | (root[index$9] & entangledLanes) && - (root[index$9] |= entangledLanes); + var index$10 = 31 - clz32(rootEntangledLanes), + lane = 1 << index$10; + (lane & entangledLanes) | (root[index$10] & entangledLanes) && + (root[index$10] |= entangledLanes); rootEntangledLanes &= ~lane; } } function addFiberToLanesMap(root, fiber, lanes) { if (isDevToolsPresent) for (root = root.pendingUpdatersLaneMap; 0 < lanes; ) { - var index$10 = 31 - clz32(lanes), - lane = 1 << index$10; - root[index$10].add(fiber); + var index$11 = 31 - clz32(lanes), + lane = 1 << index$11; + root[index$11].add(fiber); lanes &= ~lane; } } @@ -1915,25 +2001,19 @@ function movePendingFibersToMemoized(root, lanes) { 0 < lanes; ) { - var index$11 = 31 - clz32(lanes); - root = 1 << index$11; - index$11 = pendingUpdatersLaneMap[index$11]; - 0 < index$11.size && - (index$11.forEach(function(fiber) { + var index$12 = 31 - clz32(lanes); + root = 1 << index$12; + index$12 = pendingUpdatersLaneMap[index$12]; + 0 < index$12.size && + (index$12.forEach(function(fiber) { var alternate = fiber.alternate; (null !== alternate && memoizedUpdaters.has(alternate)) || memoizedUpdaters.add(fiber); }), - index$11.clear()); + index$12.clear()); lanes &= ~root; } } -var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback, - log = Math.log, - LN2 = Math.LN2; -function clz32Fallback(lanes) { - return 0 === lanes ? 32 : (31 - ((log(lanes) / LN2) | 0)) | 0; -} var currentUpdatePriority = 0; function lanesToEventPriority(lanes) { lanes &= -lanes; @@ -2135,12 +2215,14 @@ function shallowEqual(objA, objB) { var keysA = Object.keys(objA), keysB = Object.keys(objB); if (keysA.length !== keysB.length) return !1; - for (keysB = 0; keysB < keysA.length; keysB++) + for (keysB = 0; keysB < keysA.length; keysB++) { + var currentKey = keysA[keysB]; if ( - !hasOwnProperty.call(objB, keysA[keysB]) || - !objectIs(objA[keysA[keysB]], objB[keysA[keysB]]) + !hasOwnProperty.call(objB, currentKey) || + !objectIs(objA[currentKey], objB[currentKey]) ) return !1; + } return !0; } function describeFiber(fiber) { @@ -2535,6 +2617,7 @@ var classComponentUpdater = { enqueueUpdate(inst, update); payload = scheduleUpdateOnFiber(inst, lane, eventTime); null !== payload && entangleTransitions(payload, inst, lane); + markStateUpdateScheduled(inst, lane); }, enqueueReplaceState: function(inst, payload, callback) { inst = inst._reactInternals; @@ -2547,6 +2630,7 @@ var classComponentUpdater = { enqueueUpdate(inst, update); payload = scheduleUpdateOnFiber(inst, lane, eventTime); null !== payload && entangleTransitions(payload, inst, lane); + markStateUpdateScheduled(inst, lane); }, enqueueForceUpdate: function(inst, callback) { inst = inst._reactInternals; @@ -2558,6 +2642,9 @@ var classComponentUpdater = { enqueueUpdate(inst, update); callback = scheduleUpdateOnFiber(inst, lane, eventTime); null !== callback && entangleTransitions(callback, inst, lane); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markForceUpdateScheduled && + injectedProfilingHooks.markForceUpdateScheduled(inst, lane); } }; function checkShouldComponentUpdate( @@ -2650,6 +2737,26 @@ function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { "function" === typeof instance.componentDidMount && (workInProgress.flags |= 4); } +var forkStack = [], + forkStackIndex = 0, + treeForkProvider = null, + idStack = [], + idStackIndex = 0, + treeContextProvider = null; +function popTreeContext(workInProgress) { + for (; workInProgress === treeForkProvider; ) + (treeForkProvider = forkStack[--forkStackIndex]), + (forkStack[forkStackIndex] = null), + --forkStackIndex, + (forkStack[forkStackIndex] = null); + for (; workInProgress === treeContextProvider; ) + (treeContextProvider = idStack[--idStackIndex]), + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null), + --idStackIndex, + (idStack[idStackIndex] = null); +} function coerceRef(returnFiber, current, element) { returnFiber = element.ref; if ( @@ -2744,7 +2851,8 @@ function ChildReconciler(shouldTrackSideEffects) { } function placeChild(newFiber, lastPlacedIndex, newIndex) { newFiber.index = newIndex; - if (!shouldTrackSideEffects) return lastPlacedIndex; + if (!shouldTrackSideEffects) + return (newFiber.flags |= 1048576), lastPlacedIndex; newIndex = newFiber.alternate; if (null !== newIndex) return ( @@ -2835,7 +2943,10 @@ function ChildReconciler(shouldTrackSideEffects) { return current; } function createChild(returnFiber, newChild, lanes) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (newChild = createFiberFromText( "" + newChild, @@ -2889,7 +3000,10 @@ function ChildReconciler(shouldTrackSideEffects) { } function updateSlot(returnFiber, oldFiber, newChild, lanes) { var key = null !== oldFiber ? oldFiber.key : null; - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return null !== key ? null : updateTextNode(returnFiber, oldFiber, "" + newChild, lanes); @@ -2919,7 +3033,10 @@ function ChildReconciler(shouldTrackSideEffects) { newChild, lanes ) { - if ("string" === typeof newChild || "number" === typeof newChild) + if ( + ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild + ) return ( (existingChildren = existingChildren.get(newIdx) || null), updateTextNode(returnFiber, existingChildren, "" + newChild, lanes) @@ -3245,7 +3362,8 @@ function ChildReconciler(shouldTrackSideEffects) { ); throwOnInvalidObjectType(returnFiber, newChild); } - return "string" === typeof newChild || "number" === typeof newChild + return ("string" === typeof newChild && "" !== newChild) || + "number" === typeof newChild ? ((newChild = "" + newChild), null !== currentFirstChild && 6 === currentFirstChild.tag ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling), @@ -3348,7 +3466,8 @@ var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, currentHook = null, workInProgressHook = null, didScheduleRenderPhaseUpdate = !1, - didScheduleRenderPhaseUpdateDuringThisPass = !1; + didScheduleRenderPhaseUpdateDuringThisPass = !1, + globalClientIdCounter = 0; function throwInvalidHookError() { throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." @@ -3771,7 +3890,7 @@ function updateEffectImpl(fiberFlags, hookFlags, create, deps) { hook.memoizedState = pushEffect(1 | hookFlags, create, destroy, deps); } function mountEffect(create, deps) { - return mountEffectImpl(4196352, 8, create, deps); + return mountEffectImpl(8390656, 8, create, deps); } function updateEffect(create, deps) { return updateEffectImpl(2048, 8, create, deps); @@ -3851,6 +3970,9 @@ function startTransition(setPending, callback) { (ReactCurrentBatchConfig$1.transition = prevTransition); } } +function updateId() { + return updateWorkInProgressHook().memoizedState; +} function dispatchReducerAction(fiber, queue, action) { var lane = requestUpdateLane(fiber); action = { @@ -3864,8 +3986,9 @@ function dispatchReducerAction(fiber, queue, action) { ? enqueueRenderPhaseUpdate(queue, action) : (enqueueUpdate$1(fiber, queue, action), (action = requestEventTime()), - (fiber = scheduleUpdateOnFiber(fiber, lane, action)), - null !== fiber && entangleTransitionUpdate(fiber, queue, lane)); + (action = scheduleUpdateOnFiber(fiber, lane, action)), + null !== action && entangleTransitionUpdate(action, queue, lane)); + markStateUpdateScheduled(fiber, lane); } function dispatchSetState(fiber, queue, action) { var lane = requestUpdateLane(fiber), @@ -3895,9 +4018,10 @@ function dispatchSetState(fiber, queue, action) { } finally { } action = requestEventTime(); - fiber = scheduleUpdateOnFiber(fiber, lane, action); - null !== fiber && entangleTransitionUpdate(fiber, queue, lane); + action = scheduleUpdateOnFiber(fiber, lane, action); + null !== action && entangleTransitionUpdate(action, queue, lane); } + markStateUpdateScheduled(fiber, lane); } function isRenderPhaseUpdate(fiber) { var alternate = fiber.alternate; @@ -3958,7 +4082,7 @@ var ContextOnlyDispatcher = { useTransition: throwInvalidHookError, useMutableSource: throwInvalidHookError, useSyncExternalStore: throwInvalidHookError, - useOpaqueIdentifier: throwInvalidHookError, + useId: throwInvalidHookError, unstable_isNewReconciler: !1 }, HooksDispatcherOnMount = { @@ -4056,8 +4180,12 @@ var ContextOnlyDispatcher = { return useMutableSource(hook, source, getSnapshot, subscribe); }, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - throw Error("Not yet implemented"); + useId: function() { + var hook = mountWorkInProgressHook(), + identifierPrefix = workInProgressRoot.identifierPrefix, + globalClientId = globalClientIdCounter++; + identifierPrefix = identifierPrefix + "r:" + globalClientId.toString(32); + return (hook.memoizedState = identifierPrefix); }, unstable_isNewReconciler: !1 }, @@ -4140,9 +4268,7 @@ var ContextOnlyDispatcher = { } return nextSnapshot; }, - useOpaqueIdentifier: function() { - return updateReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }, HooksDispatcherOnRerender = { @@ -4185,9 +4311,7 @@ var ContextOnlyDispatcher = { }, useMutableSource: updateMutableSource, useSyncExternalStore: mountSyncExternalStore, - useOpaqueIdentifier: function() { - return rerenderReducer(basicStateReducer)[0]; - }, + useId: updateId, unstable_isNewReconciler: !1 }, now$1 = Scheduler.unstable_now, @@ -4360,14 +4484,14 @@ function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { break; case "collapsed": lastTailNode = renderState.tail; - for (var lastTailNode$37 = null; null !== lastTailNode; ) - null !== lastTailNode.alternate && (lastTailNode$37 = lastTailNode), + for (var lastTailNode$38 = null; null !== lastTailNode; ) + null !== lastTailNode.alternate && (lastTailNode$38 = lastTailNode), (lastTailNode = lastTailNode.sibling); - null === lastTailNode$37 + null === lastTailNode$38 ? hasRenderedATailFallback || null === renderState.tail ? (renderState.tail = null) : (renderState.tail.sibling = null) - : (lastTailNode$37.sibling = null); + : (lastTailNode$38.sibling = null); } } function bubbleProperties(completedWork) { @@ -4379,59 +4503,60 @@ function bubbleProperties(completedWork) { if (didBailout) if (0 !== (completedWork.mode & 2)) { for ( - var treeBaseDuration$39 = completedWork.selfBaseDuration, - child$40 = completedWork.child; - null !== child$40; + var treeBaseDuration$40 = completedWork.selfBaseDuration, + child$41 = completedWork.child; + null !== child$41; ) - (newChildLanes |= child$40.lanes | child$40.childLanes), - (subtreeFlags |= child$40.subtreeFlags & 7340032), - (subtreeFlags |= child$40.flags & 7340032), - (treeBaseDuration$39 += child$40.treeBaseDuration), - (child$40 = child$40.sibling); - completedWork.treeBaseDuration = treeBaseDuration$39; + (newChildLanes |= child$41.lanes | child$41.childLanes), + (subtreeFlags |= child$41.subtreeFlags & 14680064), + (subtreeFlags |= child$41.flags & 14680064), + (treeBaseDuration$40 += child$41.treeBaseDuration), + (child$41 = child$41.sibling); + completedWork.treeBaseDuration = treeBaseDuration$40; } else for ( - treeBaseDuration$39 = completedWork.child; - null !== treeBaseDuration$39; + treeBaseDuration$40 = completedWork.child; + null !== treeBaseDuration$40; ) (newChildLanes |= - treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), - (subtreeFlags |= treeBaseDuration$39.subtreeFlags & 7340032), - (subtreeFlags |= treeBaseDuration$39.flags & 7340032), - (treeBaseDuration$39.return = completedWork), - (treeBaseDuration$39 = treeBaseDuration$39.sibling); + treeBaseDuration$40.lanes | treeBaseDuration$40.childLanes), + (subtreeFlags |= treeBaseDuration$40.subtreeFlags & 14680064), + (subtreeFlags |= treeBaseDuration$40.flags & 14680064), + (treeBaseDuration$40.return = completedWork), + (treeBaseDuration$40 = treeBaseDuration$40.sibling); else if (0 !== (completedWork.mode & 2)) { - treeBaseDuration$39 = completedWork.actualDuration; - child$40 = completedWork.selfBaseDuration; + treeBaseDuration$40 = completedWork.actualDuration; + child$41 = completedWork.selfBaseDuration; for (var child = completedWork.child; null !== child; ) (newChildLanes |= child.lanes | child.childLanes), (subtreeFlags |= child.subtreeFlags), (subtreeFlags |= child.flags), - (treeBaseDuration$39 += child.actualDuration), - (child$40 += child.treeBaseDuration), + (treeBaseDuration$40 += child.actualDuration), + (child$41 += child.treeBaseDuration), (child = child.sibling); - completedWork.actualDuration = treeBaseDuration$39; - completedWork.treeBaseDuration = child$40; + completedWork.actualDuration = treeBaseDuration$40; + completedWork.treeBaseDuration = child$41; } else for ( - treeBaseDuration$39 = completedWork.child; - null !== treeBaseDuration$39; + treeBaseDuration$40 = completedWork.child; + null !== treeBaseDuration$40; ) (newChildLanes |= - treeBaseDuration$39.lanes | treeBaseDuration$39.childLanes), - (subtreeFlags |= treeBaseDuration$39.subtreeFlags), - (subtreeFlags |= treeBaseDuration$39.flags), - (treeBaseDuration$39.return = completedWork), - (treeBaseDuration$39 = treeBaseDuration$39.sibling); + treeBaseDuration$40.lanes | treeBaseDuration$40.childLanes), + (subtreeFlags |= treeBaseDuration$40.subtreeFlags), + (subtreeFlags |= treeBaseDuration$40.flags), + (treeBaseDuration$40.return = completedWork), + (treeBaseDuration$40 = treeBaseDuration$40.sibling); completedWork.subtreeFlags |= subtreeFlags; completedWork.childLanes = newChildLanes; return didBailout; } function completeWork(current, workInProgress, renderLanes) { var newProps = workInProgress.pendingProps; + popTreeContext(workInProgress); switch (workInProgress.tag) { case 2: case 16: @@ -4566,11 +4691,7 @@ function completeWork(current, workInProgress, renderLanes) { !renderLanes && ((workInProgress.child.flags |= 8192), 0 !== (workInProgress.mode & 1)) ) - if ( - (null === current && - !0 !== workInProgress.memoizedProps.unstable_avoidThisFallback) || - 0 !== (suspenseStackCursor.current & 1) - ) + if (null === current || 0 !== (suspenseStackCursor.current & 1)) 0 === workInProgressRootExitStatus && (workInProgressRootExitStatus = 3); else { @@ -4582,7 +4703,7 @@ function completeWork(current, workInProgress, renderLanes) { workInProgressRootExitStatus = 4; null === workInProgressRoot || (0 === (workInProgressRootSkippedLanes & 268435455) && - 0 === (workInProgressRootUpdatedLanes & 268435455)) || + 0 === (workInProgressRootInterleavedUpdatedLanes & 268435455)) || markRootSuspended$1( workInProgressRoot, workInProgressRootRenderLanes @@ -4642,7 +4763,7 @@ function completeWork(current, workInProgress, renderLanes) { for (newProps = workInProgress.child; null !== newProps; ) (renderLanes = newProps), (updatePayload = current), - (renderLanes.flags &= 7340034), + (renderLanes.flags &= 14680066), (type = renderLanes.alternate), null === type ? ((renderLanes.childLanes = 0), @@ -4789,6 +4910,7 @@ function updateForwardRef( Component = Component.render; var ref = workInProgress.ref; prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); nextProps = renderWithHooks( current, workInProgress, @@ -4797,6 +4919,7 @@ function updateForwardRef( ref, renderLanes ); + markComponentRenderStopped(); if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), @@ -4952,6 +5075,7 @@ function updateFunctionComponent( : contextStackCursor.current; context = getMaskedContext(workInProgress, context); prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); Component = renderWithHooks( current, workInProgress, @@ -4960,6 +5084,7 @@ function updateFunctionComponent( context, renderLanes ); + markComponentRenderStopped(); if (null !== current && !didReceiveUpdate) return ( (workInProgress.updateQueue = current.updateQueue), @@ -5196,7 +5321,10 @@ function finishClassComponent( ) { var nextChildren = null; profilerStartTime = -1; - } else nextChildren = shouldUpdate.render(); + } else + markComponentRenderStarted(workInProgress), + (nextChildren = shouldUpdate.render()), + markComponentRenderStopped(); workInProgress.flags |= 1; null !== current && didCaptureError ? ((didCaptureError = nextChildren), @@ -5229,7 +5357,7 @@ function pushHostRootContext(workInProgress) { pushTopLevelContextObject(workInProgress, root.context, !1); pushHostContainer(workInProgress, root.containerInfo); } -var SUSPENDED_MARKER = { dehydrated: null, retryLane: 0 }; +var SUSPENDED_MARKER = { dehydrated: null, treeContext: null, retryLane: 0 }; function mountSuspenseOffscreenState(renderLanes) { return { baseLanes: renderLanes, cachePool: null }; } @@ -5243,11 +5371,9 @@ function updateSuspenseComponent(current, workInProgress, renderLanes) { null !== current && null === current.memoizedState ? !1 : 0 !== (suspenseContext & 2)); - JSCompiler_temp - ? ((showFallback = !0), (workInProgress.flags &= -129)) - : (null !== current && null === current.memoizedState) || - !0 === nextProps.unstable_avoidThisFallback || - (suspenseContext |= 1); + if (JSCompiler_temp) (showFallback = !0), (workInProgress.flags &= -129); + else if (null === current || null !== current.memoizedState) + suspenseContext |= 1; push(suspenseStackCursor, suspenseContext & 1); if (null === current) { current = nextProps.children; @@ -5432,7 +5558,7 @@ function updateSuspenseFallbackChildren( (primaryChildren.treeBaseDuration = current.treeBaseDuration)), (workInProgress.deletions = null)) : ((primaryChildren = createWorkInProgress(current, primaryChildProps)), - (primaryChildren.subtreeFlags = current.subtreeFlags & 7340032)); + (primaryChildren.subtreeFlags = current.subtreeFlags & 14680064)); null !== currentFallbackChildFragment ? (fallbackChildren = createWorkInProgress( currentFallbackChildFragment, @@ -5664,6 +5790,7 @@ function attemptEarlyBailoutIfNoScheduledUpdate( return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); } function unwindWork(workInProgress) { + popTreeContext(workInProgress); switch (workInProgress.tag) { case 1: isContextProvider(workInProgress.type) && popContext(); @@ -5817,24 +5944,63 @@ function commitHookEffectListUnmount( var destroy = effect.destroy; effect.destroy = void 0; void 0 !== destroy && - safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); + (0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted && + injectedProfilingHooks.markComponentPassiveEffectUnmountStarted( + finishedWork + ) + : 0 !== (flags & 4) && + markComponentLayoutEffectUnmountStarted(finishedWork), + safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy), + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped && + injectedProfilingHooks.markComponentPassiveEffectUnmountStopped() + : 0 !== (flags & 4) && markComponentLayoutEffectUnmountStopped()); } effect = effect.next; } while (effect !== updateQueue); } } -function commitHookEffectListMount(tag, finishedWork) { - finishedWork = finishedWork.updateQueue; - finishedWork = null !== finishedWork ? finishedWork.lastEffect : null; - if (null !== finishedWork) { - var effect = (finishedWork = finishedWork.next); +function commitHookEffectListMount(flags, finishedWork) { + var updateQueue = finishedWork.updateQueue; + updateQueue = null !== updateQueue ? updateQueue.lastEffect : null; + if (null !== updateQueue) { + var effect = (updateQueue = updateQueue.next); do { - if ((effect.tag & tag) === tag) { - var create$86 = effect.create; - effect.destroy = create$86(); + if ((effect.tag & flags) === flags) { + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted && + injectedProfilingHooks.markComponentPassiveEffectMountStarted( + finishedWork + ) + : 0 !== (flags & 4) && + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted && + injectedProfilingHooks.markComponentLayoutEffectMountStarted( + finishedWork + ); + var create$87 = effect.create; + effect.destroy = create$87(); + 0 !== (flags & 8) + ? null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped && + injectedProfilingHooks.markComponentPassiveEffectMountStopped() + : 0 !== (flags & 4) && + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped && + injectedProfilingHooks.markComponentLayoutEffectMountStopped(); } effect = effect.next; - } while (effect !== finishedWork); + } while (effect !== updateQueue); } } function commitUnmount(finishedRoot, current, nearestMountedAncestor) { @@ -5857,13 +6023,17 @@ function commitUnmount(finishedRoot, current, nearestMountedAncestor) { var _effect = effect, destroy = _effect.destroy; _effect = _effect.tag; - void 0 === destroy || - (0 === (_effect & 2) && 0 === (_effect & 4)) || - (current.mode & 2 - ? (startLayoutEffectTimer(), - safelyCallDestroy(current, nearestMountedAncestor, destroy), - recordLayoutEffectDuration(current)) - : safelyCallDestroy(current, nearestMountedAncestor, destroy)); + void 0 !== destroy && + (0 !== (_effect & 2) + ? safelyCallDestroy(current, nearestMountedAncestor, destroy) + : 0 !== (_effect & 4) && + (markComponentLayoutEffectUnmountStarted(current), + current.mode & 2 + ? (startLayoutEffectTimer(), + safelyCallDestroy(current, nearestMountedAncestor, destroy), + recordLayoutEffectDuration(current)) + : safelyCallDestroy(current, nearestMountedAncestor, destroy), + markComponentLayoutEffectUnmountStopped())); effect = effect.next; } while (effect !== finishedRoot); } @@ -6316,8 +6486,8 @@ function commitMutationEffects(root, firstChild, committedLanes) { switch (firstChild.tag) { case 13: if (null !== firstChild.memoizedState) { - var current$93 = firstChild.alternate; - if (null === current$93 || null === current$93.memoizedState) + var current$94 = firstChild.alternate; + if (null === current$94 || null === current$94.memoizedState) globalMostRecentFallbackTime = now(); } break; @@ -6501,21 +6671,21 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { commitUpdateQueue(committedLanes, updateQueue, instance); break; case 3: - var updateQueue$88 = committedLanes.updateQueue; - if (null !== updateQueue$88) { - var instance$89 = null; + var updateQueue$89 = committedLanes.updateQueue; + if (null !== updateQueue$89) { + var instance$90 = null; if (null !== committedLanes.child) switch (committedLanes.child.tag) { case 5: - instance$89 = committedLanes.child.stateNode; + instance$90 = committedLanes.child.stateNode; break; case 1: - instance$89 = committedLanes.child.stateNode; + instance$90 = committedLanes.child.stateNode; } commitUpdateQueue( committedLanes, - updateQueue$88, - instance$89 + updateQueue$89, + instance$90 ); } break; @@ -6530,7 +6700,7 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { onCommit = _finishedWork$memoize2.onCommit, onRender = _finishedWork$memoize2.onRender, effectDuration = committedLanes.stateNode.effectDuration; - instance$89 = commitTime; + instance$90 = commitTime; current = null === current ? "mount" : "update"; currentUpdateIsNested && (current = "nested-update"); "function" === typeof onRender && @@ -6540,14 +6710,14 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { committedLanes.actualDuration, committedLanes.treeBaseDuration, committedLanes.actualStartTime, - instance$89 + instance$90 ); "function" === typeof onCommit && onCommit( committedLanes.memoizedProps.id, current, effectDuration, - instance$89 + instance$90 ); enqueuePendingPassiveProfilerEffect(committedLanes); var parentFiber = committedLanes.return; @@ -6577,27 +6747,27 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { ); } if (committedLanes.flags & 512) { - instance$89 = void 0; + instance$90 = void 0; current = committedLanes; var ref = current.ref; if (null !== ref) { var instance$jscomp$0 = current.stateNode; switch (current.tag) { case 5: - instance$89 = instance$jscomp$0; + instance$90 = instance$jscomp$0; break; default: - instance$89 = instance$jscomp$0; + instance$90 = instance$jscomp$0; } if ("function" === typeof ref) if (current.mode & 2) try { - startLayoutEffectTimer(), ref(instance$89); + startLayoutEffectTimer(), ref(instance$90); } finally { recordLayoutEffectDuration(current); } - else ref(instance$89); - else ref.current = instance$89; + else ref(instance$90); + else ref.current = instance$90; } } } catch (error) { @@ -6612,10 +6782,10 @@ function commitLayoutEffects(finishedWork, root, committedLanes) { nextEffect = null; break; } - instance$89 = committedLanes.sibling; - if (null !== instance$89) { - instance$89.return = committedLanes.return; - nextEffect = instance$89; + instance$90 = committedLanes.sibling; + if (null !== instance$90) { + instance$90.return = committedLanes.return; + nextEffect = instance$90; break; } nextEffect = committedLanes.return; @@ -6635,7 +6805,8 @@ var ceil = Math.ceil, workInProgressRootExitStatus = 0, workInProgressRootFatalError = null, workInProgressRootSkippedLanes = 0, - workInProgressRootUpdatedLanes = 0, + workInProgressRootInterleavedUpdatedLanes = 0, + workInProgressRootRenderPhaseUpdatedLanes = 0, workInProgressRootPingedLanes = 0, globalMostRecentFallbackTime = 0, workInProgressRootRenderTargetTime = Infinity, @@ -6682,18 +6853,21 @@ function scheduleUpdateOnFiber(fiber, lane, eventTime) { )); var root = markUpdateLaneFromFiberToRoot(fiber, lane); if (null === root) return null; - isDevToolsPresent && addFiberToLanesMap(root, fiber, lane); markRootUpdated(root, lane, eventTime); - root === workInProgressRoot && - (0 === (executionContext & 2) && (workInProgressRootUpdatedLanes |= lane), - 4 === workInProgressRootExitStatus && - markRootSuspended$1(root, workInProgressRootRenderLanes)); - ensureRootIsScheduled(root, eventTime); - 1 === lane && - 0 === executionContext && - 0 === (fiber.mode & 1) && - ((workInProgressRootRenderTargetTime = now() + 500), - includesLegacySyncCallbacks && flushSyncCallbacks()); + 0 !== (executionContext & 2) && root === workInProgressRoot + ? (workInProgressRootRenderPhaseUpdatedLanes |= lane) + : (isDevToolsPresent && addFiberToLanesMap(root, fiber, lane), + root === workInProgressRoot && + (0 === (executionContext & 2) && + (workInProgressRootInterleavedUpdatedLanes |= lane), + 4 === workInProgressRootExitStatus && + markRootSuspended$1(root, workInProgressRootRenderLanes)), + ensureRootIsScheduled(root, eventTime), + 1 === lane && + 0 === executionContext && + 0 === (fiber.mode & 1) && + ((workInProgressRootRenderTargetTime = now() + 500), + includesLegacySyncCallbacks && flushSyncCallbacks())); return root; } function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { @@ -6719,12 +6893,12 @@ function ensureRootIsScheduled(root, currentTime) { 0 < lanes; ) { - var index$6 = 31 - clz32(lanes), - lane = 1 << index$6, - expirationTime = expirationTimes[index$6]; + var index$7 = 31 - clz32(lanes), + lane = 1 << index$7, + expirationTime = expirationTimes[index$7]; if (-1 === expirationTime) { if (0 === (lane & suspendedLanes) || 0 !== (lane & pingedLanes)) - expirationTimes[index$6] = computeExpirationTime(lane, currentTime); + expirationTimes[index$7] = computeExpirationTime(lane, currentTime); } else expirationTime <= currentTime && (root.expiredLanes |= lane); lanes &= ~lane; } @@ -6819,6 +6993,7 @@ function performConcurrentWorkOnRoot(root, didTimeout) { workInProgressRootRenderTargetTime = now() + 500; prepareFreshStack(root, didTimeout); } + markRenderStarted(didTimeout); do try { workLoopConcurrent(); @@ -6831,8 +7006,12 @@ function performConcurrentWorkOnRoot(root, didTimeout) { ReactCurrentDispatcher$2.current = prevDispatcher; executionContext = prevExecutionContext; null !== workInProgress - ? (didTimeout = 0) - : ((workInProgressRoot = null), + ? (null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderYielded && + injectedProfilingHooks.markRenderYielded(), + (didTimeout = 0)) + : (markRenderStopped(), + (workInProgressRoot = null), (workInProgressRootRenderLanes = 0), (didTimeout = workInProgressRootExitStatus)); } @@ -6949,9 +7128,15 @@ function recoverFromConcurrentError(root, errorRetryLanes) { var prevExecutionContext = executionContext; executionContext |= 8; root.isDehydrated && (root.isDehydrated = !1); - root = renderRootSync(root, errorRetryLanes); + for ( + var exitStatus, i = 0; + 50 > i && + ((exitStatus = renderRootSync(root, errorRetryLanes)), + 2 === exitStatus && 0 !== workInProgressRootRenderPhaseUpdatedLanes); + i++ + ); executionContext = prevExecutionContext; - return root; + return exitStatus; } function isRenderConsistentWithExternalStores(finishedWork) { for (var node = finishedWork; ; ) { @@ -6989,13 +7174,13 @@ function isRenderConsistentWithExternalStores(finishedWork) { } function markRootSuspended$1(root, suspendedLanes) { suspendedLanes &= ~workInProgressRootPingedLanes; - suspendedLanes &= ~workInProgressRootUpdatedLanes; + suspendedLanes &= ~workInProgressRootInterleavedUpdatedLanes; root.suspendedLanes |= suspendedLanes; root.pingedLanes &= ~suspendedLanes; for (root = root.expirationTimes; 0 < suspendedLanes; ) { - var index$7 = 31 - clz32(suspendedLanes), - lane = 1 << index$7; - root[index$7] = -1; + var index$8 = 31 - clz32(suspendedLanes), + lane = 1 << index$8; + root[index$8] = -1; suspendedLanes &= ~lane; } } @@ -7009,13 +7194,10 @@ function performSyncWorkOnRoot(root) { if (0 === (lanes & 1)) return ensureRootIsScheduled(root, now()), null; var exitStatus = renderRootSync(root, lanes); if (0 !== root.tag && 2 === exitStatus) { - var prevExecutionContext = executionContext; - executionContext |= 8; - root.isDehydrated && (root.isDehydrated = !1); var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 0 !== errorRetryLanes && - ((lanes = errorRetryLanes), (exitStatus = renderRootSync(root, lanes))); - executionContext = prevExecutionContext; + ((lanes = errorRetryLanes), + (exitStatus = recoverFromConcurrentError(root, errorRetryLanes))); } if (1 === exitStatus) throw ((exitStatus = workInProgressRootFatalError), @@ -7042,6 +7224,7 @@ function prepareFreshStack(root, lanes) { if (null !== workInProgress) for (timeoutHandle = workInProgress.return; null !== timeoutHandle; ) { var interruptedWork = timeoutHandle; + popTreeContext(interruptedWork); switch (interruptedWork.tag) { case 1: interruptedWork = interruptedWork.type.childContextTypes; @@ -7081,7 +7264,7 @@ function prepareFreshStack(root, lanes) { workInProgressRootRenderLanes = subtreeRenderLanes = lanes; workInProgressRootExitStatus = 0; workInProgressRootFatalError = null; - workInProgressRootPingedLanes = workInProgressRootUpdatedLanes = workInProgressRootSkippedLanes = 0; + workInProgressRootPingedLanes = workInProgressRootRenderPhaseUpdatedLanes = workInProgressRootInterleavedUpdatedLanes = workInProgressRootSkippedLanes = 0; if (null !== interleavedQueues) { for (root = 0; root < interleavedQueues.length; root++) if ( @@ -7102,7 +7285,7 @@ function prepareFreshStack(root, lanes) { interleavedQueues = null; } } -function handleError(root$jscomp$0, thrownValue) { +function handleError(root, thrownValue) { do { var erroredWork = workInProgress; try { @@ -7132,20 +7315,42 @@ function handleError(root$jscomp$0, thrownValue) { } erroredWork.mode & 2 && stopProfilerTimerIfRunningAndRecordDelta(erroredWork, !0); + markComponentRenderStopped(); + if ( + null !== thrownValue && + "object" === typeof thrownValue && + "function" === typeof thrownValue.then + ) { + var wakeable = thrownValue; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentSuspended && + injectedProfilingHooks.markComponentSuspended( + erroredWork, + wakeable, + workInProgressRootRenderLanes + ); + } else + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markComponentErrored && + injectedProfilingHooks.markComponentErrored( + erroredWork, + thrownValue, + workInProgressRootRenderLanes + ); a: { - var root = root$jscomp$0, - returnFiber = erroredWork.return, + wakeable = root; + var returnFiber = erroredWork.return, sourceFiber = erroredWork, value = thrownValue; thrownValue = workInProgressRootRenderLanes; sourceFiber.flags |= 32768; - isDevToolsPresent && restorePendingUpdaters(root, thrownValue); + isDevToolsPresent && restorePendingUpdaters(wakeable, thrownValue); if ( null !== value && "object" === typeof value && "function" === typeof value.then ) { - var wakeable = value, + var wakeable$jscomp$0 = value, sourceFiber$jscomp$0 = sourceFiber, tag = sourceFiber$jscomp$0.tag; if ( @@ -7163,85 +7368,76 @@ function handleError(root$jscomp$0, thrownValue) { } b: { sourceFiber$jscomp$0 = returnFiber; - var sourceFiber$jscomp$1 = sourceFiber, - rootRenderLanes = thrownValue, - hasInvisibleParentBoundary = - 0 !== (suspenseStackCursor.current & 1), - node = sourceFiber$jscomp$0; do { var JSCompiler_temp; - if ((JSCompiler_temp = 13 === node.tag)) { - var nextState = node.memoizedState; + if ((JSCompiler_temp = 13 === sourceFiber$jscomp$0.tag)) { + var nextState = sourceFiber$jscomp$0.memoizedState; JSCompiler_temp = null !== nextState ? null !== nextState.dehydrated ? !0 : !1 - : !0 !== node.memoizedProps.unstable_avoidThisFallback - ? !0 - : hasInvisibleParentBoundary - ? !1 : !0; } if (JSCompiler_temp) { - if (0 === (node.mode & 1)) { - if (node === sourceFiber$jscomp$0) node.flags |= 65536; - else { - node.flags |= 128; - sourceFiber$jscomp$1.flags |= 131072; - sourceFiber$jscomp$1.flags &= -52805; - if (1 === sourceFiber$jscomp$1.tag) - if (null === sourceFiber$jscomp$1.alternate) - sourceFiber$jscomp$1.tag = 17; - else { - var update = createUpdate(-1, 1); - update.tag = 2; - enqueueUpdate(sourceFiber$jscomp$1, update); - } - sourceFiber$jscomp$1.lanes |= 1; - } - var suspenseBoundary = node; - break b; - } - node.flags |= 65536; - node.lanes = rootRenderLanes; - suspenseBoundary = node; + var suspenseBoundary = sourceFiber$jscomp$0; break b; } - node = node.return; - } while (null !== node); + sourceFiber$jscomp$0 = sourceFiber$jscomp$0.return; + } while (null !== sourceFiber$jscomp$0); suspenseBoundary = null; } if (null !== suspenseBoundary) { - value = void 0; - sourceFiber = suspenseBoundary; - if (sourceFiber.mode & 1) { - var pingCache = root.pingCache; + suspenseBoundary.flags &= -257; + value = suspenseBoundary; + sourceFiber$jscomp$0 = thrownValue; + if (0 === (value.mode & 1)) + if (value === returnFiber) value.flags |= 65536; + else { + value.flags |= 128; + sourceFiber.flags |= 131072; + sourceFiber.flags &= -52805; + if (1 === sourceFiber.tag) + if (null === sourceFiber.alternate) sourceFiber.tag = 17; + else { + var update = createUpdate(-1, 1); + update.tag = 2; + enqueueUpdate(sourceFiber, update); + } + sourceFiber.lanes |= 1; + } + else (value.flags |= 65536), (value.lanes = sourceFiber$jscomp$0); + sourceFiber = void 0; + value = suspenseBoundary; + if (value.mode & 1) { + var pingCache = wakeable.pingCache; null === pingCache - ? ((pingCache = root.pingCache = new PossiblyWeakMap()), - (value = new Set()), - pingCache.set(wakeable, value)) - : ((value = pingCache.get(wakeable)), - void 0 === value && - ((value = new Set()), pingCache.set(wakeable, value))); - if (!value.has(thrownValue)) { - value.add(thrownValue); + ? ((pingCache = wakeable.pingCache = new PossiblyWeakMap()), + (sourceFiber = new Set()), + pingCache.set(wakeable$jscomp$0, sourceFiber)) + : ((sourceFiber = pingCache.get(wakeable$jscomp$0)), + void 0 === sourceFiber && + ((sourceFiber = new Set()), + pingCache.set(wakeable$jscomp$0, sourceFiber))); + if (!sourceFiber.has(thrownValue)) { + sourceFiber.add(thrownValue); var ping = pingSuspendedRoot.bind( null, - root, wakeable, + wakeable$jscomp$0, thrownValue ); - isDevToolsPresent && restorePendingUpdaters(root, thrownValue); - wakeable.then(ping, ping); + isDevToolsPresent && + restorePendingUpdaters(wakeable, thrownValue); + wakeable$jscomp$0.then(ping, ping); } } - var wakeables = sourceFiber.updateQueue; + var wakeables = value.updateQueue; if (null === wakeables) { var updateQueue = new Set(); - updateQueue.add(wakeable); - sourceFiber.updateQueue = updateQueue; - } else wakeables.add(wakeable); + updateQueue.add(wakeable$jscomp$0); + value.updateQueue = updateQueue; + } else wakeables.add(wakeable$jscomp$0); break a; } else value = Error( @@ -7252,47 +7448,47 @@ function handleError(root$jscomp$0, thrownValue) { 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2); value = createCapturedValue(value, sourceFiber); - root = returnFiber; + wakeable = returnFiber; do { - switch (root.tag) { + switch (wakeable.tag) { case 3: - wakeable = value; - root.flags |= 65536; + wakeable$jscomp$0 = value; + wakeable.flags |= 65536; thrownValue &= -thrownValue; - root.lanes |= thrownValue; + wakeable.lanes |= thrownValue; var update$jscomp$0 = createRootErrorUpdate( - root, wakeable, + wakeable$jscomp$0, thrownValue ); - enqueueCapturedUpdate(root, update$jscomp$0); + enqueueCapturedUpdate(wakeable, update$jscomp$0); break a; case 1: - wakeable = value; - var ctor = root.type, - instance = root.stateNode; + wakeable$jscomp$0 = value; + var ctor = wakeable.type, + instance = wakeable.stateNode; if ( - 0 === (root.flags & 128) && + 0 === (wakeable.flags & 128) && ("function" === typeof ctor.getDerivedStateFromError || (null !== instance && "function" === typeof instance.componentDidCatch && (null === legacyErrorBoundariesThatAlreadyFailed || !legacyErrorBoundariesThatAlreadyFailed.has(instance)))) ) { - root.flags |= 65536; + wakeable.flags |= 65536; thrownValue &= -thrownValue; - root.lanes |= thrownValue; - var update$35 = createClassErrorUpdate( - root, + wakeable.lanes |= thrownValue; + var update$36 = createClassErrorUpdate( wakeable, + wakeable$jscomp$0, thrownValue ); - enqueueCapturedUpdate(root, update$35); + enqueueCapturedUpdate(wakeable, update$36); break a; } } - root = root.return; - } while (null !== root); + wakeable = wakeable.return; + } while (null !== wakeable); } completeUnitOfWork(erroredWork); } catch (yetAnotherThrownValue) { @@ -7324,6 +7520,7 @@ function renderRootSync(root, lanes) { } prepareFreshStack(root, lanes); } + markRenderStarted(lanes); do try { workLoopSync(); @@ -7339,6 +7536,7 @@ function renderRootSync(root, lanes) { throw Error( "Cannot commit an incomplete root. This error is likely caused by a bug in React. Please file an issue." ); + markRenderStopped(); workInProgressRoot = null; workInProgressRootRenderLanes = 0; return workInProgressRootExitStatus; @@ -7431,7 +7629,10 @@ function commitRootImpl(root, renderPriorityLevel) { throw Error("Should not already be working."); var finishedWork = root.finishedWork, lanes = root.finishedLanes; - if (null === finishedWork) return null; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markCommitStarted && + injectedProfilingHooks.markCommitStarted(lanes); + if (null === finishedWork) return markCommitStopped(), null; root.finishedWork = null; root.finishedLanes = 0; if (finishedWork === root.current) @@ -7466,7 +7667,13 @@ function commitRootImpl(root, renderPriorityLevel) { commitTime = now$1(); commitMutationEffects(root, finishedWork, lanes); root.current = finishedWork; + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStarted && + injectedProfilingHooks.markLayoutEffectsStarted(lanes); commitLayoutEffects(finishedWork, root, lanes); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markLayoutEffectsStopped && + injectedProfilingHooks.markLayoutEffectsStopped(); requestPaint(); executionContext = prevExecutionContext; currentUpdatePriority = previousPriority; @@ -7497,6 +7704,7 @@ function commitRootImpl(root, renderPriorityLevel) { : ((nestedUpdateCount = 0), (rootWithNestedUpdates = root))) : (nestedUpdateCount = 0); flushSyncCallbacks(); + markCommitStopped(); return null; } function flushPassiveEffects() { @@ -7511,11 +7719,16 @@ function flushPassiveEffects() { var JSCompiler_inline_result = !1; else { renderPriority = rootWithPendingPassiveEffects; + var lanes = pendingPassiveEffectsLanes; rootWithPendingPassiveEffects = null; pendingPassiveEffectsLanes = 0; if (0 !== (executionContext & 6)) throw Error("Cannot flush passive effects while already rendering."); - var prevExecutionContext = executionContext; + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStarted && + injectedProfilingHooks.markPassiveEffectsStarted(lanes); + lanes = executionContext; executionContext |= 4; for (nextEffect = renderPriority.current; null !== nextEffect; ) { var fiber = nextEffect, @@ -7678,7 +7891,11 @@ function flushPassiveEffects() { } } } - executionContext = prevExecutionContext; + null !== injectedProfilingHooks && + "function" === + typeof injectedProfilingHooks.markPassiveEffectsStopped && + injectedProfilingHooks.markPassiveEffectsStopped(); + executionContext = lanes; flushSyncCallbacks(); if ( injectedHook && @@ -7835,6 +8052,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { contextStackCursor.current ); prepareToReadContext(workInProgress, renderLanes); + markComponentRenderStarted(workInProgress); context = renderWithHooks( null, workInProgress, @@ -7843,6 +8061,7 @@ beginWork$1 = function(current, workInProgress, renderLanes) { context, renderLanes ); + markComponentRenderStopped(); workInProgress.flags |= 1; if ( "object" === typeof context && @@ -8168,7 +8387,9 @@ beginWork$1 = function(current, workInProgress, renderLanes) { (Component = workInProgress.pendingProps.children), prepareToReadContext(workInProgress, renderLanes), (context = readContext(context)), + markComponentRenderStarted(workInProgress), (Component = Component(context)), + markComponentRenderStopped(), (workInProgress.flags |= 1), reconcileChildren(current, workInProgress, Component, renderLanes), workInProgress.child @@ -8299,7 +8520,7 @@ function createWorkInProgress(current, pendingProps) { (workInProgress.deletions = null), (workInProgress.actualDuration = 0), (workInProgress.actualStartTime = -1)); - workInProgress.flags = current.flags & 7340032; + workInProgress.flags = current.flags & 14680064; workInProgress.childLanes = current.childLanes; workInProgress.lanes = current.lanes; workInProgress.child = current.child; @@ -8435,7 +8656,7 @@ function createFiberFromPortal(portal, mode, lanes) { }; return mode; } -function FiberRootNode(containerInfo, tag, hydrate) { +function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix) { this.tag = tag; this.containerInfo = containerInfo; this.finishedWork = this.pingCache = this.current = this.pendingChildren = null; @@ -8448,6 +8669,7 @@ function FiberRootNode(containerInfo, tag, hydrate) { this.expirationTimes = createLaneMap(-1); this.entangledLanes = this.finishedLanes = this.mutableReadLanes = this.expiredLanes = this.pingedLanes = this.suspendedLanes = this.pendingLanes = 0; this.entanglements = createLaneMap(0); + this.identifierPrefix = identifierPrefix; this.passiveEffectDuration = this.effectDuration = 0; this.memoizedUpdaters = new Set(); containerInfo = this.pendingUpdatersLaneMap = []; @@ -8481,6 +8703,9 @@ function updateContainer(element, container, parentComponent, callback) { var current = container.current, eventTime = requestEventTime(), lane = requestUpdateLane(current); + null !== injectedProfilingHooks && + "function" === typeof injectedProfilingHooks.markRenderScheduled && + injectedProfilingHooks.markRenderScheduled(lane); a: if (parentComponent) { parentComponent = parentComponent._reactInternals; b: { @@ -8662,10 +8887,10 @@ batchedUpdatesImpl = function(fn, a) { } }; var roots = new Map(), - devToolsConfig$jscomp$inline_1006 = { + devToolsConfig$jscomp$inline_1043 = { findFiberByHostInstance: getInstanceFromTag, bundleType: 0, - version: "18.0.0-afcb9cdc9-20211008", + version: "18.0.0-rc.0-51947a14b-20220113", rendererPackageName: "react-native-renderer", rendererConfig: { getInspectorDataForViewTag: function() { @@ -8680,11 +8905,11 @@ var roots = new Map(), }.bind(null, findNodeHandle) } }; -var internals$jscomp$inline_1290 = { - bundleType: devToolsConfig$jscomp$inline_1006.bundleType, - version: devToolsConfig$jscomp$inline_1006.version, - rendererPackageName: devToolsConfig$jscomp$inline_1006.rendererPackageName, - rendererConfig: devToolsConfig$jscomp$inline_1006.rendererConfig, +var internals$jscomp$inline_1330 = { + bundleType: devToolsConfig$jscomp$inline_1043.bundleType, + version: devToolsConfig$jscomp$inline_1043.version, + rendererPackageName: devToolsConfig$jscomp$inline_1043.rendererPackageName, + rendererConfig: devToolsConfig$jscomp$inline_1043.rendererConfig, overrideHookState: null, overrideHookStateDeletePath: null, overrideHookStateRenamePath: null, @@ -8700,26 +8925,29 @@ var internals$jscomp$inline_1290 = { return null === fiber ? null : fiber.stateNode; }, findFiberByHostInstance: - devToolsConfig$jscomp$inline_1006.findFiberByHostInstance || + devToolsConfig$jscomp$inline_1043.findFiberByHostInstance || emptyFindFiberByHostInstance, findHostInstancesForRefresh: null, scheduleRefresh: null, scheduleRoot: null, setRefreshHandler: null, getCurrentFiber: null, - reconcilerVersion: "18.0.0-afcb9cdc9-20211008" + reconcilerVersion: "18.0.0-rc.0-51947a14b-20220113" }; if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) { - var hook$jscomp$inline_1291 = __REACT_DEVTOOLS_GLOBAL_HOOK__; + var hook$jscomp$inline_1331 = __REACT_DEVTOOLS_GLOBAL_HOOK__; if ( - !hook$jscomp$inline_1291.isDisabled && - hook$jscomp$inline_1291.supportsFiber + !hook$jscomp$inline_1331.isDisabled && + hook$jscomp$inline_1331.supportsFiber ) try { - (rendererID = hook$jscomp$inline_1291.inject( - internals$jscomp$inline_1290 + (rendererID = hook$jscomp$inline_1331.inject( + Object.assign({}, internals$jscomp$inline_1330, { + getLaneLabelMap: getLaneLabelMap, + injectProfilingHooks: injectProfilingHooks + }) )), - (injectedHook = hook$jscomp$inline_1291); + (injectedHook = hook$jscomp$inline_1331); } catch (err) {} } exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { @@ -8765,7 +8993,7 @@ exports.findNodeHandle = findNodeHandle; exports.render = function(element, containerTag, callback) { var root = roots.get(containerTag); if (!root) { - root = new FiberRootNode(containerTag, 0, !1); + root = new FiberRootNode(containerTag, 0, !1, ""); var JSCompiler_inline_result = 0; isDevToolsPresent && (JSCompiler_inline_result |= 2); JSCompiler_inline_result = createFiber( @@ -8809,3 +9037,13 @@ exports.unmountComponentAtNodeAndRemoveContainer = function(containerTag) { ReactNativePrivateInterface.UIManager.removeRootView(containerTag); }; exports.unstable_batchedUpdates = batchedUpdates; + + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === + 'function' +) { + __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); +} + diff --git a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js index 1406e7227ad6..b875b0e80773 100644 --- a/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js +++ b/Libraries/Renderer/implementations/ReactNativeRenderer-profiling.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Renderer/shims/ReactFabric.js b/Libraries/Renderer/shims/ReactFabric.js index 3af155512454..e9897f032c32 100644 --- a/Libraries/Renderer/shims/ReactFabric.js +++ b/Libraries/Renderer/shims/ReactFabric.js @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat * @flow - * @generated SignedSource<<40f01afd3b6d95a617ac8e48748a2a76>> + * @generated SignedSource<> * * This file was sync'd from the facebook/react repository. */ diff --git a/Libraries/Renderer/shims/ReactFeatureFlags.js b/Libraries/Renderer/shims/ReactFeatureFlags.js index 45ce2c7a94df..d7101030a3e2 100644 --- a/Libraries/Renderer/shims/ReactFeatureFlags.js +++ b/Libraries/Renderer/shims/ReactFeatureFlags.js @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat * @flow strict-local - * @generated SignedSource<> + * @generated SignedSource<> * * This file was sync'd from the facebook/react repository. */ diff --git a/Libraries/Renderer/shims/ReactNative.js b/Libraries/Renderer/shims/ReactNative.js index f0c54b8d13b6..eb3322c0cff2 100644 --- a/Libraries/Renderer/shims/ReactNative.js +++ b/Libraries/Renderer/shims/ReactNative.js @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat * @flow - * @generated SignedSource<> + * @generated SignedSource<<45ec3626ad048b08dac9b031b02bc0a8>> * * This file was sync'd from the facebook/react repository. */ diff --git a/Libraries/Renderer/shims/ReactNativeTypes.js b/Libraries/Renderer/shims/ReactNativeTypes.js index d0dcd60815ff..9c089dcc0e9f 100644 --- a/Libraries/Renderer/shims/ReactNativeTypes.js +++ b/Libraries/Renderer/shims/ReactNativeTypes.js @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat * @flow strict - * @generated SignedSource<<67969011689de134487d7110b6519058>> + * @generated SignedSource<> * * This file was sync'd from the facebook/react repository. */ diff --git a/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js b/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js index b8e08eec174c..66f8ee0df003 100644 --- a/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js +++ b/Libraries/Renderer/shims/ReactNativeViewConfigRegistry.js @@ -4,15 +4,13 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat * @flow strict-local - * @generated SignedSource<<5b2da3e92f44ee2684113b45af052f5d>> + * @generated SignedSource<> * * This file was sync'd from the facebook/react repository. */ -/* eslint-disable react-internal/invariant-args */ - 'use strict'; import {type ViewConfig} from './ReactNativeTypes'; diff --git a/Libraries/Renderer/shims/createReactNativeComponentClass.js b/Libraries/Renderer/shims/createReactNativeComponentClass.js index b4711953fe07..51bf22b7965b 100644 --- a/Libraries/Renderer/shims/createReactNativeComponentClass.js +++ b/Libraries/Renderer/shims/createReactNativeComponentClass.js @@ -4,9 +4,9 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @format + * @noformat * @flow strict-local - * @generated SignedSource<<435ec24b3531c66986fe5d529795713b>> + * @generated SignedSource<<4f1549884fbe8fc2aea495692e3f665d>> * * This file was sync'd from the facebook/react repository. */ diff --git a/Libraries/Settings/NativeSettingsManager.js b/Libraries/Settings/NativeSettingsManager.js index bd03861d0c8c..d64309a7d9cc 100644 --- a/Libraries/Settings/NativeSettingsManager.js +++ b/Libraries/Settings/NativeSettingsManager.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Settings/RCTSettingsManager.h b/Libraries/Settings/RCTSettingsManager.h index 4e76780a284c..1e0263c47363 100644 --- a/Libraries/Settings/RCTSettingsManager.h +++ b/Libraries/Settings/RCTSettingsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Settings/RCTSettingsManager.mm b/Libraries/Settings/RCTSettingsManager.mm index 585d60aee224..4badb6068eba 100644 --- a/Libraries/Settings/RCTSettingsManager.mm +++ b/Libraries/Settings/RCTSettingsManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Settings/RCTSettingsPlugins.h b/Libraries/Settings/RCTSettingsPlugins.h index cf79705b6550..b6a5158a56ca 100644 --- a/Libraries/Settings/RCTSettingsPlugins.h +++ b/Libraries/Settings/RCTSettingsPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Settings/RCTSettingsPlugins.mm b/Libraries/Settings/RCTSettingsPlugins.mm index 7ce46c64c84a..703ebd62fbaf 100644 --- a/Libraries/Settings/RCTSettingsPlugins.mm +++ b/Libraries/Settings/RCTSettingsPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Settings/React-RCTSettings.podspec b/Libraries/Settings/React-RCTSettings.podspec index 532ba10ee2b9..854c5b940499 100644 --- a/Libraries/Settings/React-RCTSettings.podspec +++ b/Libraries/Settings/React-RCTSettings.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -36,11 +36,11 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.dependency "RCT-Folly", folly_version - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "RCTTypeSafety", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version diff --git a/Libraries/Settings/Settings.android.js b/Libraries/Settings/Settings.android.js index d754a7504bbb..4a11b74a5291 100644 --- a/Libraries/Settings/Settings.android.js +++ b/Libraries/Settings/Settings.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Settings/Settings.ios.js b/Libraries/Settings/Settings.ios.js index d920e3502fd6..994e92201817 100644 --- a/Libraries/Settings/Settings.ios.js +++ b/Libraries/Settings/Settings.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Share/NativeShareModule.js b/Libraries/Share/NativeShareModule.js index f8ca82a00dc6..bc03735b9149 100644 --- a/Libraries/Share/NativeShareModule.js +++ b/Libraries/Share/NativeShareModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Share/Share.js b/Libraries/Share/Share.js index cbf1188d795b..e2e7656de866 100644 --- a/Libraries/Share/Share.js +++ b/Libraries/Share/Share.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Storage/AsyncStorage.js b/Libraries/Storage/AsyncStorage.js index 057f39d4ee78..d66e089b6394 100644 --- a/Libraries/Storage/AsyncStorage.js +++ b/Libraries/Storage/AsyncStorage.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,7 +35,7 @@ type GetRequest = { * storage system that is global to the app. It should be used instead of * LocalStorage. * - * See https://reactnative.dev/docs/asyncstorage.html + * See https://reactnative.dev/docs/asyncstorage */ const AsyncStorage = { _getRequests: ([]: Array), @@ -45,15 +45,15 @@ const AsyncStorage = { /** * Fetches an item for a `key` and invokes a callback upon completion. * - * See https://reactnative.dev/docs/asyncstorage.html#getitem + * See https://reactnative.dev/docs/asyncstorage#getitem */ - getItem: function( + getItem: function ( key: string, callback?: ?(error: ?Error, result: ?string) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiGet([key], function(errors, result) { + RCTAsyncStorage.multiGet([key], function (errors, result) { // Unpack result to get value from [[key,value]] const value = result && result[0] && result[0][1] ? result[0][1] : null; const errs = convertErrors(errors); @@ -70,16 +70,16 @@ const AsyncStorage = { /** * Sets the value for a `key` and invokes a callback upon completion. * - * See https://reactnative.dev/docs/asyncstorage.html#setitem + * See https://reactnative.dev/docs/asyncstorage#setitem */ - setItem: function( + setItem: function ( key: string, value: string, callback?: ?(error: ?Error) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiSet([[key, value]], function(errors) { + RCTAsyncStorage.multiSet([[key, value]], function (errors) { const errs = convertErrors(errors); callback && callback(errs && errs[0]); if (errs) { @@ -94,15 +94,15 @@ const AsyncStorage = { /** * Removes an item for a `key` and invokes a callback upon completion. * - * See https://reactnative.dev/docs/asyncstorage.html#removeitem + * See https://reactnative.dev/docs/asyncstorage#removeitem */ - removeItem: function( + removeItem: function ( key: string, callback?: ?(error: ?Error) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiRemove([key], function(errors) { + RCTAsyncStorage.multiRemove([key], function (errors) { const errs = convertErrors(errors); callback && callback(errs && errs[0]); if (errs) { @@ -120,16 +120,16 @@ const AsyncStorage = { * * **NOTE:** This is not supported by all native implementations. * - * See https://reactnative.dev/docs/asyncstorage.html#mergeitem + * See https://reactnative.dev/docs/asyncstorage#mergeitem */ - mergeItem: function( + mergeItem: function ( key: string, value: string, callback?: ?(error: ?Error) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiMerge([[key, value]], function(errors) { + RCTAsyncStorage.multiMerge([[key, value]], function (errors) { const errs = convertErrors(errors); callback && callback(errs && errs[0]); if (errs) { @@ -146,12 +146,12 @@ const AsyncStorage = { * don't want to call this; use `removeItem` or `multiRemove` to clear only * your app's keys. * - * See https://reactnative.dev/docs/asyncstorage.html#clear + * See https://reactnative.dev/docs/asyncstorage#clear */ - clear: function(callback?: ?(error: ?Error) => void): Promise { + clear: function (callback?: ?(error: ?Error) => void): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.clear(function(error) { + RCTAsyncStorage.clear(function (error) { callback && callback(convertError(error)); if (error && convertError(error)) { reject(convertError(error)); @@ -165,14 +165,14 @@ const AsyncStorage = { /** * Gets *all* keys known to your app; for all callers, libraries, etc. * - * See https://reactnative.dev/docs/asyncstorage.html#getallkeys + * See https://reactnative.dev/docs/asyncstorage#getallkeys */ - getAllKeys: function( + getAllKeys: function ( callback?: ?(error: ?Error, keys: ?Array) => void, ): Promise> { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.getAllKeys(function(error, keys) { + RCTAsyncStorage.getAllKeys(function (error, keys) { callback && callback(convertError(error), keys); if (error) { reject(convertError(error)); @@ -196,9 +196,9 @@ const AsyncStorage = { /** * Flushes any pending requests using a single batch call to get the data. * - * See https://reactnative.dev/docs/asyncstorage.html#flushgetrequests + * See https://reactnative.dev/docs/asyncstorage#flushgetrequests * */ - flushGetRequests: function(): void { + flushGetRequests: function (): void { const getRequests = this._getRequests; const getKeys = this._getKeys; @@ -206,7 +206,7 @@ const AsyncStorage = { this._getKeys = []; invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); - RCTAsyncStorage.multiGet(getKeys, function(errors, result) { + RCTAsyncStorage.multiGet(getKeys, function (errors, result) { // Even though the runtime complexity of this is theoretically worse vs if we used a map, // it's much, much faster in practice for the data sets we deal with (we avoid // allocating result pair arrays). This was heavily benchmarked. @@ -235,10 +235,9 @@ const AsyncStorage = { * inputs. Your callback will be invoked with an array of corresponding * key-value pairs found. * - * See https://reactnative.dev/docs/asyncstorage.html#multiget + * See https://reactnative.dev/docs/asyncstorage#multiget */ - // $FlowFixMe[signature-verification-failure] - multiGet: function( + multiGet: function ( keys: Array, callback?: ?(errors: ?Array, result: ?Array>) => void, ): Promise>> { @@ -271,15 +270,15 @@ const AsyncStorage = { * Use this as a batch operation for storing multiple key-value pairs. When * the operation completes you'll get a single callback with any errors. * - * See https://reactnative.dev/docs/asyncstorage.html#multiset + * See https://reactnative.dev/docs/asyncstorage#multiset */ - multiSet: function( + multiSet: function ( keyValuePairs: Array>, callback?: ?(errors: ?Array) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiSet(keyValuePairs, function(errors) { + RCTAsyncStorage.multiSet(keyValuePairs, function (errors) { const error = convertErrors(errors); callback && callback(error); if (error) { @@ -294,15 +293,15 @@ const AsyncStorage = { /** * Call this to batch the deletion of all keys in the `keys` array. * - * See https://reactnative.dev/docs/asyncstorage.html#multiremove + * See https://reactnative.dev/docs/asyncstorage#multiremove */ - multiRemove: function( + multiRemove: function ( keys: Array, callback?: ?(errors: ?Array) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiRemove(keys, function(errors) { + RCTAsyncStorage.multiRemove(keys, function (errors) { const error = convertErrors(errors); callback && callback(error); if (error) { @@ -320,15 +319,15 @@ const AsyncStorage = { * * **NOTE**: This is not supported by all native implementations. * - * See https://reactnative.dev/docs/asyncstorage.html#multimerge + * See https://reactnative.dev/docs/asyncstorage#multimerge */ - multiMerge: function( + multiMerge: function ( keyValuePairs: Array>, callback?: ?(errors: ?Array) => void, ): Promise { invariant(RCTAsyncStorage, 'RCTAsyncStorage not available'); return new Promise((resolve, reject) => { - RCTAsyncStorage.multiMerge(keyValuePairs, function(errors) { + RCTAsyncStorage.multiMerge(keyValuePairs, function (errors) { const error = convertErrors(errors); callback && callback(error); if (error) { diff --git a/Libraries/Storage/NativeAsyncLocalStorage.js b/Libraries/Storage/NativeAsyncLocalStorage.js index bc66d23b8cce..10cf10049b39 100644 --- a/Libraries/Storage/NativeAsyncLocalStorage.js +++ b/Libraries/Storage/NativeAsyncLocalStorage.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Storage/NativeAsyncSQLiteDBStorage.js b/Libraries/Storage/NativeAsyncSQLiteDBStorage.js index 519b1486565d..2b6bfe846752 100644 --- a/Libraries/Storage/NativeAsyncSQLiteDBStorage.js +++ b/Libraries/Storage/NativeAsyncSQLiteDBStorage.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/EdgeInsetsPropType.js b/Libraries/StyleSheet/EdgeInsetsPropType.js index 56a51e548106..8f8889c443fa 100644 --- a/Libraries/StyleSheet/EdgeInsetsPropType.js +++ b/Libraries/StyleSheet/EdgeInsetsPropType.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/PlatformColorValueTypes.android.js b/Libraries/StyleSheet/PlatformColorValueTypes.android.js index 5985af468f84..96a8ee14e549 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypes.android.js +++ b/Libraries/StyleSheet/PlatformColorValueTypes.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/PlatformColorValueTypes.ios.js b/Libraries/StyleSheet/PlatformColorValueTypes.ios.js index 193ea338bdff..c809271debab 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypes.ios.js +++ b/Libraries/StyleSheet/PlatformColorValueTypes.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js b/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js index 912236c7359d..9e5234b7cf4c 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js +++ b/Libraries/StyleSheet/PlatformColorValueTypesIOS.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/PlatformColorValueTypesIOS.js b/Libraries/StyleSheet/PlatformColorValueTypesIOS.js index ead8c4fca2f5..adfa24231298 100644 --- a/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +++ b/Libraries/StyleSheet/PlatformColorValueTypesIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/PointPropType.js b/Libraries/StyleSheet/PointPropType.js index 9fd9789a4add..669ead1698b8 100644 --- a/Libraries/StyleSheet/PointPropType.js +++ b/Libraries/StyleSheet/PointPropType.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/Rect.js b/Libraries/StyleSheet/Rect.js index 24a4281eda2b..822576a720fb 100644 --- a/Libraries/StyleSheet/Rect.js +++ b/Libraries/StyleSheet/Rect.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/StyleSheet.js b/Libraries/StyleSheet/StyleSheet.js index 785fbfe199e3..ca22b918bd6e 100644 --- a/Libraries/StyleSheet/StyleSheet.js +++ b/Libraries/StyleSheet/StyleSheet.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -74,7 +74,8 @@ export type ImageStyleProp = ____ImageStyleProp_Internal; * through to an underlying component. Using this is almost always a mistake * and using one of the other more restrictive types is likely the right choice. */ -export type DangerouslyImpreciseStyleProp = ____DangerouslyImpreciseStyleProp_Internal; +export type DangerouslyImpreciseStyleProp = + ____DangerouslyImpreciseStyleProp_Internal; /** * Utility type for getting the values for specific style keys. diff --git a/Libraries/StyleSheet/StyleSheetTypes.js b/Libraries/StyleSheet/StyleSheetTypes.js index 5a32873e3456..80c107b1e82d 100644 --- a/Libraries/StyleSheet/StyleSheetTypes.js +++ b/Libraries/StyleSheet/StyleSheetTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -673,7 +673,7 @@ export type ____ImageStyleProp_Internal = GenericStyleProp< export type ____Styles_Internal = { +[key: string]: $Shape<____DangerouslyImpreciseStyle_Internal>, - ..., + ... }; export type ____FlattenStyleProp_Internal<+TStyleProp> = $Call< diff --git a/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js b/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js index fddb4158f69e..a7dbaafe08fb 100644 --- a/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js +++ b/Libraries/StyleSheet/__flowtests__/StyleSheet-flowtest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/__tests__/flattenStyle-test.js b/Libraries/StyleSheet/__tests__/flattenStyle-test.js index 813474303995..e03a676f4a22 100644 --- a/Libraries/StyleSheet/__tests__/flattenStyle-test.js +++ b/Libraries/StyleSheet/__tests__/flattenStyle-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/__tests__/normalizeColor-test.js b/Libraries/StyleSheet/__tests__/normalizeColor-test.js index f07498751e28..f102511f8713 100644 --- a/Libraries/StyleSheet/__tests__/normalizeColor-test.js +++ b/Libraries/StyleSheet/__tests__/normalizeColor-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,10 +22,10 @@ it('forwards calls to @react-native/normalize-color', () => { describe('iOS', () => { if (OS === 'ios') { - const PlatformColor = require('../PlatformColorValueTypes.ios') - .PlatformColor; - const DynamicColorIOS = require('../PlatformColorValueTypesIOS.ios') - .DynamicColorIOS; + const PlatformColor = + require('../PlatformColorValueTypes.ios').PlatformColor; + const DynamicColorIOS = + require('../PlatformColorValueTypesIOS.ios').DynamicColorIOS; it('should normalize iOS PlatformColor colors', () => { const color = PlatformColor('systemRedColor'); @@ -79,8 +79,8 @@ describe('iOS', () => { describe('Android', () => { if (OS === 'android') { - const PlatformColor = require('../PlatformColorValueTypes.android') - .PlatformColor; + const PlatformColor = + require('../PlatformColorValueTypes.android').PlatformColor; it('should normalize Android PlatformColor colors', () => { const color = PlatformColor('?attr/colorPrimary'); diff --git a/Libraries/StyleSheet/__tests__/processColor-test.js b/Libraries/StyleSheet/__tests__/processColor-test.js index d428b854e8f5..c9d93bb2a0da 100644 --- a/Libraries/StyleSheet/__tests__/processColor-test.js +++ b/Libraries/StyleSheet/__tests__/processColor-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,12 +13,12 @@ const {OS} = require('../../Utilities/Platform'); const processColor = require('../processColor'); -const PlatformColorIOS = require('../PlatformColorValueTypes.ios') - .PlatformColor; -const DynamicColorIOS = require('../PlatformColorValueTypesIOS.ios') - .DynamicColorIOS; -const PlatformColorAndroid = require('../PlatformColorValueTypes.android') - .PlatformColor; +const PlatformColorIOS = + require('../PlatformColorValueTypes.ios').PlatformColor; +const DynamicColorIOS = + require('../PlatformColorValueTypesIOS.ios').DynamicColorIOS; +const PlatformColorAndroid = + require('../PlatformColorValueTypes.android').PlatformColor; const platformSpecific = OS === 'android' diff --git a/Libraries/StyleSheet/__tests__/processColorArray-test.js b/Libraries/StyleSheet/__tests__/processColorArray-test.js index 3ccc582a1166..8703815cd861 100644 --- a/Libraries/StyleSheet/__tests__/processColorArray-test.js +++ b/Libraries/StyleSheet/__tests__/processColorArray-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,12 +13,12 @@ const {OS} = require('../../Utilities/Platform'); const processColorArray = require('../processColorArray'); -const PlatformColorIOS = require('../PlatformColorValueTypes.ios') - .PlatformColor; -const DynamicColorIOS = require('../PlatformColorValueTypesIOS.ios') - .DynamicColorIOS; -const PlatformColorAndroid = require('../PlatformColorValueTypes.android') - .PlatformColor; +const PlatformColorIOS = + require('../PlatformColorValueTypes.ios').PlatformColor; +const DynamicColorIOS = + require('../PlatformColorValueTypesIOS.ios').DynamicColorIOS; +const PlatformColorAndroid = + require('../PlatformColorValueTypes.android').PlatformColor; const platformSpecific = OS === 'android' @@ -70,11 +70,7 @@ describe('processColorArray', () => { const colors = ['red', '???', null, undefined, false]; const colorFromStringArray = processColorArray(colors); const expectedIntArray = [ - 0xffff0000, - 0x00000000, - 0x00000000, - 0x00000000, - 0x00000000, + 0xffff0000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, ].map(platformSpecific); expect(colorFromStringArray).toEqual(expectedIntArray); diff --git a/Libraries/StyleSheet/__tests__/processTransform-test.js b/Libraries/StyleSheet/__tests__/processTransform-test.js index 1de3a08d38dd..8a88c5bd4ac8 100644 --- a/Libraries/StyleSheet/__tests__/processTransform-test.js +++ b/Libraries/StyleSheet/__tests__/processTransform-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/__tests__/setNormalizedColorAlpha-test.js b/Libraries/StyleSheet/__tests__/setNormalizedColorAlpha-test.js index bc400b56c94c..9ed61e51abb5 100644 --- a/Libraries/StyleSheet/__tests__/setNormalizedColorAlpha-test.js +++ b/Libraries/StyleSheet/__tests__/setNormalizedColorAlpha-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,22 +13,22 @@ const setNormalizedColorAlpha = require('../setNormalizedColorAlpha'); const normalizeColor = require('../normalizeColor'); -describe('setNormalizedColorAlpha', function() { - it('should adjust the alpha of the color passed in', function() { +describe('setNormalizedColorAlpha', function () { + it('should adjust the alpha of the color passed in', function () { expect(setNormalizedColorAlpha(0xffffffff, 0.4)).toBe(0xffffff66); expect(setNormalizedColorAlpha(0x204080ff, 0.6)).toBe(0x20408099); }); - it('should clamp invalid input', function() { + it('should clamp invalid input', function () { expect(setNormalizedColorAlpha(0xffffffff, 1.5)).toBe(0xffffffff); expect(setNormalizedColorAlpha(0xffffffff, -1)).toBe(0xffffff00); }); - it("should ignore the color's original alpha", function() { + it("should ignore the color's original alpha", function () { expect(setNormalizedColorAlpha(0x204080aa, 0.8)).toBe(0x204080cc); }); - it('should return the original color when alpha is unchanged', function() { + it('should return the original color when alpha is unchanged', function () { const originalColor = normalizeColor('blue'); expect(setNormalizedColorAlpha(originalColor, 1)).toBe(originalColor); }); diff --git a/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js b/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js index 2206b3fa61dc..a948cc66b555 100644 --- a/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js +++ b/Libraries/StyleSheet/__tests__/splitLayoutProps-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/flattenStyle.js b/Libraries/StyleSheet/flattenStyle.js index 488ef19d0613..e37e27171971 100644 --- a/Libraries/StyleSheet/flattenStyle.js +++ b/Libraries/StyleSheet/flattenStyle.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/normalizeColor.js b/Libraries/StyleSheet/normalizeColor.js index 89a672c4567d..386e41c43419 100755 --- a/Libraries/StyleSheet/normalizeColor.js +++ b/Libraries/StyleSheet/normalizeColor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/processColor.js b/Libraries/StyleSheet/processColor.js index 93a5c383540f..e6f8aa372852 100644 --- a/Libraries/StyleSheet/processColor.js +++ b/Libraries/StyleSheet/processColor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -31,8 +31,8 @@ function processColor(color?: ?(number | ColorValue)): ?ProcessedColorValue { } if (typeof normalizedColor === 'object') { - const processColorObject = require('./PlatformColorValueTypes') - .processColorObject; + const processColorObject = + require('./PlatformColorValueTypes').processColorObject; const processedColorObj = processColorObject(normalizedColor); diff --git a/Libraries/StyleSheet/processColorArray.js b/Libraries/StyleSheet/processColorArray.js index 1d13d876c11d..8b773ecdd779 100644 --- a/Libraries/StyleSheet/processColorArray.js +++ b/Libraries/StyleSheet/processColorArray.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/processTransform.js b/Libraries/StyleSheet/processTransform.js index a3715dae9ba6..c05375bd5912 100644 --- a/Libraries/StyleSheet/processTransform.js +++ b/Libraries/StyleSheet/processTransform.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -150,7 +150,26 @@ function _validateTransforms(transform: Array): void { }); } -function _validateTransform(key, value, transformation) { +function _validateTransform( + key: + | string + | $TEMPORARY$string<'matrix'> + | $TEMPORARY$string<'perspective'> + | $TEMPORARY$string<'rotate'> + | $TEMPORARY$string<'rotateX'> + | $TEMPORARY$string<'rotateY'> + | $TEMPORARY$string<'rotateZ'> + | $TEMPORARY$string<'scale'> + | $TEMPORARY$string<'scaleX'> + | $TEMPORARY$string<'scaleY'> + | $TEMPORARY$string<'skewX'> + | $TEMPORARY$string<'skewY'> + | $TEMPORARY$string<'translate'> + | $TEMPORARY$string<'translateX'> + | $TEMPORARY$string<'translateY'>, + value: any | number | string, + transformation: any, +) { invariant( !value.getValue, 'You passed an Animated.Value to a normal component. ' + diff --git a/Libraries/StyleSheet/setNormalizedColorAlpha.js b/Libraries/StyleSheet/setNormalizedColorAlpha.js index 5f20494cef72..7cfce2dc9fb8 100644 --- a/Libraries/StyleSheet/setNormalizedColorAlpha.js +++ b/Libraries/StyleSheet/setNormalizedColorAlpha.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/StyleSheet/splitLayoutProps.js b/Libraries/StyleSheet/splitLayoutProps.js index e871390a190f..570e83f029c8 100644 --- a/Libraries/StyleSheet/splitLayoutProps.js +++ b/Libraries/StyleSheet/splitLayoutProps.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,9 +10,7 @@ import type {____ViewStyle_Internal} from './StyleSheetTypes'; -export default function splitLayoutProps( - props: ?____ViewStyle_Internal, -): { +export default function splitLayoutProps(props: ?____ViewStyle_Internal): { outer: ?____ViewStyle_Internal, inner: ?____ViewStyle_Internal, } { diff --git a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.h b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.h index 637d910a085e..d6cbaee83209 100644 --- a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.h +++ b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.mm b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.mm index 8fb752dbb277..85e85bd8ccd7 100644 --- a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.mm +++ b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponent.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.h b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.h index 7790e727b29f..d68a6b450d2e 100644 --- a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.h +++ b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.mm b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.mm index fec672e78549..649cea4af31f 100644 --- a/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.mm +++ b/Libraries/SurfaceBackedComponent/RCTSurfaceBackedComponentState.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent+Internal.h b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent+Internal.h index aac68ae4246b..41af830ec757 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent+Internal.h +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent+Internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.h b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.h index 750f5e0f633e..f2859cf03130 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.h +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.mm b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.mm index de1910c8b778..80035fc0eacf 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.mm +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponent.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.h b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.h index 2842d0410dd6..0627ecf3c2cd 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.h +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.mm b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.mm index cd69fb32b3e1..4bbaa89bea9a 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.mm +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentController.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentOptions.h b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentOptions.h index 35d203251e93..cd6e6df89e4a 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentOptions.h +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentOptions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.h b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.h index 94095f829e31..6e1651838f44 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.h +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.mm b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.mm index a8708f205283..2d62ac426500 100644 --- a/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.mm +++ b/Libraries/SurfaceHostingComponent/RCTSurfaceHostingComponentState.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/BaseText/RCTBaseTextShadowView.h b/Libraries/Text/BaseText/RCTBaseTextShadowView.h index 9f2c944c4483..9d0affa3f03f 100644 --- a/Libraries/Text/BaseText/RCTBaseTextShadowView.h +++ b/Libraries/Text/BaseText/RCTBaseTextShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/BaseText/RCTBaseTextShadowView.m b/Libraries/Text/BaseText/RCTBaseTextShadowView.m index dba9bffae2d9..23d38d120ac1 100644 --- a/Libraries/Text/BaseText/RCTBaseTextShadowView.m +++ b/Libraries/Text/BaseText/RCTBaseTextShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/BaseText/RCTBaseTextViewManager.h b/Libraries/Text/BaseText/RCTBaseTextViewManager.h index b0f947014057..56f63c36702a 100644 --- a/Libraries/Text/BaseText/RCTBaseTextViewManager.h +++ b/Libraries/Text/BaseText/RCTBaseTextViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/BaseText/RCTBaseTextViewManager.m b/Libraries/Text/BaseText/RCTBaseTextViewManager.m index 48a83e5c67cf..fee8647bab15 100644 --- a/Libraries/Text/BaseText/RCTBaseTextViewManager.m +++ b/Libraries/Text/BaseText/RCTBaseTextViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RCTConvert+Text.h b/Libraries/Text/RCTConvert+Text.h index eafbdb3e3bd7..b7c411a2a693 100644 --- a/Libraries/Text/RCTConvert+Text.h +++ b/Libraries/Text/RCTConvert+Text.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RCTConvert+Text.m b/Libraries/Text/RCTConvert+Text.m index 864e6d8df446..da9fb7cb839f 100644 --- a/Libraries/Text/RCTConvert+Text.m +++ b/Libraries/Text/RCTConvert+Text.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RCTTextAttributes.h b/Libraries/Text/RCTTextAttributes.h index ce043621ef68..a95536d1b671 100644 --- a/Libraries/Text/RCTTextAttributes.h +++ b/Libraries/Text/RCTTextAttributes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RCTTextAttributes.m b/Libraries/Text/RCTTextAttributes.m index e8df8b352ef0..01131cfb20e2 100644 --- a/Libraries/Text/RCTTextAttributes.m +++ b/Libraries/Text/RCTTextAttributes.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -237,6 +237,23 @@ - (UIColor *)effectiveBackgroundColor return effectiveBackgroundColor ?: [UIColor clearColor]; } +static NSString *capitalizeText(NSString *text) +{ + NSArray *words = [text componentsSeparatedByString:@" "]; + NSMutableArray *newWords = [NSMutableArray new]; + NSNumberFormatter *num = [NSNumberFormatter new]; + for (NSString *item in words) { + NSString *word; + if ([item length] > 0 && [num numberFromString:[item substringWithRange:NSMakeRange(0, 1)]] == nil) { + word = [item capitalizedString]; + } else { + word = [item lowercaseString]; + } + [newWords addObject:word]; + } + return [newWords componentsJoinedByString:@" "]; +} + - (NSString *)applyTextAttributesToText:(NSString *)text { switch (_textTransform) { @@ -248,7 +265,7 @@ - (NSString *)applyTextAttributesToText:(NSString *)text case RCTTextTransformUppercase: return [text uppercaseString]; case RCTTextTransformCapitalize: - return [text capitalizedString]; + return capitalizeText(text); } } diff --git a/Libraries/Text/RCTTextTransform.h b/Libraries/Text/RCTTextTransform.h index 15d328c07cfe..014cd392d5ef 100644 --- a/Libraries/Text/RCTTextTransform.h +++ b/Libraries/Text/RCTTextTransform.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RawText/RCTRawTextShadowView.h b/Libraries/Text/RawText/RCTRawTextShadowView.h index 1b63014f4d60..cc4c4d7082cd 100644 --- a/Libraries/Text/RawText/RCTRawTextShadowView.h +++ b/Libraries/Text/RawText/RCTRawTextShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RawText/RCTRawTextShadowView.m b/Libraries/Text/RawText/RCTRawTextShadowView.m index 0581f6838d2b..9ddb69fed5d2 100644 --- a/Libraries/Text/RawText/RCTRawTextShadowView.m +++ b/Libraries/Text/RawText/RCTRawTextShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RawText/RCTRawTextViewManager.h b/Libraries/Text/RawText/RCTRawTextViewManager.h index ef9a07665cce..03a8a7586aa2 100644 --- a/Libraries/Text/RawText/RCTRawTextViewManager.h +++ b/Libraries/Text/RawText/RCTRawTextViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/RawText/RCTRawTextViewManager.m b/Libraries/Text/RawText/RCTRawTextViewManager.m index c7729a59f33c..f872536ac4c0 100644 --- a/Libraries/Text/RawText/RCTRawTextViewManager.m +++ b/Libraries/Text/RawText/RCTRawTextViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/React-RCTText.podspec b/Libraries/Text/React-RCTText.podspec index 8a4061e82bb2..cec2fef17e03 100644 --- a/Libraries/Text/React-RCTText.podspec +++ b/Libraries/Text/React-RCTText.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text.js b/Libraries/Text/Text.js index f2dc30651eaf..35db91d2bdc8 100644 --- a/Libraries/Text/Text.js +++ b/Libraries/Text/Text.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,6 @@ * @format */ -import DeprecatedTextPropTypes from '../DeprecatedPropTypes/DeprecatedTextPropTypes'; import * as PressabilityDebug from '../Pressability/PressabilityDebug'; import usePressability from '../Pressability/usePressability'; import StyleSheet from '../StyleSheet/StyleSheet'; @@ -18,12 +17,11 @@ import {NativeText, NativeVirtualText} from './TextNativeComponent'; import {type TextProps} from './TextProps'; import * as React from 'react'; import {useContext, useMemo, useState} from 'react'; -import invariant from 'invariant'; /** * Text is the fundamental component for displaying text. * - * @see https://reactnative.dev/docs/text.html + * @see https://reactnative.dev/docs/text */ const Text: React.AbstractComponent< TextProps, @@ -73,7 +71,8 @@ const Text: React.AbstractComponent< setHighlighted(false); onPressOut?.(event); }, - onResponderTerminationRequest_DEPRECATED: onResponderTerminationRequest, + onResponderTerminationRequest_DEPRECATED: + onResponderTerminationRequest, onStartShouldSetResponder_DEPRECATED: onStartShouldSetResponder, } : null, @@ -164,6 +163,7 @@ const Text: React.AbstractComponent< {...restProps} {...eventHandlersForText} isHighlighted={isHighlighted} + isPressable={isPressable} numberOfLines={numberOfLines} selectionColor={selectionColor} style={style} @@ -189,8 +189,11 @@ const Text: React.AbstractComponent< Text.displayName = 'Text'; -// TODO: Delete this. -Text.propTypes = DeprecatedTextPropTypes; +/** + * Switch to `deprecated-react-native-prop-types` for compatibility with future + * releases. This is deprecated and will be removed in the future. + */ +Text.propTypes = require('deprecated-react-native-prop-types').TextPropTypes; /** * Returns false until the first time `newValue` is true, after which this will @@ -205,8 +208,4 @@ function useLazyInitialization(newValue: boolean): boolean { return oldValue; } -// $FlowFixMe[incompatible-cast] - No good way to type a React.AbstractComponent with statics. -module.exports = (Text: typeof Text & - $ReadOnly<{ - propTypes: typeof DeprecatedTextPropTypes, - }>); +module.exports = Text; diff --git a/Libraries/Text/Text/NSTextStorage+FontScaling.h b/Libraries/Text/Text/NSTextStorage+FontScaling.h index 61b1634f435c..a87d67d19230 100644 --- a/Libraries/Text/Text/NSTextStorage+FontScaling.h +++ b/Libraries/Text/Text/NSTextStorage+FontScaling.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/NSTextStorage+FontScaling.m b/Libraries/Text/Text/NSTextStorage+FontScaling.m index e4a2c4c05078..e3752c7c774e 100644 --- a/Libraries/Text/Text/NSTextStorage+FontScaling.m +++ b/Libraries/Text/Text/NSTextStorage+FontScaling.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/RCTTextShadowView.h b/Libraries/Text/Text/RCTTextShadowView.h index d364db51ea41..f3202b5fd373 100644 --- a/Libraries/Text/Text/RCTTextShadowView.h +++ b/Libraries/Text/Text/RCTTextShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/RCTTextShadowView.m b/Libraries/Text/Text/RCTTextShadowView.m index 2d4955f35758..5e39196cefd1 100644 --- a/Libraries/Text/Text/RCTTextShadowView.m +++ b/Libraries/Text/Text/RCTTextShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/RCTTextView.h b/Libraries/Text/Text/RCTTextView.h index 5928b705cb7c..74d102a2db69 100644 --- a/Libraries/Text/Text/RCTTextView.h +++ b/Libraries/Text/Text/RCTTextView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/RCTTextView.m b/Libraries/Text/Text/RCTTextView.m index bda5f8d078f4..6726e12deab0 100644 --- a/Libraries/Text/Text/RCTTextView.m +++ b/Libraries/Text/Text/RCTTextView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/RCTTextViewManager.h b/Libraries/Text/Text/RCTTextViewManager.h index 446a5db2c46d..4c5db002cbf2 100644 --- a/Libraries/Text/Text/RCTTextViewManager.h +++ b/Libraries/Text/Text/RCTTextViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/Text/RCTTextViewManager.m b/Libraries/Text/Text/RCTTextViewManager.m index c954809ae6d4..ce0c44999a0d 100644 --- a/Libraries/Text/Text/RCTTextViewManager.m +++ b/Libraries/Text/Text/RCTTextViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextAncestor.js b/Libraries/Text/TextAncestor.js index 3ea2d65ce911..f61c90e8209b 100644 --- a/Libraries/Text/TextAncestor.js +++ b/Libraries/Text/TextAncestor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h index 0efd63a4c0a5..bd183de3a595 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m index e9d103a32325..0cbaea87b42c 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h index 3347fbb0f542..fe8dbc34e7fa 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m index 7a661b183fa0..6eb74da39e1c 100644 --- a/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Multiline/RCTMultilineTextInputViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.h b/Libraries/Text/TextInput/Multiline/RCTUITextView.h index 5cb03eed62c7..5ccb6b6d7d3f 100644 --- a/Libraries/Text/TextInput/Multiline/RCTUITextView.h +++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Multiline/RCTUITextView.m b/Libraries/Text/TextInput/Multiline/RCTUITextView.m index 4a94455025df..92371bc8bf61 100644 --- a/Libraries/Text/TextInput/Multiline/RCTUITextView.m +++ b/Libraries/Text/TextInput/Multiline/RCTUITextView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -147,21 +147,7 @@ - (void)setTextAlignment:(NSTextAlignment)textAlignment - (void)setAttributedText:(NSAttributedString *)attributedText { - // Using `setAttributedString:` while user is typing breaks some internal mechanics - // when entering complex input languages such as Chinese, Korean or Japanese. - // see: https://github.com/facebook/react-native/issues/19339 - - // We try to avoid calling this method as much as we can. - // If the text has changed, there is nothing we can do. - if (![super.attributedText.string isEqualToString:attributedText.string]) { - [super setAttributedText:attributedText]; - } else { - // But if the text is preserved, we just copying the attributes from the source string. - if (![super.attributedText isEqualToAttributedString:attributedText]) { - [self copyTextAttributesFrom:attributedText]; - } - } - + [super setAttributedText:attributedText]; [self textDidChange]; } @@ -311,18 +297,4 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position #pragma mark - Utility Methods -- (void)copyTextAttributesFrom:(NSAttributedString *)sourceString -{ - [self.textStorage beginEditing]; - - NSTextStorage *textStorage = self.textStorage; - [sourceString enumerateAttributesInRange:NSMakeRange(0, sourceString.length) - options:NSAttributedStringEnumerationReverse - usingBlock:^(NSDictionary * _Nonnull attrs, NSRange range, BOOL * _Nonnull stop) { - [textStorage setAttributes:attrs range:range]; - }]; - - [self.textStorage endEditing]; -} - @end diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h b/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h index 3e1839b42d2d..c2a4362f028b 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h index a7f3251ebb1e..1051715db38e 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m index b508df298b6e..c6c254ce5dbe 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m +++ b/Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h index 09f4fe27660e..c235907d796a 100644 --- a/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h +++ b/Libraries/Text/TextInput/RCTBackedTextInputViewProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -31,6 +31,10 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign) UITextFieldViewMode clearButtonMode; @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, strong, nullable) NSString *inputAccessoryViewID; +@property (nonatomic, assign, readonly) CGFloat zoomScale; +@property (nonatomic, assign, readonly) CGPoint contentOffset; +@property (nonatomic, assign, readonly) UIEdgeInsets contentInset; + // This protocol disallows direct access to `selectedTextRange` property because // unwise usage of it can break the `delegate` behavior. So, we always have to diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.h b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.h index 44b46dbcee5b..8f4cf7eb1b5f 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.h +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m index 66035545b30a..19d202cb3494 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.h b/Libraries/Text/TextInput/RCTBaseTextInputView.h index d73f082cbd89..5c6c5cfcfa4b 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.h +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,6 +35,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy, nullable) RCTDirectEventBlock onContentSizeChange; @property (nonatomic, copy, nullable) RCTDirectEventBlock onSelectionChange; @property (nonatomic, copy, nullable) RCTDirectEventBlock onChange; +@property (nonatomic, copy, nullable) RCTDirectEventBlock onChangeSync; @property (nonatomic, copy, nullable) RCTDirectEventBlock onTextInput; @property (nonatomic, copy, nullable) RCTDirectEventBlock onScroll; diff --git a/Libraries/Text/TextInput/RCTBaseTextInputView.m b/Libraries/Text/TextInput/RCTBaseTextInputView.m index d75f140c9d21..a4924923f190 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputView.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -104,6 +104,7 @@ - (BOOL)textOf:(NSAttributedString*)newText equals:(NSAttributedString*)oldText{ // Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the // text that we should disregard. See https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc // for more info. + // Also, updating the attributed text while inputting Korean language will break input mechanism. // If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in NSOriginalFont. // Lastly, when entering a password, etc., there will be additional styling on the field as the native text view // handles showing the last character for a split second. @@ -116,6 +117,7 @@ - (BOOL)textOf:(NSAttributedString*)newText equals:(NSAttributedString*)oldText{ BOOL shouldFallbackToBareTextComparison = [self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] || + [self.backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] || self.backedTextInputView.markedTextRange || self.backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem; @@ -300,7 +302,7 @@ - (void)setShowSoftInputOnFocus:(BOOL)showSoftInputOnFocus self.backedTextInputView.inputView = nil; } else { // Hides keyboard, but keeps blinking cursor. - self.backedTextInputView.inputView = [[UIView alloc] init]; + self.backedTextInputView.inputView = [UIView new]; } } @@ -607,7 +609,7 @@ - (void)setDefaultInputAccessoryView _hasInputAccesoryView = shouldHaveInputAccesoryView; if (shouldHaveInputAccesoryView) { - UIToolbar *toolbarView = [[UIToolbar alloc] init]; + UIToolbar *toolbarView = [UIToolbar new]; [toolbarView sizeToFit]; UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace diff --git a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.h b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.h index 5201bdbc5167..1a9b1a96bb55 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.h +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m index 34994ca4fd11..b1ecf854330b 100644 --- a/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m +++ b/Libraries/Text/TextInput/RCTBaseTextInputViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -61,6 +61,8 @@ @implementation RCTBaseTextInputViewManager RCT_EXPORT_VIEW_PROPERTY(passwordRules, NSString) RCT_EXPORT_VIEW_PROPERTY(onChange, RCTBubblingEventBlock) +RCT_EXPORT_VIEW_PROPERTY(onKeyPressSync, RCTDirectEventBlock) +RCT_EXPORT_VIEW_PROPERTY(onChangeSync, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onSelectionChange, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onTextInput, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(onScroll, RCTDirectEventBlock) @@ -132,7 +134,9 @@ - (void)setBridge:(RCTBridge *)bridge } RCTExecuteOnUIManagerQueue(^{ RCTBaseTextInputShadowView *shadowView = (RCTBaseTextInputShadowView *)[self.bridge.uiManager shadowViewForReactTag:viewTag]; - [shadowView setText:value]; + if (value) { + [shadowView setText:value]; + } [self.bridge.uiManager setNeedsLayout]; RCTExecuteOnMainQueue(^{ [view setSelectionStart:start selectionEnd:end]; diff --git a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h index 8ed5110325e9..8f7ecb81bbd9 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h +++ b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m index 1807f112a886..8322bfc7f3e8 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryView.h b/Libraries/Text/TextInput/RCTInputAccessoryView.h index d4c48ce2d90b..f86370ce5cb9 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryView.h +++ b/Libraries/Text/TextInput/RCTInputAccessoryView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryView.m b/Libraries/Text/TextInput/RCTInputAccessoryView.m index 8559072f59ef..05fbec5154e5 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryView.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h index f65eea76aea3..e07b07d785b4 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m index 22a718631c78..cb846f1488d8 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewContent.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.h b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.h index 251048de69d6..4f1cc324946a 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.h +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m index e210c41f6f21..39ba1564754a 100644 --- a/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m +++ b/Libraries/Text/TextInput/RCTInputAccessoryViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTTextSelection.h b/Libraries/Text/TextInput/RCTTextSelection.h index 0bb75834e1b7..baa2e0e46a1a 100644 --- a/Libraries/Text/TextInput/RCTTextSelection.h +++ b/Libraries/Text/TextInput/RCTTextSelection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/RCTTextSelection.m b/Libraries/Text/TextInput/RCTTextSelection.m index 3ff7765fb3b5..bbcf63bf0bcc 100644 --- a/Libraries/Text/TextInput/RCTTextSelection.m +++ b/Libraries/Text/TextInput/RCTTextSelection.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.h b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.h index d9450db07659..4846f7d7701b 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.h +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m index 87feff01b4c1..51feea12f866 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h index 314993a04a47..6134ddba498a 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m index e48afb2bc4a6..1fa2dc55b5ae 100644 --- a/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m +++ b/Libraries/Text/TextInput/Singleline/RCTSinglelineTextInputViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.h b/Libraries/Text/TextInput/Singleline/RCTUITextField.h index f3b3492607a6..358e137f1326 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.h +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,6 +29,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, assign, getter=isEditable) BOOL editable; @property (nonatomic, getter=isScrollEnabled) BOOL scrollEnabled; @property (nonatomic, strong, nullable) NSString *inputAccessoryViewID; +@property (nonatomic, assign, readonly) CGFloat zoomScale; +@property (nonatomic, assign, readonly) CGPoint contentOffset; +@property (nonatomic, assign, readonly) UIEdgeInsets contentInset; @end diff --git a/Libraries/Text/TextInput/Singleline/RCTUITextField.m b/Libraries/Text/TextInput/Singleline/RCTUITextField.m index 1dae92a3096b..b71ef0c9613e 100644 --- a/Libraries/Text/TextInput/Singleline/RCTUITextField.m +++ b/Libraries/Text/TextInput/Singleline/RCTUITextField.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/TextNativeComponent.js b/Libraries/Text/TextNativeComponent.js index 858aaba750f1..b5d5557e38ed 100644 --- a/Libraries/Text/TextNativeComponent.js +++ b/Libraries/Text/TextNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,15 +19,18 @@ type NativeTextProps = $ReadOnly<{ ...TextProps, isHighlighted?: ?boolean, selectionColor?: ?ProcessedColorValue, + // This is only needed for platforms that optimize text hit testing, e.g., + // react-native-windows. It can be used to only hit test virtual text spans + // that have pressable events attached to them. + isPressable?: ?boolean, }>; -export const NativeText: HostComponent = (createReactNativeComponentClass( - 'RCTText', - () => ({ - // $FlowFixMe[incompatible-call] +export const NativeText: HostComponent = + (createReactNativeComponentClass('RCTText', () => ({ validAttributes: { ...ReactNativeViewAttributes.UIView, isHighlighted: true, + isPressable: true, numberOfLines: true, ellipsizeMode: true, allowFontScaling: true, @@ -52,17 +55,16 @@ export const NativeText: HostComponent = (createReactNativeComp }, }, uiViewClassName: 'RCTText', - }), -): any); + })): any); export const NativeVirtualText: HostComponent = !global.RN$Bridgeless && !UIManager.hasViewManagerConfig('RCTVirtualText') ? NativeText : (createReactNativeComponentClass('RCTVirtualText', () => ({ - // $FlowFixMe[incompatible-call] validAttributes: { ...ReactNativeViewAttributes.UIView, isHighlighted: true, + isPressable: true, maxFontSizeMultiplier: true, }, uiViewClassName: 'RCTVirtualText', diff --git a/Libraries/Text/TextProps.js b/Libraries/Text/TextProps.js index 3942a5998cd3..f83602692a29 100644 --- a/Libraries/Text/TextProps.js +++ b/Libraries/Text/TextProps.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -32,13 +32,13 @@ export type PressRetentionOffset = $ReadOnly<{| |}>; /** - * @see https://reactnative.dev/docs/text.html#reference + * @see https://reactnative.dev/docs/text#reference */ export type TextProps = $ReadOnly<{| /** * Indicates whether the view is an accessibility element. * - * See https://reactnative.dev/docs/text.html#accessible + * See https://reactnative.dev/docs/text#accessible */ accessible?: ?boolean, accessibilityActions?: ?$ReadOnlyArray, @@ -51,14 +51,14 @@ export type TextProps = $ReadOnly<{| /** * Whether font should be scaled down automatically. * - * See https://reactnative.dev/docs/text.html#adjustsfontsizetofit + * See https://reactnative.dev/docs/text#adjustsfontsizetofit */ adjustsFontSizeToFit?: ?boolean, /** * Whether fonts should scale to respect Text Size accessibility settings. * - * See https://reactnative.dev/docs/text.html#allowfontscaling + * See https://reactnative.dev/docs/text#allowfontscaling */ allowFontScaling?: ?boolean, @@ -73,7 +73,7 @@ export type TextProps = $ReadOnly<{| * When `numberOfLines` is set, this prop defines how text will be * truncated. * - * See https://reactnative.dev/docs/text.html#ellipsizemode + * See https://reactnative.dev/docs/text#ellipsizemode */ ellipsizeMode?: ?('clip' | 'head' | 'middle' | 'tail'), @@ -89,35 +89,35 @@ export type TextProps = $ReadOnly<{| /** * Used to locate this view from native code. * - * See https://reactnative.dev/docs/text.html#nativeid + * See https://reactnative.dev/docs/text#nativeid */ nativeID?: ?string, /** * Used to truncate the text with an ellipsis. * - * See https://reactnative.dev/docs/text.html#numberoflines + * See https://reactnative.dev/docs/text#numberoflines */ numberOfLines?: ?number, /** * Invoked on mount and layout changes. * - * See https://reactnative.dev/docs/text.html#onlayout + * See https://reactnative.dev/docs/text#onlayout */ onLayout?: ?(event: LayoutEvent) => mixed, /** * This function is called on long press. * - * See https://reactnative.dev/docs/text.html#onlongpress + * See https://reactnative.dev/docs/text#onlongpress */ onLongPress?: ?(event: PressEvent) => mixed, /** * This function is called on press. * - * See https://reactnative.dev/docs/text.html#onpress + * See https://reactnative.dev/docs/text#onpress */ onPress?: ?(event: PressEvent) => mixed, onPressIn?: ?(event: PressEvent) => mixed, @@ -135,14 +135,14 @@ export type TextProps = $ReadOnly<{| * Defines how far your touch may move off of the button, before * deactivating the button. * - * See https://reactnative.dev/docs/text.html#pressretentionoffset + * See https://reactnative.dev/docs/text#pressretentionoffset */ pressRetentionOffset?: ?PressRetentionOffset, /** * Lets the user select text. * - * See https://reactnative.dev/docs/text.html#selectable + * See https://reactnative.dev/docs/text#selectable */ selectable?: ?boolean, style?: ?TextStyleProp, @@ -150,7 +150,7 @@ export type TextProps = $ReadOnly<{| /** * Used to locate this view in end-to-end tests. * - * See https://reactnative.dev/docs/text.html#testid + * See https://reactnative.dev/docs/text#testid */ testID?: ?string, @@ -161,14 +161,14 @@ export type TextProps = $ReadOnly<{| /** * Specifies the disabled state of the text view for testing purposes. * - * See https://reactnative.dev/docs/text.html#disabled + * See https://reactnative.dev/docs/text#disabled */ disabled?: ?boolean, /** * The highlight color of the text. * - * See https://reactnative.dev/docs/text.html#selectioncolor + * See https://reactnative.dev/docs/text#selectioncolor */ selectionColor?: ?string, @@ -177,7 +177,7 @@ export type TextProps = $ReadOnly<{| /** * Set text break strategy on Android. * - * See https://reactnative.dev/docs/text.html#textbreakstrategy + * See https://reactnative.dev/docs/text#textbreakstrategy */ textBreakStrategy?: ?('balanced' | 'highQuality' | 'simple'), @@ -189,14 +189,14 @@ export type TextProps = $ReadOnly<{| /** * Smallest possible scale a font can reach. * - * See https://reactnative.dev/docs/text.html#minimumfontscale + * See https://reactnative.dev/docs/text#minimumfontscale */ minimumFontScale?: ?number, /** * When `true`, no visual change is made when text is pressed down. * - * See https://reactnative.dev/docs/text.html#supperhighlighting + * See https://reactnative.dev/docs/text#supperhighlighting */ suppressHighlighting?: ?boolean, |}>; diff --git a/Libraries/Text/VirtualText/RCTVirtualTextShadowView.h b/Libraries/Text/VirtualText/RCTVirtualTextShadowView.h index bce9ea8693fb..eed172619f74 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextShadowView.h +++ b/Libraries/Text/VirtualText/RCTVirtualTextShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m b/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m index 1cf56b27aeda..e83bd8f03957 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m +++ b/Libraries/Text/VirtualText/RCTVirtualTextShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.h b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.h index 91d4f7892d60..2b388086ef96 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.h +++ b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m index 3b7c3d744274..ea452ae2058a 100644 --- a/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m +++ b/Libraries/Text/VirtualText/RCTVirtualTextViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TurboModule/RCTExport.js b/Libraries/TurboModule/RCTExport.js index d68194adb361..ff9e3c423b20 100644 --- a/Libraries/TurboModule/RCTExport.js +++ b/Libraries/TurboModule/RCTExport.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TurboModule/TurboModuleRegistry.js b/Libraries/TurboModule/TurboModuleRegistry.js index 9e2f762937cc..250069895739 100644 --- a/Libraries/TurboModule/TurboModuleRegistry.js +++ b/Libraries/TurboModule/TurboModuleRegistry.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TurboModule/samples/NativeSampleTurboModule.js b/Libraries/TurboModule/samples/NativeSampleTurboModule.js index 8b5b39eba188..5708e9b233f9 100644 --- a/Libraries/TurboModule/samples/NativeSampleTurboModule.js +++ b/Libraries/TurboModule/samples/NativeSampleTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TypeSafety/RCTConvertHelpers.h b/Libraries/TypeSafety/RCTConvertHelpers.h index 0b7144b9c8ea..75f751b96b17 100644 --- a/Libraries/TypeSafety/RCTConvertHelpers.h +++ b/Libraries/TypeSafety/RCTConvertHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TypeSafety/RCTConvertHelpers.mm b/Libraries/TypeSafety/RCTConvertHelpers.mm index cd79c41f6fec..24f7a54b8810 100644 --- a/Libraries/TypeSafety/RCTConvertHelpers.mm +++ b/Libraries/TypeSafety/RCTConvertHelpers.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TypeSafety/RCTTypeSafety.podspec b/Libraries/TypeSafety/RCTTypeSafety.podspec index 1c89f39789f7..198a0f09b41b 100644 --- a/Libraries/TypeSafety/RCTTypeSafety.podspec +++ b/Libraries/TypeSafety/RCTTypeSafety.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/Libraries/TypeSafety/RCTTypedModuleConstants.h b/Libraries/TypeSafety/RCTTypedModuleConstants.h index b3514c0521a7..2bf9037de4e8 100644 --- a/Libraries/TypeSafety/RCTTypedModuleConstants.h +++ b/Libraries/TypeSafety/RCTTypedModuleConstants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/TypeSafety/RCTTypedModuleConstants.mm b/Libraries/TypeSafety/RCTTypedModuleConstants.mm index 62a461406f5c..ad263b39f2c9 100644 --- a/Libraries/TypeSafety/RCTTypedModuleConstants.mm +++ b/Libraries/TypeSafety/RCTTypedModuleConstants.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Types/CodegenTypes.js b/Libraries/Types/CodegenTypes.js index 458cfe80ba88..ca43a6b01724 100644 --- a/Libraries/Types/CodegenTypes.js +++ b/Libraries/Types/CodegenTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Types/CoreEventTypes.js b/Libraries/Types/CoreEventTypes.js index a49b3b583ea4..de4e43dd4ff9 100644 --- a/Libraries/Types/CoreEventTypes.js +++ b/Libraries/Types/CoreEventTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Types/RootTagTypes.js b/Libraries/Types/RootTagTypes.js index 4fde211e5f02..4f715efca898 100644 --- a/Libraries/Types/RootTagTypes.js +++ b/Libraries/Types/RootTagTypes.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/UTFSequence.js b/Libraries/UTFSequence.js index dabcaff86662..653989215b19 100644 --- a/Libraries/UTFSequence.js +++ b/Libraries/UTFSequence.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/Appearance.js b/Libraries/Utilities/Appearance.js index ea4c26ac7b33..7610245e68d0 100644 --- a/Libraries/Utilities/Appearance.js +++ b/Libraries/Utilities/Appearance.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,11 +30,12 @@ type NativeAppearanceEventDefinitions = { }; if (NativeAppearance) { - const nativeEventEmitter = new NativeEventEmitter( - // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior - // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' ? null : NativeAppearance, - ); + const nativeEventEmitter = + new NativeEventEmitter( + // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior + // If you want to use the native module on other platforms, please remove this condition and test its behavior + Platform.OS !== 'ios' ? null : NativeAppearance, + ); nativeEventEmitter.addListener( 'appearanceChanged', (newAppearance: AppearancePreferences) => { diff --git a/Libraries/Utilities/BackHandler.android.js b/Libraries/Utilities/BackHandler.android.js index b4c14b1d783e..8162e8c7cd3e 100644 --- a/Libraries/Utilities/BackHandler.android.js +++ b/Libraries/Utilities/BackHandler.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,7 @@ type BackPressEventName = 'backPress' | 'hardwareBackPress'; const _backPressSubscriptions = []; -RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function() { +RCTDeviceEventEmitter.addListener(DEVICE_BACK_EVENT, function () { for (let i = _backPressSubscriptions.length - 1; i >= 0; i--) { if (_backPressSubscriptions[i]()) { return; @@ -65,7 +65,7 @@ type TBackHandler = {| ) => void, |}; const BackHandler: TBackHandler = { - exitApp: function(): void { + exitApp: function (): void { if (!NativeDeviceEventManager) { return; } @@ -78,7 +78,7 @@ const BackHandler: TBackHandler = { * * - `hardwareBackPress`: Fires when the Android hardware back button is pressed. */ - addEventListener: function( + addEventListener: function ( eventName: BackPressEventName, handler: () => ?boolean, ): {remove: () => void, ...} { @@ -93,7 +93,7 @@ const BackHandler: TBackHandler = { /** * Removes the event handler. */ - removeEventListener: function( + removeEventListener: function ( eventName: BackPressEventName, handler: () => ?boolean, ): void { diff --git a/Libraries/Utilities/BackHandler.ios.js b/Libraries/Utilities/BackHandler.ios.js index 2e1e5c4cd2a7..3cd03706467a 100644 --- a/Libraries/Utilities/BackHandler.ios.js +++ b/Libraries/Utilities/BackHandler.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/DebugEnvironment.js b/Libraries/Utilities/DebugEnvironment.js index 2d432b6658eb..8c7c3ec422d9 100644 --- a/Libraries/Utilities/DebugEnvironment.js +++ b/Libraries/Utilities/DebugEnvironment.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/DevSettings.js b/Libraries/Utilities/DevSettings.js index 651016a9b34f..4c2a85270240 100644 --- a/Libraries/Utilities/DevSettings.js +++ b/Libraries/Utilities/DevSettings.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/DeviceInfo.js b/Libraries/Utilities/DeviceInfo.js index 8274c109ff26..600bbc3266e4 100644 --- a/Libraries/Utilities/DeviceInfo.js +++ b/Libraries/Utilities/DeviceInfo.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/Dimensions.js b/Libraries/Utilities/Dimensions.js index f295e0fea256..e0e0a427ba7b 100644 --- a/Libraries/Utilities/Dimensions.js +++ b/Libraries/Utilities/Dimensions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/FeatureDetection.js b/Libraries/Utilities/FeatureDetection.js index 38324d7f202d..a83058d6936d 100644 --- a/Libraries/Utilities/FeatureDetection.js +++ b/Libraries/Utilities/FeatureDetection.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/GlobalPerformanceLogger.js b/Libraries/Utilities/GlobalPerformanceLogger.js index 66806926d5eb..cba68e154d94 100644 --- a/Libraries/Utilities/GlobalPerformanceLogger.js +++ b/Libraries/Utilities/GlobalPerformanceLogger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/HMRClient.js b/Libraries/Utilities/HMRClient.js index e1d8f56c49ab..253f96271711 100644 --- a/Libraries/Utilities/HMRClient.js +++ b/Libraries/Utilities/HMRClient.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -308,8 +308,8 @@ function dismissRedbox() { ) { NativeRedBox.dismiss(); } else { - const NativeExceptionsManager = require('../Core/NativeExceptionsManager') - .default; + const NativeExceptionsManager = + require('../Core/NativeExceptionsManager').default; NativeExceptionsManager && NativeExceptionsManager.dismissRedbox && NativeExceptionsManager.dismissRedbox(); diff --git a/Libraries/Utilities/HMRClientProdShim.js b/Libraries/Utilities/HMRClientProdShim.js index 02758582cdbc..4d36db2bc525 100644 --- a/Libraries/Utilities/HMRClientProdShim.js +++ b/Libraries/Utilities/HMRClientProdShim.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/JSDevSupportModule.js b/Libraries/Utilities/JSDevSupportModule.js index 396f1a2fb81d..c88df1f1dd3f 100644 --- a/Libraries/Utilities/JSDevSupportModule.js +++ b/Libraries/Utilities/JSDevSupportModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,13 +12,12 @@ import NativeJSDevSupport from './NativeJSDevSupport'; const ReactNative = require('../Renderer/shims/ReactNative'); const JSDevSupportModule = { - getJSHierarchy: function(tag: number) { + getJSHierarchy: function (tag: number) { if (NativeJSDevSupport) { const constants = NativeJSDevSupport.getConstants(); try { - const { - computeComponentStackForErrorReporting, - } = ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; + const {computeComponentStackForErrorReporting} = + ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; const componentStack = computeComponentStackForErrorReporting(tag); if (!componentStack) { NativeJSDevSupport.onFailure( diff --git a/Libraries/Utilities/LoadingView.android.js b/Libraries/Utilities/LoadingView.android.js index ae369ccf8604..03dd42d7907f 100644 --- a/Libraries/Utilities/LoadingView.android.js +++ b/Libraries/Utilities/LoadingView.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/LoadingView.ios.js b/Libraries/Utilities/LoadingView.ios.js index 0a0ebaeda02e..9654828cfa75 100644 --- a/Libraries/Utilities/LoadingView.ios.js +++ b/Libraries/Utilities/LoadingView.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/LoadingView.js b/Libraries/Utilities/LoadingView.js index 2a02730fc55d..b8951fdf5917 100644 --- a/Libraries/Utilities/LoadingView.js +++ b/Libraries/Utilities/LoadingView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/MatrixMath.js b/Libraries/Utilities/MatrixMath.js index d2d6421106b5..ac305dce1fd0 100755 --- a/Libraries/Utilities/MatrixMath.js +++ b/Libraries/Utilities/MatrixMath.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,11 +17,11 @@ const invariant = require('invariant'); * matrices, which are reusable. */ const MatrixMath = { - createIdentityMatrix: function() { + createIdentityMatrix: function () { return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; }, - createCopy: function(m) { + createCopy: function (m) { return [ m[0], m[1], @@ -42,7 +42,7 @@ const MatrixMath = { ]; }, - createOrthographic: function(left, right, bottom, top, near, far) { + createOrthographic: function (left, right, bottom, top, near, far) { const a = 2 / (right - left); const b = 2 / (top - bottom); const c = -2 / (far - near); @@ -54,7 +54,7 @@ const MatrixMath = { return [a, 0, 0, 0, 0, b, 0, 0, 0, 0, c, 0, tx, ty, tz, 1]; }, - createFrustum: function(left, right, bottom, top, near, far) { + createFrustum: function (left, right, bottom, top, near, far) { const r_width = 1 / (right - left); const r_height = 1 / (top - bottom); const r_depth = 1 / (near - far); @@ -73,7 +73,7 @@ const MatrixMath = { * * @param fovInRadians - field of view in radians */ - createPerspective: function(fovInRadians, aspect, near, far) { + createPerspective: function (fovInRadians, aspect, near, far) { const h = 1 / Math.tan(fovInRadians / 2); const r_depth = 1 / (near - far); const C = (far + near) * r_depth; @@ -81,41 +81,41 @@ const MatrixMath = { return [h / aspect, 0, 0, 0, 0, h, 0, 0, 0, 0, C, -1, 0, 0, D, 0]; }, - createTranslate2d: function(x, y) { + createTranslate2d: function (x, y) { const mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseTranslate2dCommand(mat, x, y); return mat; }, - reuseTranslate2dCommand: function(matrixCommand, x, y) { + reuseTranslate2dCommand: function (matrixCommand, x, y) { matrixCommand[12] = x; matrixCommand[13] = y; }, - reuseTranslate3dCommand: function(matrixCommand, x, y, z) { + reuseTranslate3dCommand: function (matrixCommand, x, y, z) { matrixCommand[12] = x; matrixCommand[13] = y; matrixCommand[14] = z; }, - createScale: function(factor) { + createScale: function (factor) { const mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseScaleCommand(mat, factor); return mat; }, - reuseScaleCommand: function(matrixCommand, factor) { + reuseScaleCommand: function (matrixCommand, factor) { matrixCommand[0] = factor; matrixCommand[5] = factor; }, - reuseScale3dCommand: function(matrixCommand, x, y, z) { + reuseScale3dCommand: function (matrixCommand, x, y, z) { matrixCommand[0] = x; matrixCommand[5] = y; matrixCommand[10] = z; }, - reusePerspectiveCommand: function(matrixCommand, p) { + reusePerspectiveCommand: function (matrixCommand, p) { matrixCommand[11] = -1 / p; }, @@ -131,14 +131,14 @@ const MatrixMath = { matrixCommand[10] = factor; }, - reuseRotateXCommand: function(matrixCommand, radians) { + reuseRotateXCommand: function (matrixCommand, radians) { matrixCommand[5] = Math.cos(radians); matrixCommand[6] = Math.sin(radians); matrixCommand[9] = -Math.sin(radians); matrixCommand[10] = Math.cos(radians); }, - reuseRotateYCommand: function(matrixCommand, amount) { + reuseRotateYCommand: function (matrixCommand, amount) { matrixCommand[0] = Math.cos(amount); matrixCommand[2] = -Math.sin(amount); matrixCommand[8] = Math.sin(amount); @@ -146,28 +146,28 @@ const MatrixMath = { }, // http://www.w3.org/TR/css3-transforms/#recomposing-to-a-2d-matrix - reuseRotateZCommand: function(matrixCommand, radians) { + reuseRotateZCommand: function (matrixCommand, radians) { matrixCommand[0] = Math.cos(radians); matrixCommand[1] = Math.sin(radians); matrixCommand[4] = -Math.sin(radians); matrixCommand[5] = Math.cos(radians); }, - createRotateZ: function(radians) { + createRotateZ: function (radians) { const mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateZCommand(mat, radians); return mat; }, - reuseSkewXCommand: function(matrixCommand, radians) { + reuseSkewXCommand: function (matrixCommand, radians) { matrixCommand[4] = Math.tan(radians); }, - reuseSkewYCommand: function(matrixCommand, radians) { + reuseSkewYCommand: function (matrixCommand, radians) { matrixCommand[1] = Math.tan(radians); }, - multiplyInto: function(out, a, b) { + multiplyInto: function (out, a, b) { const a00 = a[0], a01 = a[1], a02 = a[2], diff --git a/Libraries/Utilities/NativeAppearance.js b/Libraries/Utilities/NativeAppearance.js index 573bb96360a6..3188962b6acd 100644 --- a/Libraries/Utilities/NativeAppearance.js +++ b/Libraries/Utilities/NativeAppearance.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/NativeDevLoadingView.js b/Libraries/Utilities/NativeDevLoadingView.js index 8838f54d8da0..6865bd972662 100644 --- a/Libraries/Utilities/NativeDevLoadingView.js +++ b/Libraries/Utilities/NativeDevLoadingView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/NativeDevSplitBundleLoader.js b/Libraries/Utilities/NativeDevSplitBundleLoader.js index 5caa97a235a6..9c2563e6cfe9 100644 --- a/Libraries/Utilities/NativeDevSplitBundleLoader.js +++ b/Libraries/Utilities/NativeDevSplitBundleLoader.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/NativeDeviceInfo.js b/Libraries/Utilities/NativeDeviceInfo.js index 16c72c69544c..49af514c894c 100644 --- a/Libraries/Utilities/NativeDeviceInfo.js +++ b/Libraries/Utilities/NativeDeviceInfo.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/NativeJSDevSupport.js b/Libraries/Utilities/NativeJSDevSupport.js index da94a62d77cd..593472588883 100644 --- a/Libraries/Utilities/NativeJSDevSupport.js +++ b/Libraries/Utilities/NativeJSDevSupport.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/NativePlatformConstantsAndroid.js b/Libraries/Utilities/NativePlatformConstantsAndroid.js index afc0406dc98a..c688bae41a9b 100644 --- a/Libraries/Utilities/NativePlatformConstantsAndroid.js +++ b/Libraries/Utilities/NativePlatformConstantsAndroid.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/NativePlatformConstantsIOS.js b/Libraries/Utilities/NativePlatformConstantsIOS.js index 15055ca5e932..130193087f4b 100644 --- a/Libraries/Utilities/NativePlatformConstantsIOS.js +++ b/Libraries/Utilities/NativePlatformConstantsIOS.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/PerformanceLoggerContext.js b/Libraries/Utilities/PerformanceLoggerContext.js index 92b777880990..391a2981b6ef 100644 --- a/Libraries/Utilities/PerformanceLoggerContext.js +++ b/Libraries/Utilities/PerformanceLoggerContext.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,9 +19,8 @@ import type {IPerformanceLogger} from './createPerformanceLogger'; * should be available in every component. * See React docs about using Context: https://reactjs.org/docs/context.html */ -const PerformanceLoggerContext: React.Context = React.createContext( - GlobalPerformanceLogger, -); +const PerformanceLoggerContext: React.Context = + React.createContext(GlobalPerformanceLogger); if (__DEV__) { PerformanceLoggerContext.displayName = 'PerformanceLoggerContext'; } diff --git a/Libraries/Utilities/PixelRatio.js b/Libraries/Utilities/PixelRatio.js index 06813b3a6d49..e824de414875 100644 --- a/Libraries/Utilities/PixelRatio.js +++ b/Libraries/Utilities/PixelRatio.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/Platform.android.js b/Libraries/Utilities/Platform.android.js index 679dbb2a3a3f..5ef0b399e5b8 100644 --- a/Libraries/Utilities/Platform.android.js +++ b/Libraries/Utilities/Platform.android.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/Platform.ios.js b/Libraries/Utilities/Platform.ios.js index f7ac62a5e142..c2eccca8fa11 100644 --- a/Libraries/Utilities/Platform.ios.js +++ b/Libraries/Utilities/Platform.ios.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/PolyfillFunctions.js b/Libraries/Utilities/PolyfillFunctions.js index 9dd136f593f5..b09def25782e 100644 --- a/Libraries/Utilities/PolyfillFunctions.js +++ b/Libraries/Utilities/PolyfillFunctions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/RCTLog.js b/Libraries/Utilities/RCTLog.js index 78679c1f4791..caf7e7281eb8 100644 --- a/Libraries/Utilities/RCTLog.js +++ b/Libraries/Utilities/RCTLog.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/ReactNativeTestTools.js b/Libraries/Utilities/ReactNativeTestTools.js index 1f4e7cd80210..c73267b905dd 100644 --- a/Libraries/Utilities/ReactNativeTestTools.js +++ b/Libraries/Utilities/ReactNativeTestTools.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,19 +21,19 @@ const shallowRenderer = new ShallowRenderer(); import type {ReactTestRenderer as ReactTestRendererType} from 'react-test-renderer'; -// $FlowFixMe[value-as-type] export type ReactTestInstance = $PropertyType; export type Predicate = (node: ReactTestInstance) => boolean; type $ReturnType = $Call<((...A) => Ret) => Ret, Fn>; -/* $FlowFixMe[prop-missing] (>=0.125.1 site=react_native_fb) This comment - * suppresses an error found when Flow v0.125.1 was deployed. To see the error, - * delete this comment and run Flow. */ /* $FlowFixMe[value-as-type] (>=0.125.1 site=react_native_fb) This comment * suppresses an error found when Flow v0.125.1 was deployed. To see the error, * delete this comment and run Flow. */ -export type ReactTestRendererJSON = $ReturnType; +export type ReactTestRendererJSON = + /* $FlowFixMe[prop-missing] (>=0.125.1 site=react_native_fb) This comment + * suppresses an error found when Flow v0.125.1 was deployed. To see the error, + * delete this comment and run Flow. */ + $ReturnType; const { Switch, @@ -87,7 +87,6 @@ function enter(instance: ReactTestInstance, text: string) { // Returns null if there is no error, otherwise returns an error message string. function maximumDepthError( - // $FlowFixMe[value-as-type] tree: ReactTestRendererType, maxDepthLimit: number, ): ?string { @@ -179,7 +178,6 @@ function renderAndEnforceStrictMode(element: React.Node): any { return renderWithStrictMode(element); } -// $FlowFixMe[value-as-type] function renderWithStrictMode(element: React.Node): ReactTestRendererType { const WorkAroundBugWithStrictModeInTestRenderer = prps => prps.children; const StrictMode = (React: $FlowFixMe).StrictMode; @@ -202,10 +200,8 @@ function tap(instance: ReactTestInstance) { } else if ( touchable?.props?.onStartShouldSetResponder?.testOnly_pressabilityConfig ) { - const { - onPress, - disabled, - } = touchable.props.onStartShouldSetResponder.testOnly_pressabilityConfig(); + const {onPress, disabled} = + touchable.props.onStartShouldSetResponder.testOnly_pressabilityConfig(); if (!disabled) { onPress({nativeEvent: {}}); } diff --git a/Libraries/Utilities/SceneTracker.js b/Libraries/Utilities/SceneTracker.js index 23b0c7dcae39..6dc1bbbd47b3 100644 --- a/Libraries/Utilities/SceneTracker.js +++ b/Libraries/Utilities/SceneTracker.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,9 +26,10 @@ const SceneTracker = { return _activeScene; }, - addActiveSceneChangedListener( - callback: (scene: Scene) => void, - ): {remove: () => void, ...} { + addActiveSceneChangedListener(callback: (scene: Scene) => void): { + remove: () => void, + ... + } { _listeners.push(callback); return { remove: () => { diff --git a/Libraries/Utilities/__mocks__/BackHandler.js b/Libraries/Utilities/__mocks__/BackHandler.js index b90bf09d870f..f0c6a12d13a5 100644 --- a/Libraries/Utilities/__mocks__/BackHandler.js +++ b/Libraries/Utilities/__mocks__/BackHandler.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,7 +14,7 @@ const _backPressSubscriptions = new Set(); const BackHandler = { exitApp: jest.fn(), - addEventListener: function( + addEventListener: function ( eventName: BackPressEventName, handler: () => ?boolean, ): {remove: () => void} { @@ -24,14 +24,14 @@ const BackHandler = { }; }, - removeEventListener: function( + removeEventListener: function ( eventName: BackPressEventName, handler: () => ?boolean, ): void { _backPressSubscriptions.delete(handler); }, - mockPressBack: function() { + mockPressBack: function () { let invokeDefault = true; const subscriptions = [..._backPressSubscriptions].reverse(); for (let i = 0; i < subscriptions.length; ++i) { diff --git a/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js b/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js index 3fefaf5e3d06..37b5d5269d3d 100644 --- a/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js +++ b/Libraries/Utilities/__mocks__/GlobalPerformanceLogger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__mocks__/PixelRatio.js b/Libraries/Utilities/__mocks__/PixelRatio.js index 90c0de2041bd..2a74fb483e71 100644 --- a/Libraries/Utilities/__mocks__/PixelRatio.js +++ b/Libraries/Utilities/__mocks__/PixelRatio.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/DeviceInfo-test.js b/Libraries/Utilities/__tests__/DeviceInfo-test.js index 8cc9c224461a..489c2afbfc7b 100644 --- a/Libraries/Utilities/__tests__/DeviceInfo-test.js +++ b/Libraries/Utilities/__tests__/DeviceInfo-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/Dimensions-test.js b/Libraries/Utilities/__tests__/Dimensions-test.js index b6d68ce29d57..35a0bc7f8754 100644 --- a/Libraries/Utilities/__tests__/Dimensions-test.js +++ b/Libraries/Utilities/__tests__/Dimensions-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/MatrixMath-test.js b/Libraries/Utilities/__tests__/MatrixMath-test.js index f6b62319946e..5fd824a8ce12 100644 --- a/Libraries/Utilities/__tests__/MatrixMath-test.js +++ b/Libraries/Utilities/__tests__/MatrixMath-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,22 +24,7 @@ describe('MatrixMath', () => { it('decomposes a 4x4 matrix to produce accurate Z-axis angles', () => { expect( MatrixMath.decomposeMatrix([ - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 1, + 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, ]).rotationDegrees, ).toEqual([0, 0, 0]); @@ -140,17 +125,13 @@ describe('MatrixMath', () => { mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateYCommand(mat, degreesToRadians(222)); expect(MatrixMath.decomposeMatrix(mat).rotationDegrees).toEqual([ - 0, - -138, - 0, + 0, -138, 0, ]); mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateYCommand(mat, degreesToRadians(270)); expect(MatrixMath.decomposeMatrix(mat).rotationDegrees).toEqual([ - 0, - -90, - 0, + 0, -90, 0, ]); mat = MatrixMath.createIdentityMatrix(); @@ -173,17 +154,13 @@ describe('MatrixMath', () => { mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateXCommand(mat, degreesToRadians(222)); expect(MatrixMath.decomposeMatrix(mat).rotationDegrees).toEqual([ - -138, - 0, - 0, + -138, 0, 0, ]); mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseRotateXCommand(mat, degreesToRadians(270)); expect(MatrixMath.decomposeMatrix(mat).rotationDegrees).toEqual([ - -90, - 0, - 0, + -90, 0, 0, ]); mat = MatrixMath.createIdentityMatrix(); diff --git a/Libraries/Utilities/__tests__/PerformanceLogger-test.js b/Libraries/Utilities/__tests__/PerformanceLogger-test.js index 549be83d1da7..08940a9a8008 100644 --- a/Libraries/Utilities/__tests__/PerformanceLogger-test.js +++ b/Libraries/Utilities/__tests__/PerformanceLogger-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/PixelRatio-test.js b/Libraries/Utilities/__tests__/PixelRatio-test.js index 35ebe26a829b..cfac4649c601 100644 --- a/Libraries/Utilities/__tests__/PixelRatio-test.js +++ b/Libraries/Utilities/__tests__/PixelRatio-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/Platform-test.js b/Libraries/Utilities/__tests__/Platform-test.js index 2dd11b0edcd9..8871ff5a9fa6 100644 --- a/Libraries/Utilities/__tests__/Platform-test.js +++ b/Libraries/Utilities/__tests__/Platform-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/SceneTracker-test.js b/Libraries/Utilities/__tests__/SceneTracker-test.js index 909da1685aaf..636a8de8f217 100644 --- a/Libraries/Utilities/__tests__/SceneTracker-test.js +++ b/Libraries/Utilities/__tests__/SceneTracker-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ const SceneTracker = require('../SceneTracker'); -describe('setActiveScene', function() { - it('can handle multiple listeners and unsubscribe', function() { +describe('setActiveScene', function () { + it('can handle multiple listeners and unsubscribe', function () { const listeners = [jest.fn(), jest.fn(), jest.fn()]; const subscriptions = listeners.map(listener => SceneTracker.addActiveSceneChangedListener(listener), diff --git a/Libraries/Utilities/__tests__/binaryToBase64-test.js b/Libraries/Utilities/__tests__/binaryToBase64-test.js index ce3991f000b5..691f3c63b27f 100644 --- a/Libraries/Utilities/__tests__/binaryToBase64-test.js +++ b/Libraries/Utilities/__tests__/binaryToBase64-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js b/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js index ef5cc10d42d3..86f55af3f2e6 100644 --- a/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js +++ b/Libraries/Utilities/__tests__/buildStyleInterpolator-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ const buildStyleInterpolator = require('../buildStyleInterpolator'); -const validateEmpty = function(interpolator, value, validator) { +const validateEmpty = function (interpolator, value, validator) { const emptyObject = {}; let changed = interpolator(emptyObject, value); validator(emptyObject); @@ -20,8 +20,8 @@ const validateEmpty = function(interpolator, value, validator) { changed = interpolator(emptyObject, value); expect(changed).toBe(false); }; -describe('buildStyleInterpolator', function() { - it('should linearly interpolate without extrapolating', function() { +describe('buildStyleInterpolator', function () { + it('should linearly interpolate without extrapolating', function () { const testAnim = { opacity: { from: 100, @@ -45,35 +45,35 @@ describe('buildStyleInterpolator', function() { }, }; const interpolator = buildStyleInterpolator(testAnim); - validateEmpty(interpolator, 0, function(res) { + validateEmpty(interpolator, 0, function (res) { expect(res).toEqual({ opacity: 100, left: 200, top: 23.5, }); }); - validateEmpty(interpolator, 1, function(res) { + validateEmpty(interpolator, 1, function (res) { expect(res).toEqual({ opacity: 200, left: 300, top: 23.5, }); }); - validateEmpty(interpolator, -0.1, function(res) { + validateEmpty(interpolator, -0.1, function (res) { expect(res).toEqual({ opacity: 100, left: 200, top: 23.5, }); }); - validateEmpty(interpolator, 1.1, function(res) { + validateEmpty(interpolator, 1.1, function (res) { expect(res).toEqual({ opacity: 200, left: 300, top: 23.5, }); }); - validateEmpty(interpolator, 0.5, function(res) { + validateEmpty(interpolator, 0.5, function (res) { expect(res).toEqual({ opacity: 150, left: 250, @@ -81,7 +81,7 @@ describe('buildStyleInterpolator', function() { }); }); }); - it('should linearly interpolate with extrapolating', function() { + it('should linearly interpolate with extrapolating', function () { const testAnim = { opacity: { from: 100, @@ -107,35 +107,35 @@ describe('buildStyleInterpolator', function() { }, }; const interpolator = buildStyleInterpolator(testAnim); - validateEmpty(interpolator, 0, function(res) { + validateEmpty(interpolator, 0, function (res) { expect(res).toEqual({ opacity: 100, left: 200, top: 23.5, }); }); - validateEmpty(interpolator, 1, function(res) { + validateEmpty(interpolator, 1, function (res) { expect(res).toEqual({ opacity: 200, left: 300, top: 23.5, }); }); - validateEmpty(interpolator, -0.1, function(res) { + validateEmpty(interpolator, -0.1, function (res) { expect(res).toEqual({ opacity: 90, left: 190, top: 23.5, }); }); - validateEmpty(interpolator, 1.1, function(res) { + validateEmpty(interpolator, 1.1, function (res) { expect(res).toEqual({ opacity: 210, left: 310, top: 23.5, }); }); - validateEmpty(interpolator, 0.5, function(res) { + validateEmpty(interpolator, 0.5, function (res) { expect(res).toEqual({ opacity: 150, left: 250, @@ -143,7 +143,7 @@ describe('buildStyleInterpolator', function() { }); }); }); - it('should round accordingly', function() { + it('should round accordingly', function () { const testAnim = { opacity: { from: 0, @@ -156,38 +156,38 @@ describe('buildStyleInterpolator', function() { }, }; const interpolator = buildStyleInterpolator(testAnim); - validateEmpty(interpolator, 0, function(res) { + validateEmpty(interpolator, 0, function (res) { expect(res).toEqual({ opacity: 0, }); }); - validateEmpty(interpolator, 0.5, function(res) { + validateEmpty(interpolator, 0.5, function (res) { expect(res).toEqual({ opacity: 0.5, }); }); - validateEmpty(interpolator, 0.4, function(res) { + validateEmpty(interpolator, 0.4, function (res) { expect(res).toEqual({ opacity: 0.5, }); }); - validateEmpty(interpolator, 0.26, function(res) { + validateEmpty(interpolator, 0.26, function (res) { expect(res).toEqual({ opacity: 0.5, }); }); - validateEmpty(interpolator, 0.74, function(res) { + validateEmpty(interpolator, 0.74, function (res) { expect(res).toEqual({ opacity: 0.5, }); }); - validateEmpty(interpolator, 0.76, function(res) { + validateEmpty(interpolator, 0.76, function (res) { expect(res).toEqual({ opacity: 1.0, }); }); }); - it('should detect changes correctly', function() { + it('should detect changes correctly', function () { const testAnim = { opacity: { from: 0, @@ -228,7 +228,7 @@ describe('buildStyleInterpolator', function() { }); expect(res).toBe(false); }); - it('should handle identity', function() { + it('should handle identity', function () { const testAnim = { opacity: { type: 'identity', @@ -249,7 +249,7 @@ describe('buildStyleInterpolator', function() { }); expect(res).toBe(false); }); - it('should translate', function() { + it('should translate', function () { const testAnim = { transformTranslate: { from: {x: 1, y: 10, z: 100}, @@ -271,7 +271,7 @@ describe('buildStyleInterpolator', function() { }); expect(res).toBe(true); }); - it('should scale', function() { + it('should scale', function () { const testAnim = { transformScale: { from: {x: 1, y: 10, z: 100}, @@ -293,7 +293,7 @@ describe('buildStyleInterpolator', function() { }); expect(res).toBe(true); }); - it('should combine scale and translate', function() { + it('should combine scale and translate', function () { const testAnim = { transformScale: { from: {x: 1, y: 10, z: 100}, @@ -322,7 +322,7 @@ describe('buildStyleInterpolator', function() { }); expect(res).toBe(true); }); - it('should step', function() { + it('should step', function () { const testAnim = { opacity: { threshold: 13, diff --git a/Libraries/Utilities/__tests__/clamp-test.js b/Libraries/Utilities/__tests__/clamp-test.js index 210d4aca87f6..72a4156a7a03 100644 --- a/Libraries/Utilities/__tests__/clamp-test.js +++ b/Libraries/Utilities/__tests__/clamp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/codegenNativeComponent-test.js b/Libraries/Utilities/__tests__/codegenNativeComponent-test.js index f9acf7fe816e..357aa838bdfb 100644 --- a/Libraries/Utilities/__tests__/codegenNativeComponent-test.js +++ b/Libraries/Utilities/__tests__/codegenNativeComponent-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js b/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js index b813f2fbbd53..8fb77d073981 100644 --- a/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js +++ b/Libraries/Utilities/__tests__/deepFreezeAndThrowOnMutationInDev-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,7 +10,7 @@ const deepFreezeAndThrowOnMutationInDev = require('../deepFreezeAndThrowOnMutationInDev'); -describe('deepFreezeAndThrowOnMutationInDev', function() { +describe('deepFreezeAndThrowOnMutationInDev', function () { it('should be a noop on non object values', () => { __DEV__ = true; expect(() => deepFreezeAndThrowOnMutationInDev('')).not.toThrow(); diff --git a/Libraries/Utilities/__tests__/groupByEveryN-test.js b/Libraries/Utilities/__tests__/groupByEveryN-test.js index e84d880fc933..5acfb42799f8 100644 --- a/Libraries/Utilities/__tests__/groupByEveryN-test.js +++ b/Libraries/Utilities/__tests__/groupByEveryN-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/infoLog-test.js b/Libraries/Utilities/__tests__/infoLog-test.js index dd7909a50828..8fe6f8fdd5cd 100644 --- a/Libraries/Utilities/__tests__/infoLog-test.js +++ b/Libraries/Utilities/__tests__/infoLog-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/logError-test.js b/Libraries/Utilities/__tests__/logError-test.js index 09c867b7d25d..4ee79cec2885 100644 --- a/Libraries/Utilities/__tests__/logError-test.js +++ b/Libraries/Utilities/__tests__/logError-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/mapWithSeparator-test.js b/Libraries/Utilities/__tests__/mapWithSeparator-test.js index 1adbc2bcb152..9c9022455151 100644 --- a/Libraries/Utilities/__tests__/mapWithSeparator-test.js +++ b/Libraries/Utilities/__tests__/mapWithSeparator-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,10 +17,10 @@ describe('mapWithSeparator', () => { const array = [1, 2, 3]; const result = mapWithSeparator( array, - function(value) { + function (value) { return value * 2; }, - function() { + function () { return 0; }, ); @@ -31,10 +31,10 @@ describe('mapWithSeparator', () => { const array = [1, 2, 3]; const result = mapWithSeparator( array, - function(value, index) { + function (value, index) { return index; }, - function(index) { + function (index) { return index; }, ); @@ -45,10 +45,10 @@ describe('mapWithSeparator', () => { const array = [3, 2, 1]; const result = mapWithSeparator( array, - function(value, index, arr) { + function (value, index, arr) { return arr[index]; }, - function(index) { + function (index) { return index; }, ); @@ -59,10 +59,10 @@ describe('mapWithSeparator', () => { const array = []; const result = mapWithSeparator( array, - function(value) { + function (value) { return value * 2; }, - function() { + function () { return 0; }, ); diff --git a/Libraries/Utilities/__tests__/mergeIntoFast-test.js b/Libraries/Utilities/__tests__/mergeIntoFast-test.js index 21753997b6a5..8cd93030105a 100644 --- a/Libraries/Utilities/__tests__/mergeIntoFast-test.js +++ b/Libraries/Utilities/__tests__/mergeIntoFast-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/setAndForwardRef-test.js b/Libraries/Utilities/__tests__/setAndForwardRef-test.js index 14da769dbf24..882b06889b58 100644 --- a/Libraries/Utilities/__tests__/setAndForwardRef-test.js +++ b/Libraries/Utilities/__tests__/setAndForwardRef-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/stringifySafe-test.js b/Libraries/Utilities/__tests__/stringifySafe-test.js index f6cb307cf223..0107f7179d1e 100644 --- a/Libraries/Utilities/__tests__/stringifySafe-test.js +++ b/Libraries/Utilities/__tests__/stringifySafe-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ describe('stringifySafe', () => { }); it('stringifySafe stringifies function values', () => { - expect(stringifySafe(function() {})).toEqual('function () {}'); + expect(stringifySafe(function () {})).toEqual('function () {}'); }); it('stringifySafe stringifies non-circular objects', () => { diff --git a/Libraries/Utilities/__tests__/truncate-test.js b/Libraries/Utilities/__tests__/truncate-test.js index 1644d0879599..0167a161cd1d 100644 --- a/Libraries/Utilities/__tests__/truncate-test.js +++ b/Libraries/Utilities/__tests__/truncate-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/__tests__/useMergeRefs-test.js b/Libraries/Utilities/__tests__/useMergeRefs-test.js index 73627f3ee70f..558500f294a0 100644 --- a/Libraries/Utilities/__tests__/useMergeRefs-test.js +++ b/Libraries/Utilities/__tests__/useMergeRefs-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -66,9 +66,11 @@ function mockRefRegistry(): { } { const registry = []; return { - mockCallbackRef: (name: string): (T => mixed) => current => { - registry.push({[name]: TestViewInstance.fromValue(current)}); - }, + mockCallbackRef: + (name: string): (T => mixed) => + current => { + registry.push({[name]: TestViewInstance.fromValue(current)}); + }, mockObjectRef: (name: string): {current: T, ...} => ({ // $FlowIgnore[unsafe-getters-setters] - Intentional. set current(current) { diff --git a/Libraries/Utilities/__tests__/useRefEffect-test.js b/Libraries/Utilities/__tests__/useRefEffect-test.js index 8204289e71ab..dc5bb882084a 100644 --- a/Libraries/Utilities/__tests__/useRefEffect-test.js +++ b/Libraries/Utilities/__tests__/useRefEffect-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,20 @@ import {act, create} from 'react-test-renderer'; /** * TestView provide a component execution environment to test hooks. */ -function TestView({childKey = null, effect}) { +function TestView({ + childKey = null, + effect, +}: + | $FlowFixMe + | $TEMPORARY$object<{ + childKey: $TEMPORARY$string<'bar'>, + effect: () => () => void, + }> + | $TEMPORARY$object<{childKey: $TEMPORARY$string<'foo'>, effect: () => void}> + | $TEMPORARY$object<{ + childKey: $TEMPORARY$string<'foo'>, + effect: () => () => void, + }>) { const ref = useRefEffect(effect); return ; } diff --git a/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js b/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js index 43a507335d39..1bef8811ac1d 100644 --- a/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js +++ b/Libraries/Utilities/__tests__/verifyComponentAttributeEquivalence-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ jest.dontMock('../verifyComponentAttributeEquivalence'); -const verifyComponentAttributeEquivalence = require('../verifyComponentAttributeEquivalence') - .default; +const verifyComponentAttributeEquivalence = + require('../verifyComponentAttributeEquivalence').default; const TestComponentNativeViewConfig = { uiViewClassName: 'TestComponent', diff --git a/Libraries/Utilities/__tests__/warnOnce-test.js b/Libraries/Utilities/__tests__/warnOnce-test.js index f37d8955d5af..b9bca0d7b2b3 100644 --- a/Libraries/Utilities/__tests__/warnOnce-test.js +++ b/Libraries/Utilities/__tests__/warnOnce-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/binaryToBase64.js b/Libraries/Utilities/binaryToBase64.js index 8ae743553b75..ad136a23eabe 100644 --- a/Libraries/Utilities/binaryToBase64.js +++ b/Libraries/Utilities/binaryToBase64.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/buildStyleInterpolator.js b/Libraries/Utilities/buildStyleInterpolator.js index ed86a32df6bc..a557da1129b3 100644 --- a/Libraries/Utilities/buildStyleInterpolator.js +++ b/Libraries/Utilities/buildStyleInterpolator.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,7 @@ const InitialOperationField = { }; const InterpolateMatrix = { - transformScale: function(mat, x, y, z) { + transformScale: function (mat, x, y, z) { mat[0] = mat[0] * x; mat[1] = mat[1] * x; mat[2] = mat[2] * x; @@ -33,7 +33,7 @@ const InterpolateMatrix = { mat[10] = mat[10] * z; mat[11] = mat[11] * z; }, - transformTranslate: function(mat, x, y, z) { + transformTranslate: function (mat, x, y, z) { mat[12] = mat[0] * x + mat[4] * y + mat[8] * z + mat[12]; mat[13] = mat[1] * x + mat[5] * y + mat[9] * z + mat[13]; mat[14] = mat[2] * x + mat[6] * y + mat[10] * z + mat[14]; @@ -41,7 +41,7 @@ const InterpolateMatrix = { }, }; -const computeNextValLinear = function(anim, from, to, value) { +const computeNextValLinear = function (anim, from, to, value) { const hasRoundRatio = 'round' in anim; const roundRatio = anim.round; let ratio = (value - anim.min) / (anim.max - anim.min); @@ -58,11 +58,11 @@ const computeNextValLinear = function(anim, from, to, value) { return nextVal; }; -const computeNextValLinearScalar = function(anim, value) { +const computeNextValLinearScalar = function (anim, value) { return computeNextValLinear(anim, anim.from, anim.to, value); }; -const setNextValAndDetectChange = function(result, name, nextVal, didChange) { +const setNextValAndDetectChange = function (result, name, nextVal, didChange) { if (!didChange) { const prevVal = result[name]; result[name] = nextVal; @@ -73,7 +73,7 @@ const setNextValAndDetectChange = function(result, name, nextVal, didChange) { return didChange; }; -const initIdentity = function(mat) { +const initIdentity = function (mat) { mat[0] = 1; mat[1] = 0; mat[2] = 0; @@ -92,7 +92,7 @@ const initIdentity = function(mat) { mat[15] = 1; }; -const computeNextMatrixOperationField = function( +const computeNextMatrixOperationField = function ( anim, name, dim, @@ -106,7 +106,7 @@ const computeNextMatrixOperationField = function( } }; -const computeTransform = function( +const computeTransform = function ( anim, name, value, @@ -169,7 +169,7 @@ const computeTransform = function( * @return {function} Function accepting style object, that mutates that style * object and returns a boolean describing if any update was actually applied. */ -const buildStyleInterpolator = function(anims) { +const buildStyleInterpolator = function (anims) { function styleInterpolator(result, value) { let didChange = false; let didMatrix = false; diff --git a/Libraries/Utilities/clamp.js b/Libraries/Utilities/clamp.js index 1531f828a1f8..7bed6157516c 100644 --- a/Libraries/Utilities/clamp.js +++ b/Libraries/Utilities/clamp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/codegenNativeCommands.js b/Libraries/Utilities/codegenNativeCommands.js index 2de29751de47..fd13a9fc04c4 100644 --- a/Libraries/Utilities/codegenNativeCommands.js +++ b/Libraries/Utilities/codegenNativeCommands.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/codegenNativeComponent.js b/Libraries/Utilities/codegenNativeComponent.js index 129de1ad44ad..b8123ddfcef2 100644 --- a/Libraries/Utilities/codegenNativeComponent.js +++ b/Libraries/Utilities/codegenNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -43,8 +43,9 @@ function codegenNativeComponent( componentNameInUse = options.paperComponentNameDeprecated; } else { throw new Error( - `Failed to find native component for either ${componentName} or ${options.paperComponentNameDeprecated ?? - '(unknown)'}`, + `Failed to find native component for either ${componentName} or ${ + options.paperComponentNameDeprecated ?? '(unknown)' + }`, ); } } diff --git a/Libraries/Utilities/createPerformanceLogger.js b/Libraries/Utilities/createPerformanceLogger.js index e522647aa041..82307f47f206 100644 --- a/Libraries/Utilities/createPerformanceLogger.js +++ b/Libraries/Utilities/createPerformanceLogger.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js b/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js index 54be3c4c0380..e251d5de8577 100644 --- a/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js +++ b/Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -70,7 +70,7 @@ function deepFreezeAndThrowOnMutationInDev>( return object; } -function throwOnImmutableMutation(key, value) { +function throwOnImmutableMutation(key: empty, value) { throw Error( 'You attempted to set the key `' + key + @@ -81,7 +81,7 @@ function throwOnImmutableMutation(key, value) { ); } -function identity(value) { +function identity(value: mixed) { return value; } diff --git a/Libraries/Utilities/defineLazyObjectProperty.js b/Libraries/Utilities/defineLazyObjectProperty.js index dc663716420c..31e94f282686 100644 --- a/Libraries/Utilities/defineLazyObjectProperty.js +++ b/Libraries/Utilities/defineLazyObjectProperty.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/deprecatedPropType.js b/Libraries/Utilities/deprecatedPropType.js index 0a0fc69aab2a..256fe5b04f44 100644 --- a/Libraries/Utilities/deprecatedPropType.js +++ b/Libraries/Utilities/deprecatedPropType.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/differ/__tests__/deepDiffer-test.js b/Libraries/Utilities/differ/__tests__/deepDiffer-test.js index d1a35a20589a..cc6672bb13cb 100644 --- a/Libraries/Utilities/differ/__tests__/deepDiffer-test.js +++ b/Libraries/Utilities/differ/__tests__/deepDiffer-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ const deepDiffer = require('../deepDiffer'); -describe('deepDiffer', function() { +describe('deepDiffer', function () { it('should diff primitives of the same type', () => { expect(deepDiffer(1, 2)).toBe(true); expect(deepDiffer(42, 42)).toBe(false); diff --git a/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js b/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js index 26cc35ce3f5b..b145af27307f 100644 --- a/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js +++ b/Libraries/Utilities/differ/__tests__/matricesDiffer-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ const matricesDiffer = require('../matricesDiffer'); -describe('matricesDiffer', function() { +describe('matricesDiffer', function () { it('diffs matrices with single element', () => { var x = [1]; var y = [2]; diff --git a/Libraries/Utilities/differ/deepDiffer.js b/Libraries/Utilities/differ/deepDiffer.js index ff8bd4628d13..c186b6c38dd4 100644 --- a/Libraries/Utilities/differ/deepDiffer.js +++ b/Libraries/Utilities/differ/deepDiffer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ function unstable_setLogListeners(listeners: ?LogListeners) { /* * @returns {bool} true if different, false if equal */ -const deepDiffer = function( +const deepDiffer = function ( one: any, two: any, maxDepthOrOptions: Options | number = -1, diff --git a/Libraries/Utilities/differ/insetsDiffer.js b/Libraries/Utilities/differ/insetsDiffer.js index 48aa7cac3c80..4ec01330fbb5 100644 --- a/Libraries/Utilities/differ/insetsDiffer.js +++ b/Libraries/Utilities/differ/insetsDiffer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ const dummyInsets = { bottom: undefined, }; -const insetsDiffer = function(one: Inset, two: Inset): boolean { +const insetsDiffer = function (one: Inset, two: Inset): boolean { one = one || dummyInsets; two = two || dummyInsets; return ( diff --git a/Libraries/Utilities/differ/matricesDiffer.js b/Libraries/Utilities/differ/matricesDiffer.js index 1726ad361e37..0abbe898f524 100644 --- a/Libraries/Utilities/differ/matricesDiffer.js +++ b/Libraries/Utilities/differ/matricesDiffer.js @@ -1,10 +1,11 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format + * @flow strict */ 'use strict'; @@ -18,7 +19,10 @@ * @param {MatrixMath.Matrix} two Second matrix. * @return {boolean} Whether or not the two matrices differ. */ -const matricesDiffer = function(one, two) { +const matricesDiffer = function ( + one: ?Array, + two: ?Array, +): boolean { if (one === two) { return false; } diff --git a/Libraries/Utilities/differ/pointsDiffer.js b/Libraries/Utilities/differ/pointsDiffer.js index 28d94a3b7064..2039b49511fc 100644 --- a/Libraries/Utilities/differ/pointsDiffer.js +++ b/Libraries/Utilities/differ/pointsDiffer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,7 @@ type Point = { const dummyPoint = {x: undefined, y: undefined}; -const pointsDiffer = function(one: ?Point, two: ?Point): boolean { +const pointsDiffer = function (one: ?Point, two: ?Point): boolean { one = one || dummyPoint; two = two || dummyPoint; return one !== two && (one.x !== two.x || one.y !== two.y); diff --git a/Libraries/Utilities/differ/sizesDiffer.js b/Libraries/Utilities/differ/sizesDiffer.js index 63ab71d32437..a4c3a1fb3d06 100644 --- a/Libraries/Utilities/differ/sizesDiffer.js +++ b/Libraries/Utilities/differ/sizesDiffer.js @@ -1,20 +1,26 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @flow strict * @format */ 'use strict'; const dummySize = {width: undefined, height: undefined}; +type Size = {width: ?number, height: ?number}; -const sizesDiffer = function(one, two) { - one = one || dummySize; - two = two || dummySize; - return one !== two && (one.width !== two.width || one.height !== two.height); +const sizesDiffer = function (one: Size, two: Size): boolean { + const defaultedOne = one || dummySize; + const defaultedTwo = two || dummySize; + return ( + defaultedOne !== defaultedTwo && + (defaultedOne.width !== defaultedTwo.width || + defaultedOne.height !== defaultedTwo.height) + ); }; module.exports = sizesDiffer; diff --git a/Libraries/Utilities/dismissKeyboard.js b/Libraries/Utilities/dismissKeyboard.js index 16625a98894d..fd14c37bdc4a 100644 --- a/Libraries/Utilities/dismissKeyboard.js +++ b/Libraries/Utilities/dismissKeyboard.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/groupByEveryN.js b/Libraries/Utilities/groupByEveryN.js index cf9d50143a0b..51489ec0592e 100644 --- a/Libraries/Utilities/groupByEveryN.js +++ b/Libraries/Utilities/groupByEveryN.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/infoLog.js b/Libraries/Utilities/infoLog.js index 6cac4bd149bc..6cb6df8d4149 100644 --- a/Libraries/Utilities/infoLog.js +++ b/Libraries/Utilities/infoLog.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/logError.js b/Libraries/Utilities/logError.js index 45252c6d0f63..9b79f1de2765 100644 --- a/Libraries/Utilities/logError.js +++ b/Libraries/Utilities/logError.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,7 +15,7 @@ * `console.error` as a failure callback - it's not properly bound. If passes an * `Error` object, it will print the message and stack. */ -const logError = function(...args: $ReadOnlyArray) { +const logError = function (...args: $ReadOnlyArray) { if (args.length === 1 && args[0] instanceof Error) { const err = args[0]; console.error('Error: "' + err.message + '". Stack:\n' + err.stack); diff --git a/Libraries/Utilities/mapWithSeparator.js b/Libraries/Utilities/mapWithSeparator.js index ea9004b05483..e611c6b94eba 100644 --- a/Libraries/Utilities/mapWithSeparator.js +++ b/Libraries/Utilities/mapWithSeparator.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/mergeIntoFast.js b/Libraries/Utilities/mergeIntoFast.js index 663f897ae5d5..2881aae539a1 100644 --- a/Libraries/Utilities/mergeIntoFast.js +++ b/Libraries/Utilities/mergeIntoFast.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,7 @@ * @param {object} one Object to assign to. * @param {object} two Object to assign from. */ -const mergeIntoFast = function(one: Object, two: Object): void { +const mergeIntoFast = function (one: Object, two: Object): void { for (const keyTwo in two) { one[keyTwo] = two[keyTwo]; } diff --git a/Libraries/Utilities/setAndForwardRef.js b/Libraries/Utilities/setAndForwardRef.js index ba1a18b41d03..e81ebdd403b2 100644 --- a/Libraries/Utilities/setAndForwardRef.js +++ b/Libraries/Utilities/setAndForwardRef.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/stringifySafe.js b/Libraries/Utilities/stringifySafe.js index 9a451922ac42..2d74b3933d04 100644 --- a/Libraries/Utilities/stringifySafe.js +++ b/Libraries/Utilities/stringifySafe.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/truncate.js b/Libraries/Utilities/truncate.js index fb3814b4a5ae..5acdc5535f0c 100644 --- a/Libraries/Utilities/truncate.js +++ b/Libraries/Utilities/truncate.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,7 +24,7 @@ const defaultOptions = { }; // maxChars (including ellipsis) -const truncate = function( +const truncate = function ( str: ?string, maxChars: number, options?: truncateOptions, diff --git a/Libraries/Utilities/useColorScheme.js b/Libraries/Utilities/useColorScheme.js index 2c7ffa5d29bb..b79dd71c5549 100644 --- a/Libraries/Utilities/useColorScheme.js +++ b/Libraries/Utilities/useColorScheme.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/useMergeRefs.js b/Libraries/Utilities/useMergeRefs.js index 5b19c6f55d5e..15bd982d0368 100644 --- a/Libraries/Utilities/useMergeRefs.js +++ b/Libraries/Utilities/useMergeRefs.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/useRefEffect.js b/Libraries/Utilities/useRefEffect.js index 6362b683fdde..b79a644b83c0 100644 --- a/Libraries/Utilities/useRefEffect.js +++ b/Libraries/Utilities/useRefEffect.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Utilities/useWindowDimensions.js b/Libraries/Utilities/useWindowDimensions.js index 18ca4a442012..94b68f9d6757 100644 --- a/Libraries/Utilities/useWindowDimensions.js +++ b/Libraries/Utilities/useWindowDimensions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,7 +20,11 @@ export default function useWindowDimensions(): | DisplayMetricsAndroid { const [dimensions, setDimensions] = useState(() => Dimensions.get('window')); useEffect(() => { - function handleChange({window}) { + function handleChange({ + window, + }: + | $FlowFixMe + | $TEMPORARY$object<{window: DisplayMetrics | DisplayMetricsAndroid}>) { if ( dimensions.width !== window.width || dimensions.height !== window.height || diff --git a/Libraries/Utilities/verifyComponentAttributeEquivalence.js b/Libraries/Utilities/verifyComponentAttributeEquivalence.js index 489a6ca4aef2..437fa90926ed 100644 --- a/Libraries/Utilities/verifyComponentAttributeEquivalence.js +++ b/Libraries/Utilities/verifyComponentAttributeEquivalence.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -60,10 +60,12 @@ export default function verifyComponentAttributeEquivalence( } } +// Return the different key-value pairs of the right object, by iterating through the keys in the left object +// Note it won't return a difference where a key is missing in the left but exists the right. export function lefthandObjectDiff(leftObj: Object, rightObj: Object): Object { const differentKeys = {}; - function compare(leftItem, rightItem, key) { + function compare(leftItem: any, rightItem: any, key: string) { if (typeof leftItem !== typeof rightItem && leftItem != null) { differentKeys[key] = rightItem; return; diff --git a/Libraries/Utilities/warnOnce.js b/Libraries/Utilities/warnOnce.js index 244cfbe59060..a77f47e2f963 100644 --- a/Libraries/Utilities/warnOnce.js +++ b/Libraries/Utilities/warnOnce.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Vibration/NativeVibration.js b/Libraries/Vibration/NativeVibration.js index e627ba43adf5..d2ce739c1178 100644 --- a/Libraries/Vibration/NativeVibration.js +++ b/Libraries/Vibration/NativeVibration.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Vibration/RCTVibration.h b/Libraries/Vibration/RCTVibration.h index 1f6ced38c385..2a9f7248671b 100644 --- a/Libraries/Vibration/RCTVibration.h +++ b/Libraries/Vibration/RCTVibration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Vibration/RCTVibration.mm b/Libraries/Vibration/RCTVibration.mm index 3244818c1f74..68e4669d60c7 100644 --- a/Libraries/Vibration/RCTVibration.mm +++ b/Libraries/Vibration/RCTVibration.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Vibration/RCTVibrationPlugins.h b/Libraries/Vibration/RCTVibrationPlugins.h index 06761923b4a5..098c03afc615 100644 --- a/Libraries/Vibration/RCTVibrationPlugins.h +++ b/Libraries/Vibration/RCTVibrationPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Vibration/RCTVibrationPlugins.mm b/Libraries/Vibration/RCTVibrationPlugins.mm index d98ae4aae82b..9dabb1b78f17 100644 --- a/Libraries/Vibration/RCTVibrationPlugins.mm +++ b/Libraries/Vibration/RCTVibrationPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Vibration/React-RCTVibration.podspec b/Libraries/Vibration/React-RCTVibration.podspec index ed4ecf46b62b..d438105a7903 100644 --- a/Libraries/Vibration/React-RCTVibration.podspec +++ b/Libraries/Vibration/React-RCTVibration.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -36,12 +36,12 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.frameworks = "AudioToolbox" s.dependency "RCT-Folly", folly_version - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "ReactCommon/turbomodule/core", version s.dependency "React-jsi", version s.dependency "React-Core/RCTVibrationHeaders", version diff --git a/Libraries/Vibration/Vibration.js b/Libraries/Vibration/Vibration.js index 797928a7d3dc..840527de0de4 100644 --- a/Libraries/Vibration/Vibration.js +++ b/Libraries/Vibration/Vibration.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,7 +15,7 @@ const Platform = require('../Utilities/Platform'); /** * Vibration API * - * See https://reactnative.dev/docs/vibration.html + * See https://reactnative.dev/docs/vibration */ let _vibrating: boolean = false; @@ -68,9 +68,9 @@ const Vibration = { /** * Trigger a vibration with specified `pattern`. * - * See https://reactnative.dev/docs/vibration.html#vibrate + * See https://reactnative.dev/docs/vibration#vibrate */ - vibrate: function( + vibrate: function ( pattern: number | Array = _default_vibration_length, repeat: boolean = false, ) { @@ -98,9 +98,9 @@ const Vibration = { /** * Stop vibration * - * See https://reactnative.dev/docs/vibration.html#cancel + * See https://reactnative.dev/docs/vibration#cancel */ - cancel: function() { + cancel: function () { if (Platform.OS === 'ios') { _vibrating = false; } else { diff --git a/Libraries/WebSocket/NativeWebSocketModule.js b/Libraries/WebSocket/NativeWebSocketModule.js index 95e838912f0e..9c3f7672f5f0 100644 --- a/Libraries/WebSocket/NativeWebSocketModule.js +++ b/Libraries/WebSocket/NativeWebSocketModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/WebSocket/RCTReconnectingWebSocket.h b/Libraries/WebSocket/RCTReconnectingWebSocket.h index 25aa3ef46282..3690b7636506 100644 --- a/Libraries/WebSocket/RCTReconnectingWebSocket.h +++ b/Libraries/WebSocket/RCTReconnectingWebSocket.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/WebSocket/RCTReconnectingWebSocket.m b/Libraries/WebSocket/RCTReconnectingWebSocket.m index cd85e9b81ea6..bbd8c2273ace 100644 --- a/Libraries/WebSocket/RCTReconnectingWebSocket.m +++ b/Libraries/WebSocket/RCTReconnectingWebSocket.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/WebSocket/RCTSRWebSocket.m b/Libraries/WebSocket/RCTSRWebSocket.m index 8ce6edc4dae2..50983c9e3038 100644 --- a/Libraries/WebSocket/RCTSRWebSocket.m +++ b/Libraries/WebSocket/RCTSRWebSocket.m @@ -782,6 +782,10 @@ - (void)_disconnect - (void)_handleFrameWithData:(NSData *)frameData opCode:(NSInteger)opcode { + // copy frameData before handling, + // to avoid concurrent updates to the value at the pointer + frameData = [frameData copy]; + // Check that the current data is valid UTF8 BOOL isControlFrame = (opcode == RCTSROpCodePing || opcode == RCTSROpCodePong || opcode == RCTSROpCodeConnectionClose); diff --git a/Libraries/WebSocket/WebSocket.js b/Libraries/WebSocket/WebSocket.js index 70cc24729e58..78312d4d684a 100644 --- a/Libraries/WebSocket/WebSocket.js +++ b/Libraries/WebSocket/WebSocket.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/WebSocket/WebSocketEvent.js b/Libraries/WebSocket/WebSocketEvent.js index d174ac272b97..d70147ef6462 100644 --- a/Libraries/WebSocket/WebSocketEvent.js +++ b/Libraries/WebSocket/WebSocketEvent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/WebSocket/WebSocketInterceptor.js b/Libraries/WebSocket/WebSocketInterceptor.js index db8c7d215e10..f20492eb9361 100644 --- a/Libraries/WebSocket/WebSocketInterceptor.js +++ b/Libraries/WebSocket/WebSocketInterceptor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,8 +17,8 @@ const originalRCTWebSocketSend = NativeWebSocketModule.send; const originalRCTWebSocketSendBinary = NativeWebSocketModule.sendBinary; const originalRCTWebSocketClose = NativeWebSocketModule.close; -let eventEmitter: NativeEventEmitter; -let subscriptions: Array; +let eventEmitter; +let subscriptions; let closeCallback; let sendCallback; @@ -142,7 +142,7 @@ const WebSocketInterceptor = { // Override `connect` method for all RCTWebSocketModule requests // to intercept the request url, protocols, options and socketId, // then pass them through the `connectCallback`. - NativeWebSocketModule.connect = function( + NativeWebSocketModule.connect = function ( url, protocols, options, @@ -156,7 +156,7 @@ const WebSocketInterceptor = { // Override `send` method for all RCTWebSocketModule requests to intercept // the data sent, then pass them through the `sendCallback`. - NativeWebSocketModule.send = function(data, socketId) { + NativeWebSocketModule.send = function (data, socketId) { if (sendCallback) { sendCallback(data, socketId); } @@ -165,7 +165,7 @@ const WebSocketInterceptor = { // Override `sendBinary` method for all RCTWebSocketModule requests to // intercept the data sent, then pass them through the `sendCallback`. - NativeWebSocketModule.sendBinary = function(data, socketId) { + NativeWebSocketModule.sendBinary = function (data, socketId) { if (sendCallback) { sendCallback(WebSocketInterceptor._arrayBufferToString(data), socketId); } @@ -174,7 +174,7 @@ const WebSocketInterceptor = { // Override `close` method for all RCTWebSocketModule requests to intercept // the close information, then pass them through the `closeCallback`. - NativeWebSocketModule.close = function() { + NativeWebSocketModule.close = function () { if (closeCallback) { if (arguments.length === 3) { closeCallback(arguments[0], arguments[1], arguments[2]); diff --git a/Libraries/WebSocket/__mocks__/event-target-shim.js b/Libraries/WebSocket/__mocks__/event-target-shim.js index 10dc68082c44..652a9abd7c7a 100644 --- a/Libraries/WebSocket/__mocks__/event-target-shim.js +++ b/Libraries/WebSocket/__mocks__/event-target-shim.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/WebSocket/__tests__/WebSocket-test.js b/Libraries/WebSocket/__tests__/WebSocket-test.js index 52d8fb5b375d..5b98baa4191f 100644 --- a/Libraries/WebSocket/__tests__/WebSocket-test.js +++ b/Libraries/WebSocket/__tests__/WebSocket-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,7 +20,7 @@ jest.setMock('../../BatchedBridge/NativeModules', { const WebSocket = require('../WebSocket'); -describe('WebSocket', function() { +describe('WebSocket', function () { it('should have connection lifecycle constants defined on the class', () => { expect(WebSocket.CONNECTING).toEqual(0); }); diff --git a/Libraries/Wrapper/Example/RCTWrapperExampleView.h b/Libraries/Wrapper/Example/RCTWrapperExampleView.h index 4fe7efa11415..3d5885cdeab6 100644 --- a/Libraries/Wrapper/Example/RCTWrapperExampleView.h +++ b/Libraries/Wrapper/Example/RCTWrapperExampleView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperExampleView.m b/Libraries/Wrapper/Example/RCTWrapperExampleView.m index 9f20e5ba095c..6dcef01be09e 100644 --- a/Libraries/Wrapper/Example/RCTWrapperExampleView.m +++ b/Libraries/Wrapper/Example/RCTWrapperExampleView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperExampleViewController.h b/Libraries/Wrapper/Example/RCTWrapperExampleViewController.h index 295818e51c0f..fb0f3ed35a74 100644 --- a/Libraries/Wrapper/Example/RCTWrapperExampleViewController.h +++ b/Libraries/Wrapper/Example/RCTWrapperExampleViewController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperExampleViewController.m b/Libraries/Wrapper/Example/RCTWrapperExampleViewController.m index 62572a90c779..50ccfd20b5b0 100644 --- a/Libraries/Wrapper/Example/RCTWrapperExampleViewController.m +++ b/Libraries/Wrapper/Example/RCTWrapperExampleViewController.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h b/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h index 6cf421d10655..4035c856a333 100644 --- a/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h +++ b/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.m b/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.m index 013102f43e19..08b6200e3a8a 100644 --- a/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.m +++ b/Libraries/Wrapper/Example/RCTWrapperReactRootViewController.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.h b/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.h index f34d2e71aa12..68f99f529fdd 100644 --- a/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.h +++ b/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.m b/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.m index 0644257db397..0557aa0a7971 100644 --- a/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.m +++ b/Libraries/Wrapper/Example/RCTWrapperReactRootViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapper.h b/Libraries/Wrapper/RCTWrapper.h index aa6570bdfb16..185ea3e449c4 100644 --- a/Libraries/Wrapper/RCTWrapper.h +++ b/Libraries/Wrapper/RCTWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperShadowView.h b/Libraries/Wrapper/RCTWrapperShadowView.h index 9acae084dcb0..a5e969814dbb 100644 --- a/Libraries/Wrapper/RCTWrapperShadowView.h +++ b/Libraries/Wrapper/RCTWrapperShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperShadowView.m b/Libraries/Wrapper/RCTWrapperShadowView.m index ea40b3d0e8b4..cb7d4c882bc0 100644 --- a/Libraries/Wrapper/RCTWrapperShadowView.m +++ b/Libraries/Wrapper/RCTWrapperShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperView.h b/Libraries/Wrapper/RCTWrapperView.h index c9d35b0952a1..dc46ec588b52 100644 --- a/Libraries/Wrapper/RCTWrapperView.h +++ b/Libraries/Wrapper/RCTWrapperView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperView.m b/Libraries/Wrapper/RCTWrapperView.m index cbc0a9e1b31b..d0358a024152 100644 --- a/Libraries/Wrapper/RCTWrapperView.m +++ b/Libraries/Wrapper/RCTWrapperView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h b/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h index c590654fd38c..c8dff426c3aa 100644 --- a/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h +++ b/Libraries/Wrapper/RCTWrapperViewControllerHostingView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperViewControllerHostingView.m b/Libraries/Wrapper/RCTWrapperViewControllerHostingView.m index 595766a68e41..22a7cab0fc7e 100644 --- a/Libraries/Wrapper/RCTWrapperViewControllerHostingView.m +++ b/Libraries/Wrapper/RCTWrapperViewControllerHostingView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperViewManager.h b/Libraries/Wrapper/RCTWrapperViewManager.h index 485d7d3c6c34..0eccdc4b0b21 100644 --- a/Libraries/Wrapper/RCTWrapperViewManager.h +++ b/Libraries/Wrapper/RCTWrapperViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/Wrapper/RCTWrapperViewManager.m b/Libraries/Wrapper/RCTWrapperViewManager.m index 5d6549eadb9b..d4317e2cff9e 100644 --- a/Libraries/Wrapper/RCTWrapperViewManager.m +++ b/Libraries/Wrapper/RCTWrapperViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/YellowBox/YellowBoxDeprecated.js b/Libraries/YellowBox/YellowBoxDeprecated.js index 5ff6217c9289..bec2229de46a 100644 --- a/Libraries/YellowBox/YellowBoxDeprecated.js +++ b/Libraries/YellowBox/YellowBoxDeprecated.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/YellowBox/__tests__/YellowBoxDeprecated-test.js b/Libraries/YellowBox/__tests__/YellowBoxDeprecated-test.js index 38fee3de6cd9..70e552464588 100644 --- a/Libraries/YellowBox/__tests__/YellowBoxDeprecated-test.js +++ b/Libraries/YellowBox/__tests__/YellowBoxDeprecated-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/__flowtests__/ReactNativeTypes-flowtest.js b/Libraries/__flowtests__/ReactNativeTypes-flowtest.js index 509cfea90935..032472bef7ac 100644 --- a/Libraries/__flowtests__/ReactNativeTypes-flowtest.js +++ b/Libraries/__flowtests__/ReactNativeTypes-flowtest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/promiseRejectionTrackingOptions.js b/Libraries/promiseRejectionTrackingOptions.js index ac828127df58..a57f3666899d 100644 --- a/Libraries/promiseRejectionTrackingOptions.js +++ b/Libraries/promiseRejectionTrackingOptions.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,7 +10,7 @@ import typeof {enable} from 'promise/setimmediate/rejection-tracking'; -type ExtractOptionsType =

((options?: ?P) => void) => P; +type ExtractOptionsType =

(((options?: ?P) => void)) => P; let rejectionTrackingOptions: $Call = { allRejections: true, diff --git a/Libraries/vendor/core/ErrorUtils.js b/Libraries/vendor/core/ErrorUtils.js index 8fedfc737690..12530c0eccc6 100644 --- a/Libraries/vendor/core/ErrorUtils.js +++ b/Libraries/vendor/core/ErrorUtils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/vendor/emitter/EventEmitter.js b/Libraries/vendor/emitter/EventEmitter.js index c2ebd9c54e0c..668fd6549fd6 100644 --- a/Libraries/vendor/emitter/EventEmitter.js +++ b/Libraries/vendor/emitter/EventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/vendor/emitter/EventSubscription.js b/Libraries/vendor/emitter/EventSubscription.js index c6e9501598a5..7a8fd111ef13 100644 --- a/Libraries/vendor/emitter/EventSubscription.js +++ b/Libraries/vendor/emitter/EventSubscription.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Libraries/vendor/emitter/_EmitterSubscription.js b/Libraries/vendor/emitter/_EmitterSubscription.js index b69f2daff97f..6e701ec253bc 100644 --- a/Libraries/vendor/emitter/_EmitterSubscription.js +++ b/Libraries/vendor/emitter/_EmitterSubscription.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,7 +20,8 @@ import {type EventSubscription} from './EventSubscription'; */ class EmitterSubscription> extends _EventSubscription - implements EventSubscription { + implements EventSubscription +{ emitter: EventEmitter; listener: ?(...$ElementType) => mixed; context: ?$FlowFixMe; diff --git a/Libraries/vendor/emitter/_EventEmitter.js b/Libraries/vendor/emitter/_EventEmitter.js index 7650cc9a2242..39c076c53876 100644 --- a/Libraries/vendor/emitter/_EventEmitter.js +++ b/Libraries/vendor/emitter/_EventEmitter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -31,7 +31,8 @@ const sparseFilterPredicate = () => true; * more advanced emitter may use an EventHolder and EventFactory. */ class EventEmitter { - _subscriber: EventSubscriptionVendor = new EventSubscriptionVendor(); + _subscriber: EventSubscriptionVendor = + new EventSubscriptionVendor(); /** * @constructor diff --git a/Libraries/vendor/emitter/_EventSubscription.js b/Libraries/vendor/emitter/_EventSubscription.js index 446cf2f049f5..73331152d544 100644 --- a/Libraries/vendor/emitter/_EventSubscription.js +++ b/Libraries/vendor/emitter/_EventSubscription.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,8 @@ import type EventSubscriptionVendor from './_EventSubscriptionVendor'; * remove its own subscription. */ class _EventSubscription> - implements EventSubscription { + implements EventSubscription +{ eventType: K; key: number; subscriber: EventSubscriptionVendor; diff --git a/Libraries/vendor/emitter/_EventSubscriptionVendor.js b/Libraries/vendor/emitter/_EventSubscriptionVendor.js index 9ac31438f305..e8272008873a 100644 --- a/Libraries/vendor/emitter/_EventSubscriptionVendor.js +++ b/Libraries/vendor/emitter/_EventSubscriptionVendor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,7 +23,7 @@ class EventSubscriptionVendor { [type: $Keys]: Array< EventSubscription, >, - ..., + ... }; constructor() { diff --git a/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js b/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js index 43a4a92e0e10..c8463facc0fe 100644 --- a/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js +++ b/Libraries/vendor/emitter/__flowtests__/EventEmitter-flowtest.js @@ -1,5 +1,5 @@ /** - * (c) Facebook, Inc. and its affiliates. Confidential and proprietary. + * (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary. * * @flow strict * @format diff --git a/README.md b/README.md index 233cbf160a5c..a99e21ad4bab 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ The source for the React Native documentation and website is hosted on a separat Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the [Upgrading Guide][u] for instructions. -React Native releases are discussed in the React Native Community, [**@react-native-community/react-native-releases**][repo-releases]. +React Native releases are discussed [in this discussion repo](https://github.com/reactwg/react-native-releases/discussions). [u]: https://reactnative.dev/docs/upgrading [repo-releases]: https://github.com/react-native-community/react-native-releases diff --git a/React-Core.podspec b/React-Core.podspec index cd9af6991011..375bd9e1ea87 100644 --- a/React-Core.podspec +++ b/React-Core.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -47,7 +47,7 @@ Pod::Spec.new do |s| s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags s.header_dir = "React" s.framework = "JavaScriptCore" - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"", "DEFINES_MODULE" => "YES" } + s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"", "DEFINES_MODULE" => "YES" } s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""} s.default_subspec = "Default" diff --git a/React.podspec b/React.podspec index 8cf58a1993a5..9c44e3101cac 100644 --- a/React.podspec +++ b/React.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/React/AppSetup/RCTAppSetupUtils.h b/React/AppSetup/RCTAppSetupUtils.h new file mode 100644 index 000000000000..954dee2a987a --- /dev/null +++ b/React/AppSetup/RCTAppSetupUtils.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import +#import + +#if RCT_NEW_ARCH_ENABLED + +#ifndef RCT_USE_HERMES +#if __has_include() +#define RCT_USE_HERMES 1 +#else +#define RCT_USE_HERMES 0 +#endif +#endif + +#if RCT_USE_HERMES +#import +#else +#import +#endif + +#import +#endif + +RCT_EXTERN_C_BEGIN + +void RCTAppSetupPrepareApp(UIApplication *application); +UIView *RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties); + +RCT_EXTERN_C_END + +#if RCT_NEW_ARCH_ENABLED +RCT_EXTERN id RCTAppSetupDefaultModuleFromClass(Class moduleClass); + +std::unique_ptr RCTAppSetupDefaultJsExecutorFactory( + RCTBridge *bridge, + RCTTurboModuleManager *turboModuleManager); +#endif diff --git a/React/AppSetup/RCTAppSetupUtils.mm b/React/AppSetup/RCTAppSetupUtils.mm new file mode 100644 index 000000000000..cc9641ca3806 --- /dev/null +++ b/React/AppSetup/RCTAppSetupUtils.mm @@ -0,0 +1,129 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTAppSetupUtils.h" + +#if RCT_NEW_ARCH_ENABLED +// Turbo Module +#import +#import +#import +#import +#import +#import +#import +#import +#import + +// Fabric +#import +#endif + +#ifdef FB_SONARKIT_ENABLED +#import +#import +#import +#import +#import +#import + +static void InitializeFlipper(UIApplication *application) +{ + FlipperClient *client = [FlipperClient sharedClient]; + SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults]; + [client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application + withDescriptorMapper:layoutDescriptorMapper]]; + [client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]]; + [client addPlugin:[FlipperKitReactPlugin new]]; + [client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]]; + [client start]; +} +#endif + +void RCTAppSetupPrepareApp(UIApplication *application) +{ +#ifdef FB_SONARKIT_ENABLED + InitializeFlipper(application); +#endif + +#if RCT_NEW_ARCH_ENABLED + RCTEnableTurboModule(YES); +#endif +} + +UIView *RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties) +{ +#if RCT_NEW_ARCH_ENABLED + return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:bridge + moduleName:moduleName + initialProperties:initialProperties]; +#else + return [[RCTRootView alloc] initWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; +#endif +} + +#if RCT_NEW_ARCH_ENABLED +id RCTAppSetupDefaultModuleFromClass(Class moduleClass) +{ + // Set up the default RCTImageLoader and RCTNetworking modules. + if (moduleClass == RCTImageLoader.class) { + return [[moduleClass alloc] initWithRedirectDelegate:nil + loadersProvider:^NSArray> *(RCTModuleRegistry *moduleRegistry) { + return @[ [RCTLocalAssetImageLoader new] ]; + } + decodersProvider:^NSArray> *(RCTModuleRegistry *moduleRegistry) { + return @[ [RCTGIFImageDecoder new] ]; + }]; + } else if (moduleClass == RCTNetworking.class) { + return [[moduleClass alloc] + initWithHandlersProvider:^NSArray> *(RCTModuleRegistry *moduleRegistry) { + return @[ + [RCTHTTPRequestHandler new], + [RCTDataRequestHandler new], + [RCTFileRequestHandler new], + ]; + }]; + } + // No custom initializer here. + return [moduleClass new]; +} + +std::unique_ptr RCTAppSetupDefaultJsExecutorFactory( + RCTBridge *bridge, + RCTTurboModuleManager *turboModuleManager) +{ + // Necessary to allow NativeModules to lookup TurboModules + [bridge setRCTTurboModuleRegistry:turboModuleManager]; + +#if RCT_DEV + if (!RCTTurboModuleEagerInitEnabled()) { + /** + * Instantiating DevMenu has the side-effect of registering + * shortcuts for CMD + d, CMD + i, and CMD + n via RCTDevMenu. + * Therefore, when TurboModules are enabled, we must manually create this + * NativeModule. + */ + [turboModuleManager moduleForName:"RCTDevMenu"]; + } +#endif + +#if RCT_USE_HERMES + return std::make_unique( +#else + return std::make_unique( +#endif + facebook::react::RCTJSIExecutorRuntimeInstaller([turboModuleManager, bridge](facebook::jsi::Runtime &runtime) { + if (!bridge || !turboModuleManager) { + return; + } + facebook::react::RuntimeExecutor syncRuntimeExecutor = + [&](std::function &&callback) { callback(runtime); }; + [turboModuleManager installJSBindingWithRuntimeExecutor:syncRuntimeExecutor]; + })); +} + +#endif diff --git a/React/Base/RCTAssert.h b/React/Base/RCTAssert.h index e4c77907f6e6..b1d92867d27a 100644 --- a/React/Base/RCTAssert.h +++ b/React/Base/RCTAssert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTAssert.m b/React/Base/RCTAssert.m index 634d7920d012..3441f987fd48 100644 --- a/React/Base/RCTAssert.m +++ b/React/Base/RCTAssert.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTBridge+Private.h b/React/Base/RCTBridge+Private.h index 9dd96a5cd140..8412f1095fa6 100644 --- a/React/Base/RCTBridge+Private.h +++ b/React/Base/RCTBridge+Private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index 8eef1cece615..0033a40579ac 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -164,6 +164,11 @@ RCT_EXTERN void RCTEnableTurboModuleSharedMutexInit(BOOL enabled); RCT_EXTERN BOOL RCTTurboModuleManagerDelegateLockingDisabled(void); RCT_EXTERN void RCTDisableTurboModuleManagerDelegateLocking(BOOL enabled); +// Turn off validAttribute: entries inside ViewConfigs for events +// TODO(109509380): Remove this gating +RCT_EXTERN BOOL RCTViewConfigEventValidAttributesDisabled(void); +RCT_EXTERN void RCTDisableViewConfigEventValidAttributes(BOOL disabled); + typedef enum { kRCTGlobalScope, kRCTGlobalScopeUsingRetainJSCallback, diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index 38b9cdd46950..421dc451c407 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -162,6 +162,18 @@ void RCTDisableTurboModuleManagerDelegateLocking(BOOL disabled) turboModuleManagerDelegateLockingDisabled = disabled; } +// Turn off TurboModule delegate locking +static BOOL viewConfigEventValidAttributesDisabled = NO; +BOOL RCTViewConfigEventValidAttributesDisabled(void) +{ + return viewConfigEventValidAttributesDisabled; +} + +void RCTDisableViewConfigEventValidAttributes(BOOL disabled) +{ + viewConfigEventValidAttributesDisabled = disabled; +} + @interface RCTBridge () @end diff --git a/React/Base/RCTBridgeDelegate.h b/React/Base/RCTBridgeDelegate.h index 00c26f2dac34..0e081964bc2e 100644 --- a/React/Base/RCTBridgeDelegate.h +++ b/React/Base/RCTBridgeDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTBridgeMethod.h b/React/Base/RCTBridgeMethod.h index 35d2b893ae3e..7169aa797711 100644 --- a/React/Base/RCTBridgeMethod.h +++ b/React/Base/RCTBridgeMethod.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ @class RCTBridge; -typedef NS_ENUM(NSUInteger, RCTFunctionType) { +typedef NS_ENUM(NSInteger, RCTFunctionType) { RCTFunctionTypeNormal, RCTFunctionTypePromise, RCTFunctionTypeSync, diff --git a/React/Base/RCTBridgeModule.h b/React/Base/RCTBridgeModule.h index fff361a58d4c..971973a9b332 100644 --- a/React/Base/RCTBridgeModule.h +++ b/React/Base/RCTBridgeModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTBundleManager.m b/React/Base/RCTBundleManager.m index b6c1b13652a4..97b9400af605 100644 --- a/React/Base/RCTBundleManager.m +++ b/React/Base/RCTBundleManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTBundleURLProvider.h b/React/Base/RCTBundleURLProvider.h index 26fbbd059ea6..cbf8132b1da9 100644 --- a/React/Base/RCTBundleURLProvider.h +++ b/React/Base/RCTBundleURLProvider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,11 +24,6 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed); @interface RCTBundleURLProvider : NSObject -/** - * Set default settings on NSUserDefaults. - */ -- (void)setDefaults; - /** * Reset every settings to default. */ @@ -73,25 +68,22 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed); /** * Returns the jsBundleURL for a given bundle entrypoint and * the fallback offline JS bundle if the packager is not running. - * if resourceName or extension are nil, "main" and "jsbundle" will be - * used, respectively. + * if extension is nil, "jsbundle" will be used. */ -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - fallbackResource:(NSString *)resourceName - fallbackExtension:(NSString *)extension; +- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackExtension:(NSString *)extension; /** * Returns the jsBundleURL for a given bundle entrypoint and * the fallback offline JS bundle if the packager is not running. */ -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName; +- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot; /** * Returns the jsBundleURL for a given bundle entrypoint and - * the fallback offline JS bundle. If resourceName or extension - * are nil, "main" and "jsbundle" will be used, respectively. + * the fallback offline JS bundle. If extension is nil, + * "jsbundle" will be used. */ -- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName fallbackExtension:(NSString *)extension; +- (NSURL *)jsBundleURLForFallbackExtension:(NSString *)extension; /** * Returns the resourceURL for a given bundle entrypoint and @@ -135,13 +127,6 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed); enableDev:(BOOL)enableDev enableMinification:(BOOL)enableMinification; -+ (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - packagerHost:(NSString *)packagerHost - enableDev:(BOOL)enableDev - enableMinification:(BOOL)enableMinification - modulesOnly:(BOOL)modulesOnly - runModule:(BOOL)runModule; - + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot packagerHost:(NSString *)packagerHost packagerScheme:(NSString *)scheme @@ -154,8 +139,6 @@ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed); * In general, please use the instance method to decide if the packager is running and fallback to the pre-packaged * resource if it is not: -resourceURLForResourceRoot:resourceName:resourceExtension:offlineBundle: */ -+ (NSURL *)resourceURLForResourcePath:(NSString *)path packagerHost:(NSString *)packagerHost query:(NSString *)query; - + (NSURL *)resourceURLForResourcePath:(NSString *)path packagerHost:(NSString *)packagerHost scheme:(NSString *)scheme diff --git a/React/Base/RCTBundleURLProvider.mm b/React/Base/RCTBundleURLProvider.mm index cf2b2d2dca19..bee7394ee29f 100644 --- a/React/Base/RCTBundleURLProvider.mm +++ b/React/Base/RCTBundleURLProvider.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,7 +33,7 @@ - (instancetype)init { self = [super init]; if (self) { - [self setDefaults]; + [self _setDefaults]; } return self; } @@ -51,17 +51,12 @@ - (void)settingsUpdated [[NSNotificationCenter defaultCenter] postNotificationName:RCTBundleURLProviderUpdatedNotification object:self]; } -- (void)setDefaults -{ - [[NSUserDefaults standardUserDefaults] registerDefaults:[self defaults]]; -} - - (void)resetToDefaults { for (NSString *key in [[self defaults] allKeys]) { [[NSUserDefaults standardUserDefaults] removeObjectForKey:key]; } - [self setDefaults]; + [self _setDefaults]; [self settingsUpdated]; } @@ -204,26 +199,23 @@ - (NSURL *)jsBundleURLForSplitBundleRoot:(NSString *)bundleRoot runModule:NO]; } -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - fallbackResource:(NSString *)resourceName - fallbackExtension:(NSString *)extension +- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackExtension:(NSString *)extension { return [self jsBundleURLForBundleRoot:bundleRoot fallbackURLProvider:^NSURL * { - return [self jsBundleURLForFallbackResource:resourceName fallbackExtension:extension]; + return [self jsBundleURLForFallbackExtension:extension]; }]; } -- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot fallbackResource:(NSString *)resourceName +- (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot { - return [self jsBundleURLForBundleRoot:bundleRoot fallbackResource:resourceName fallbackExtension:nil]; + return [self jsBundleURLForBundleRoot:bundleRoot fallbackExtension:nil]; } -- (NSURL *)jsBundleURLForFallbackResource:(NSString *)resourceName fallbackExtension:(NSString *)extension +- (NSURL *)jsBundleURLForFallbackExtension:(NSString *)extension { - resourceName = resourceName ?: @"main"; extension = extension ?: @"jsbundle"; - return [[NSBundle mainBundle] URLForResource:resourceName withExtension:extension]; + return [[NSBundle mainBundle] URLForResource:@"main" withExtension:extension]; } - (NSURL *)resourceURLForResourceRoot:(NSString *)root @@ -253,28 +245,13 @@ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot { return [self jsBundleURLForBundleRoot:bundleRoot packagerHost:packagerHost + packagerScheme:nil enableDev:enableDev enableMinification:enableMinification modulesOnly:NO runModule:YES]; } -+ (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot - packagerHost:(NSString *)packagerHost - enableDev:(BOOL)enableDev - enableMinification:(BOOL)enableMinification - modulesOnly:(BOOL)modulesOnly - runModule:(BOOL)runModule -{ - return [[self class] jsBundleURLForBundleRoot:bundleRoot - packagerHost:packagerHost - packagerScheme:nil - enableDev:enableDev - enableMinification:enableMinification - modulesOnly:modulesOnly - runModule:runModule]; -} - + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot packagerHost:(NSString *)packagerHost packagerScheme:(NSString *)scheme @@ -305,11 +282,6 @@ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost scheme:scheme query:query]; } -+ (NSURL *)resourceURLForResourcePath:(NSString *)path packagerHost:(NSString *)packagerHost query:(NSString *)query -{ - return [[self class] resourceURLForResourcePath:path packagerHost:packagerHost scheme:nil query:query]; -} - + (NSURL *)resourceURLForResourcePath:(NSString *)path packagerHost:(NSString *)packagerHost scheme:(NSString *)scheme @@ -385,4 +357,11 @@ + (instancetype)sharedSettings return sharedInstance; } +#pragma mark - Private helpers + +- (void)_setDefaults +{ + [[NSUserDefaults standardUserDefaults] registerDefaults:[self defaults]]; +} + @end diff --git a/React/Base/RCTCallableJSModules.m b/React/Base/RCTCallableJSModules.m index 316d4dc56e4e..5fd69033f6a5 100644 --- a/React/Base/RCTCallableJSModules.m +++ b/React/Base/RCTCallableJSModules.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTComponentEvent.h b/React/Base/RCTComponentEvent.h index 0467f8c50f37..e79468dfebac 100644 --- a/React/Base/RCTComponentEvent.h +++ b/React/Base/RCTComponentEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTComponentEvent.m b/React/Base/RCTComponentEvent.m index 5fb4295752e6..bdc4503afeda 100644 --- a/React/Base/RCTComponentEvent.m +++ b/React/Base/RCTComponentEvent.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTConstants.h b/React/Base/RCTConstants.h index c92fc1041c9a..14a5263f83a0 100644 --- a/React/Base/RCTConstants.h +++ b/React/Base/RCTConstants.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,9 +15,3 @@ RCT_EXTERN NSString *const RCTUserInterfaceStyleDidChangeNotificationTraitCollec */ RCT_EXTERN BOOL RCTExperimentGetPreemptiveViewAllocationDisabled(void); RCT_EXTERN void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value); - -/* - * Remove clipped subviews - */ -RCT_EXTERN BOOL RCTGetRemoveClippedSubviewsEnabled(void); -RCT_EXTERN void RCTSetRemoveClippedSubviewsEnabled(BOOL value); diff --git a/React/Base/RCTConstants.m b/React/Base/RCTConstants.m index 38947bb170f1..8d1e308acd91 100644 --- a/React/Base/RCTConstants.m +++ b/React/Base/RCTConstants.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,18 +24,3 @@ void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value) { RCTExperimentPreemptiveViewAllocationDisabled = value; } - -/* - * Remove clipped subviews - */ -static BOOL RCTRemoveClippedSubviewsEnabled = NO; - -BOOL RCTGetRemoveClippedSubviewsEnabled(void) -{ - return RCTRemoveClippedSubviewsEnabled; -} - -void RCTSetRemoveClippedSubviewsEnabled(BOOL value) -{ - RCTRemoveClippedSubviewsEnabled = value; -} diff --git a/React/Base/RCTConvert.h b/React/Base/RCTConvert.h index 09a380e84dd5..c4913f60c7ab 100644 --- a/React/Base/RCTConvert.h +++ b/React/Base/RCTConvert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTConvert.m b/React/Base/RCTConvert.m index 4b59899560bc..c21ef072acd4 100644 --- a/React/Base/RCTConvert.m +++ b/React/Base/RCTConvert.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -554,7 +554,24 @@ +(type)type : (id)json \ RCT_CGSTRUCT_CONVERTER(CGPoint, (@[ @"x", @"y" ])) RCT_CGSTRUCT_CONVERTER(CGSize, (@[ @"width", @"height" ])) RCT_CGSTRUCT_CONVERTER(CGRect, (@[ @"x", @"y", @"width", @"height" ])) -RCT_CGSTRUCT_CONVERTER(UIEdgeInsets, (@[ @"top", @"left", @"bottom", @"right" ])) + ++ (UIEdgeInsets)UIEdgeInsets:(id)json +{ + static NSArray *fields; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + fields = @[ @"top", @"left", @"bottom", @"right" ]; + }); + + if ([json isKindOfClass:[NSNumber class]]) { + CGFloat value = [json doubleValue]; + return UIEdgeInsetsMake(value, value, value, value); + } else { + UIEdgeInsets result; + convertCGStruct("UIEdgeInsets", fields, (CGFloat *)&result, json); + return result; + } +} RCT_ENUM_CONVERTER( CGLineJoin, @@ -811,7 +828,7 @@ +(type)type : (id)json \ */ static NSString *RCTSemanticColorNames() { - NSMutableString *names = [[NSMutableString alloc] init]; + NSMutableString *names = [NSMutableString new]; NSDictionary *colorMap = RCTSemanticColorsMap(); NSArray *allKeys = [[[colorMap allKeys] mutableCopy] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; diff --git a/React/Base/RCTCxxConvert.h b/React/Base/RCTCxxConvert.h index 261e61f60962..b5176f6fbe66 100644 --- a/React/Base/RCTCxxConvert.h +++ b/React/Base/RCTCxxConvert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTCxxConvert.m b/React/Base/RCTCxxConvert.m index 7d77c00f10c4..62eefb818b98 100644 --- a/React/Base/RCTCxxConvert.m +++ b/React/Base/RCTCxxConvert.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTDefines.h b/React/Base/RCTDefines.h index 4b9517eeabc2..1d750638f5c5 100644 --- a/React/Base/RCTDefines.h +++ b/React/Base/RCTDefines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTDisplayLink.h b/React/Base/RCTDisplayLink.h index 1e79c0baeda8..28bfa7b1fb8d 100644 --- a/React/Base/RCTDisplayLink.h +++ b/React/Base/RCTDisplayLink.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTDisplayLink.m b/React/Base/RCTDisplayLink.m index bcc7eab97151..6c42e3241c82 100644 --- a/React/Base/RCTDisplayLink.m +++ b/React/Base/RCTDisplayLink.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -62,7 +62,9 @@ - (void)registerModuleForFrameUpdates:(id)module withModuleData [weakSelf updateJSDisplayLinkState]; } else { CFRunLoopPerformBlock(cfRunLoop, kCFRunLoopDefaultMode, ^{ - [weakSelf updateJSDisplayLinkState]; + @autoreleasepool { + [weakSelf updateJSDisplayLinkState]; + } }); CFRunLoopWakeUp(cfRunLoop); } @@ -73,7 +75,9 @@ - (void)registerModuleForFrameUpdates:(id)module withModuleData // start receiving updates anyway. if (![observer isPaused] && _runLoop) { CFRunLoopPerformBlock([_runLoop getCFRunLoop], kCFRunLoopDefaultMode, ^{ - [self updateJSDisplayLinkState]; + @autoreleasepool { + [self updateJSDisplayLinkState]; + } }); } } diff --git a/React/Base/RCTErrorCustomizer.h b/React/Base/RCTErrorCustomizer.h index aa65296becdf..d634b5577cd7 100644 --- a/React/Base/RCTErrorCustomizer.h +++ b/React/Base/RCTErrorCustomizer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTErrorInfo.h b/React/Base/RCTErrorInfo.h index a5d74d8e457a..a388b7815850 100644 --- a/React/Base/RCTErrorInfo.h +++ b/React/Base/RCTErrorInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTErrorInfo.m b/React/Base/RCTErrorInfo.m index ac492b00ed44..1eb41fe4caed 100644 --- a/React/Base/RCTErrorInfo.m +++ b/React/Base/RCTErrorInfo.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTEventDispatcher.m b/React/Base/RCTEventDispatcher.m index 9da63c3af119..00f6046b4eb5 100644 --- a/React/Base/RCTEventDispatcher.m +++ b/React/Base/RCTEventDispatcher.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTEventDispatcherProtocol.h b/React/Base/RCTEventDispatcherProtocol.h index 913cf8522835..9e80332a0076 100644 --- a/React/Base/RCTEventDispatcherProtocol.h +++ b/React/Base/RCTEventDispatcherProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTFrameUpdate.h b/React/Base/RCTFrameUpdate.h index 07f088940ed7..39d7b72676be 100644 --- a/React/Base/RCTFrameUpdate.h +++ b/React/Base/RCTFrameUpdate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTFrameUpdate.m b/React/Base/RCTFrameUpdate.m index 7223c35db89d..86bee10972a6 100644 --- a/React/Base/RCTFrameUpdate.m +++ b/React/Base/RCTFrameUpdate.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTImageSource.h b/React/Base/RCTImageSource.h index 928657c11466..3a5a481e5862 100644 --- a/React/Base/RCTImageSource.h +++ b/React/Base/RCTImageSource.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTImageSource.m b/React/Base/RCTImageSource.m index 19c6ed39b661..1741ad382913 100644 --- a/React/Base/RCTImageSource.m +++ b/React/Base/RCTImageSource.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTInitializing.h b/React/Base/RCTInitializing.h index 56b14b1c063b..dc6323b6aba6 100644 --- a/React/Base/RCTInitializing.h +++ b/React/Base/RCTInitializing.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTInvalidating.h b/React/Base/RCTInvalidating.h index bc144cd2c0d0..ad353758d21f 100644 --- a/React/Base/RCTInvalidating.h +++ b/React/Base/RCTInvalidating.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJSScriptLoaderModule.h b/React/Base/RCTJSScriptLoaderModule.h index a0ba36ed7dcc..c05c29f7697b 100644 --- a/React/Base/RCTJSScriptLoaderModule.h +++ b/React/Base/RCTJSScriptLoaderModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJSStackFrame.h b/React/Base/RCTJSStackFrame.h index 1a66e29e5874..4d72e8663ff1 100644 --- a/React/Base/RCTJSStackFrame.h +++ b/React/Base/RCTJSStackFrame.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJSStackFrame.m b/React/Base/RCTJSStackFrame.m index 1e3d5498eaf7..7d1e1e85974f 100644 --- a/React/Base/RCTJSStackFrame.m +++ b/React/Base/RCTJSStackFrame.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJSThread.h b/React/Base/RCTJSThread.h index 8f1bc76d2c2e..57503e41326f 100644 --- a/React/Base/RCTJSThread.h +++ b/React/Base/RCTJSThread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJSThread.m b/React/Base/RCTJSThread.m index 192822a86061..1be0c130ddb6 100644 --- a/React/Base/RCTJSThread.m +++ b/React/Base/RCTJSThread.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJavaScriptExecutor.h b/React/Base/RCTJavaScriptExecutor.h index c42fb051792f..d1913044af54 100644 --- a/React/Base/RCTJavaScriptExecutor.h +++ b/React/Base/RCTJavaScriptExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJavaScriptLoader.h b/React/Base/RCTJavaScriptLoader.h index 729fa371804a..49d31beceeb9 100755 --- a/React/Base/RCTJavaScriptLoader.h +++ b/React/Base/RCTJavaScriptLoader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTJavaScriptLoader.mm b/React/Base/RCTJavaScriptLoader.mm index dfce0d5e93a2..aa89b99f1c73 100755 --- a/React/Base/RCTJavaScriptLoader.mm +++ b/React/Base/RCTJavaScriptLoader.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTKeyCommands.h b/React/Base/RCTKeyCommands.h index 2bdefcfab9db..df94f3509d4d 100644 --- a/React/Base/RCTKeyCommands.h +++ b/React/Base/RCTKeyCommands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTKeyCommands.m b/React/Base/RCTKeyCommands.m index 7e4ccb2a6a15..83385f82439f 100644 --- a/React/Base/RCTKeyCommands.m +++ b/React/Base/RCTKeyCommands.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTLog.h b/React/Base/RCTLog.h index 0d79797f0558..f47505f1e359 100644 --- a/React/Base/RCTLog.h +++ b/React/Base/RCTLog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTLog.mm b/React/Base/RCTLog.mm index dfee013c7a67..3e52f9df1e11 100644 --- a/React/Base/RCTLog.mm +++ b/React/Base/RCTLog.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTManagedPointer.h b/React/Base/RCTManagedPointer.h index 4ed6616f4423..ff444d27e711 100644 --- a/React/Base/RCTManagedPointer.h +++ b/React/Base/RCTManagedPointer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTManagedPointer.mm b/React/Base/RCTManagedPointer.mm index a79dde445173..cfdbd26b192d 100644 --- a/React/Base/RCTManagedPointer.mm +++ b/React/Base/RCTManagedPointer.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTMockDef.h b/React/Base/RCTMockDef.h new file mode 100644 index 000000000000..677613605fac --- /dev/null +++ b/React/Base/RCTMockDef.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +/* These macros are used to stub C functions. Here's an example: + * + * Helpers.h + * ------ + * boolean ReturnsTrueOrFalse(void); + * + * FileToBeTested.h + * ------ + * RCT_MOCK_DEF(Testing, ReturnsTrueOrFalse); + * #define ReturnsTrueOrFalse RCT_MOCK_USE(Testing, ReturnsTrueOrFalse) + * + * int FunctionToBeTested(int input) { + * return ReturnsTrueOrFalse() ? input + 1 : input - 1; + * } + * + * Test.h + * ----- + * RCT_MOCK_GET(Testing, ReturnsTrueOrFalse); + * + * boolean _ReturnsTrue(void) { return true; } + * boolean _ReturnsFalse(void) { return false; } + * + * void TestFunctionTrue(void) { + * RCT_MOCK_SET(Testing, ReturnsTrueOrFalse, _ReturnsTrue); + * assert(FunctionToBeTested(5) == 6); + * RCT_MOCK_RESET(Testing, ReturnsTrueOrFalse); + * } + * + * void TestFunctionFalse(void) { + * RCT_MOCK_SET(Testing, ReturnsTrueOrFalse, _ReturnsFalse); + * assert(FunctionToBeTested(5) == 4); + * RCT_MOCK_RESET(Testing, ReturnsTrueOrFalse); + * } + * + */ + +#ifdef RCT_DEV +#define RCT_MOCK_DEF(context, api) \ + __typeof(__typeof(api) *) mockptr_##context##_##api = &api; +#define RCT_MOCK_REF(context, api) \ + extern __typeof(__typeof(api) *) mockptr_##context##_##api; +#define RCT_MOCK_SET(context, api, mockapi) \ + (mockptr_##context##_##api = &mockapi) +#define RCT_MOCK_RESET(context, api) (mockptr_##context##_##api = &api) +#define RCT_MOCK_USE(context, api) (*mockptr_##context##_##api) +#else +#define RCT_MOCK_DEF(context, api) +#define RCT_MOCK_REF(context, api) +#define RCT_MOCK_SET(context, api, mockapi) +#define RCT_MOCK_RESET(context, api) +#define RCT_MOCK_USE(context, api) api +#endif diff --git a/React/Base/RCTModuleData.h b/React/Base/RCTModuleData.h index 71e1950aac3b..a1c5b3a62d74 100644 --- a/React/Base/RCTModuleData.h +++ b/React/Base/RCTModuleData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTModuleData.mm b/React/Base/RCTModuleData.mm index 1a3d8839c79c..47837ece4247 100644 --- a/React/Base/RCTModuleData.mm +++ b/React/Base/RCTModuleData.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTModuleMethod.h b/React/Base/RCTModuleMethod.h index c93a06079307..279b906c17de 100644 --- a/React/Base/RCTModuleMethod.h +++ b/React/Base/RCTModuleMethod.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTModuleMethod.mm b/React/Base/RCTModuleMethod.mm index ff89838a75e5..941400a9f2de 100644 --- a/React/Base/RCTModuleMethod.mm +++ b/React/Base/RCTModuleMethod.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTModuleRegistry.m b/React/Base/RCTModuleRegistry.m index c5a5d10ab48e..15ca7aa6014a 100644 --- a/React/Base/RCTModuleRegistry.m +++ b/React/Base/RCTModuleRegistry.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTMultipartDataTask.h b/React/Base/RCTMultipartDataTask.h index bcf0c5701b48..25a73fdaf1af 100644 --- a/React/Base/RCTMultipartDataTask.h +++ b/React/Base/RCTMultipartDataTask.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTMultipartDataTask.m b/React/Base/RCTMultipartDataTask.m index d7b547a3a7d2..3ac07683eb93 100644 --- a/React/Base/RCTMultipartDataTask.m +++ b/React/Base/RCTMultipartDataTask.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTMultipartStreamReader.h b/React/Base/RCTMultipartStreamReader.h index 5ef5b61daa6a..286842a8799f 100644 --- a/React/Base/RCTMultipartStreamReader.h +++ b/React/Base/RCTMultipartStreamReader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTMultipartStreamReader.m b/React/Base/RCTMultipartStreamReader.m index f7fd28092670..f5854fd49dec 100644 --- a/React/Base/RCTMultipartStreamReader.m +++ b/React/Base/RCTMultipartStreamReader.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTNullability.h b/React/Base/RCTNullability.h index f08d276d9f98..266f3f530c5c 100644 --- a/React/Base/RCTNullability.h +++ b/React/Base/RCTNullability.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #import -typedef NS_ENUM(NSUInteger, RCTNullability) { +typedef NS_ENUM(NSInteger, RCTNullability) { RCTNullabilityUnspecified, RCTNullable, RCTNonnullable, diff --git a/React/Base/RCTPLTag.h b/React/Base/RCTPLTag.h new file mode 100644 index 000000000000..5aa15cb58896 --- /dev/null +++ b/React/Base/RCTPLTag.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +typedef NS_ENUM(NSInteger, RCTPLTag) { + RCTPLScriptDownload = 0, + RCTPLScriptExecution, + RCTPLRAMBundleLoad, + RCTPLRAMStartupCodeSize, + RCTPLRAMStartupNativeRequires, + RCTPLRAMStartupNativeRequiresCount, + RCTPLRAMNativeRequires, + RCTPLRAMNativeRequiresCount, + RCTPLNativeModuleInit, + RCTPLNativeModuleMainThread, + RCTPLNativeModulePrepareConfig, + RCTPLNativeModuleMainThreadUsesCount, + RCTPLNativeModuleSetup, + RCTPLTurboModuleSetup, + RCTPLJSCWrapperOpenLibrary, + RCTPLBridgeStartup, + RCTPLTTI, + RCTPLBundleSize, + RCTPLReactInstanceInit, + RCTPLSize // This is used to count the size +}; diff --git a/React/Base/RCTParserUtils.h b/React/Base/RCTParserUtils.h index 15701f4171d4..5a853a4b937f 100644 --- a/React/Base/RCTParserUtils.h +++ b/React/Base/RCTParserUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTParserUtils.m b/React/Base/RCTParserUtils.m index 64cabd532b6f..b192b0bfaf4d 100644 --- a/React/Base/RCTParserUtils.m +++ b/React/Base/RCTParserUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTPerformanceLogger.h b/React/Base/RCTPerformanceLogger.h index b0e4a4e2a578..3438edd87fa5 100644 --- a/React/Base/RCTPerformanceLogger.h +++ b/React/Base/RCTPerformanceLogger.h @@ -1,35 +1,12 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import - -// Keep this in sync with _labelsForTags -typedef NS_ENUM(NSUInteger, RCTPLTag) { - RCTPLScriptDownload = 0, - RCTPLScriptExecution, - RCTPLRAMBundleLoad, - RCTPLRAMStartupCodeSize, - RCTPLRAMStartupNativeRequires, - RCTPLRAMStartupNativeRequiresCount, - RCTPLRAMNativeRequires, - RCTPLRAMNativeRequiresCount, - RCTPLNativeModuleInit, - RCTPLNativeModuleMainThread, - RCTPLNativeModulePrepareConfig, - RCTPLNativeModuleMainThreadUsesCount, - RCTPLNativeModuleSetup, - RCTPLTurboModuleSetup, - RCTPLJSCWrapperOpenLibrary, - RCTPLBridgeStartup, - RCTPLTTI, - RCTPLBundleSize, - RCTPLReactInstanceInit, - RCTPLSize // This is used to count the size -}; +#import "RCTPLTag.h" @interface RCTPerformanceLogger : NSObject @@ -95,10 +72,4 @@ typedef NS_ENUM(NSUInteger, RCTPLTag) { */ - (int64_t)valueForTag:(RCTPLTag)tag; -/** - * Returns an array with values for all tags. - * Use RCTPLTag to go over the array. - */ -- (NSArray *)labelsForTags; - @end diff --git a/React/Base/RCTPerformanceLogger.m b/React/Base/RCTPerformanceLogger.m index ee71be042a95..582f96010c3e 100644 --- a/React/Base/RCTPerformanceLogger.m +++ b/React/Base/RCTPerformanceLogger.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,54 +9,24 @@ #import "RCTLog.h" #import "RCTPerformanceLogger.h" +#import "RCTPerformanceLoggerLabels.h" #import "RCTProfile.h" #import "RCTRootView.h" @interface RCTPerformanceLogger () { int64_t _data[RCTPLSize][2]; - NSUInteger _cookies[RCTPLSize]; + NSInteger _cookies[RCTPLSize]; } -@property (nonatomic, copy) NSArray *labelsForTags; - @end @implementation RCTPerformanceLogger -- (instancetype)init -{ - if (self = [super init]) { - // Keep this in sync with RCTPLTag - _labelsForTags = @[ - @"ScriptDownload", - @"ScriptExecution", - @"RAMBundleLoad", - @"RAMStartupCodeSize", - @"RAMStartupNativeRequires", - @"RAMStartupNativeRequiresCount", - @"RAMNativeRequires", - @"RAMNativeRequiresCount", - @"NativeModuleInit", - @"NativeModuleMainThread", - @"NativeModulePrepareConfig", - @"NativeModuleMainThreadUsesCount", - @"NativeModuleSetup", - @"TurboModuleSetup", - @"JSCWrapperOpenLibrary", - @"BridgeStartup", - @"RootViewTTI", - @"BundleSize", - @"ReactInstanceInit", - ]; - } - return self; -} - - (void)markStartForTag:(RCTPLTag)tag { #if RCT_PROFILE if (RCTProfileIsProfiling()) { - NSString *label = _labelsForTags[tag]; + NSString *label = RCTPLLabelForTag(tag); _cookies[tag] = RCTProfileBeginAsyncEvent(RCTProfileTagAlways, label, nil); } #endif @@ -68,7 +38,7 @@ - (void)markStopForTag:(RCTPLTag)tag { #if RCT_PROFILE if (RCTProfileIsProfiling()) { - NSString *label = _labelsForTags[tag]; + NSString *label = RCTPLLabelForTag(tag); RCTProfileEndAsyncEvent(RCTProfileTagAlways, @"native", _cookies[tag], label, @"RCTPerformanceLogger"); } #endif diff --git a/React/Base/RCTPerformanceLoggerLabels.h b/React/Base/RCTPerformanceLoggerLabels.h new file mode 100644 index 000000000000..12e0211190ac --- /dev/null +++ b/React/Base/RCTPerformanceLoggerLabels.h @@ -0,0 +1,12 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import "RCTPLTag.h" + +// Return the string label for the enum RCTPLTag for performance logging +__attribute__((used)) RCT_EXTERN NSString *RCTPLLabelForTag(RCTPLTag tag); diff --git a/React/Base/RCTPerformanceLoggerLabels.m b/React/Base/RCTPerformanceLoggerLabels.m new file mode 100644 index 000000000000..5312d1443a8e --- /dev/null +++ b/React/Base/RCTPerformanceLoggerLabels.m @@ -0,0 +1,56 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTPerformanceLoggerLabels.h" +#import + +NSString *RCTPLLabelForTag(RCTPLTag tag) +{ + switch (tag) { + case RCTPLScriptDownload: + return @"ScriptDownload"; + case RCTPLScriptExecution: + return @"ScriptExecution"; + case RCTPLRAMBundleLoad: + return @"RAMBundleLoad"; + case RCTPLRAMStartupCodeSize: + return @"RAMStartupCodeSize"; + case RCTPLRAMStartupNativeRequires: + return @"RAMStartupNativeRequires"; + case RCTPLRAMStartupNativeRequiresCount: + return @"RAMStartupNativeRequiresCount"; + case RCTPLRAMNativeRequires: + return @"RAMNativeRequires"; + case RCTPLRAMNativeRequiresCount: + return @"RAMNativeRequiresCount"; + case RCTPLNativeModuleInit: + return @"NativeModuleInit"; + case RCTPLNativeModuleMainThread: + return @"NativeModuleMainThread"; + case RCTPLNativeModulePrepareConfig: + return @"NativeModulePrepareConfig"; + case RCTPLNativeModuleMainThreadUsesCount: + return @"NativeModuleMainThreadUsesCount"; + case RCTPLNativeModuleSetup: + return @"NativeModuleSetup"; + case RCTPLTurboModuleSetup: + return @"TurboModuleSetup"; + case RCTPLJSCWrapperOpenLibrary: + return @"JSCWrapperOpenLibrary"; + case RCTPLBridgeStartup: + return @"BridgeStartup"; + case RCTPLTTI: + return @"RootViewTTI"; + case RCTPLBundleSize: + return @"BundleSize"; + case RCTPLReactInstanceInit: + return @"ReactInstanceInit"; + case RCTPLSize: // Only used to count enum size + RCTAssert(NO, @"RCTPLSize should not be used to track performance timestamps."); + return nil; + } +} diff --git a/React/Base/RCTRedBoxSetEnabled.h b/React/Base/RCTRedBoxSetEnabled.h index fd53eb7e11e1..f4f46ef0f4ca 100644 --- a/React/Base/RCTRedBoxSetEnabled.h +++ b/React/Base/RCTRedBoxSetEnabled.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRedBoxSetEnabled.m b/React/Base/RCTRedBoxSetEnabled.m index 503e16fe9725..c2900b288eea 100644 --- a/React/Base/RCTRedBoxSetEnabled.m +++ b/React/Base/RCTRedBoxSetEnabled.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTReloadCommand.h b/React/Base/RCTReloadCommand.h index 48462756f42c..2ab722fb82aa 100644 --- a/React/Base/RCTReloadCommand.h +++ b/React/Base/RCTReloadCommand.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTReloadCommand.m b/React/Base/RCTReloadCommand.m index 6c0e41f48894..4d8dd0b03380 100644 --- a/React/Base/RCTReloadCommand.m +++ b/React/Base/RCTReloadCommand.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRootContentView.h b/React/Base/RCTRootContentView.h index dfc6d03813cc..6c93bdde4de4 100644 --- a/React/Base/RCTRootContentView.h +++ b/React/Base/RCTRootContentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRootContentView.m b/React/Base/RCTRootContentView.m index 18612faad5d9..83a5568f066d 100644 --- a/React/Base/RCTRootContentView.m +++ b/React/Base/RCTRootContentView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRootView.h b/React/Base/RCTRootView.h index dd5634531531..32eeb7ab007d 100644 --- a/React/Base/RCTRootView.h +++ b/React/Base/RCTRootView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRootView.m b/React/Base/RCTRootView.m index 4da26ee42b10..122ed87322f1 100644 --- a/React/Base/RCTRootView.m +++ b/React/Base/RCTRootView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRootViewDelegate.h b/React/Base/RCTRootViewDelegate.h index 574915788af6..e2dbc0225337 100644 --- a/React/Base/RCTRootViewDelegate.h +++ b/React/Base/RCTRootViewDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTRootViewInternal.h b/React/Base/RCTRootViewInternal.h index 8e28dd453570..bfff4e089348 100644 --- a/React/Base/RCTRootViewInternal.h +++ b/React/Base/RCTRootViewInternal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTTouchEvent.h b/React/Base/RCTTouchEvent.h index 9f3cc4f9ff38..13a1f25dda6e 100644 --- a/React/Base/RCTTouchEvent.h +++ b/React/Base/RCTTouchEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTTouchEvent.m b/React/Base/RCTTouchEvent.m index 3fcc8d71ae82..4fb743f454bd 100644 --- a/React/Base/RCTTouchEvent.m +++ b/React/Base/RCTTouchEvent.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTTouchHandler.h b/React/Base/RCTTouchHandler.h index 8481a27ffab4..6b1b0642dff0 100644 --- a/React/Base/RCTTouchHandler.h +++ b/React/Base/RCTTouchHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTTouchHandler.m b/React/Base/RCTTouchHandler.m index 668519f978d2..61fc96b86bb9 100644 --- a/React/Base/RCTTouchHandler.m +++ b/React/Base/RCTTouchHandler.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTURLRequestDelegate.h b/React/Base/RCTURLRequestDelegate.h index 8a9e03f91990..835f295a093b 100644 --- a/React/Base/RCTURLRequestDelegate.h +++ b/React/Base/RCTURLRequestDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTURLRequestHandler.h b/React/Base/RCTURLRequestHandler.h index 89f48f5e3b5c..54d41df1afef 100644 --- a/React/Base/RCTURLRequestHandler.h +++ b/React/Base/RCTURLRequestHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTUtils.h b/React/Base/RCTUtils.h index ecb79159413d..135ff2f160da 100644 --- a/React/Base/RCTUtils.h +++ b/React/Base/RCTUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTUtils.m b/React/Base/RCTUtils.m index d33c174e57cf..961cc36b24d0 100644 --- a/React/Base/RCTUtils.m +++ b/React/Base/RCTUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTUtilsUIOverride.h b/React/Base/RCTUtilsUIOverride.h index c6988c6ab456..dc9e76c9e952 100644 --- a/React/Base/RCTUtilsUIOverride.h +++ b/React/Base/RCTUtilsUIOverride.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTUtilsUIOverride.m b/React/Base/RCTUtilsUIOverride.m index f7ccc17f5680..c272d3eeea9f 100644 --- a/React/Base/RCTUtilsUIOverride.m +++ b/React/Base/RCTUtilsUIOverride.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTVersion.h b/React/Base/RCTVersion.h index 5bc858ddf7bc..e0357cbc7951 100644 --- a/React/Base/RCTVersion.h +++ b/React/Base/RCTVersion.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTVersion.m b/React/Base/RCTVersion.m index 7258e0ddb39d..f31564b0ef65 100644 --- a/React/Base/RCTVersion.m +++ b/React/Base/RCTVersion.m @@ -1,7 +1,7 @@ /** - * @generated by scripts/bump-oss-version.js + * @generated by scripts/set-rn-version.js * - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,11 +21,11 @@ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^(void){ __rnVersion = @{ - RCTVersionMajor: @(0), - RCTVersionMinor: @(0), - RCTVersionPatch: @(0), - RCTVersionPrerelease: [NSNull null], - }; + RCTVersionMajor: @(0), + RCTVersionMinor: @(68), + RCTVersionPatch: @(3), + RCTVersionPrerelease: [NSNull null], + }; }); return __rnVersion; } diff --git a/React/Base/RCTViewRegistry.m b/React/Base/RCTViewRegistry.m index d66caa17bb61..f93275dc7996 100644 --- a/React/Base/RCTViewRegistry.m +++ b/React/Base/RCTViewRegistry.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTWeakProxy.h b/React/Base/RCTWeakProxy.h index 472f7f005d0f..5b94da852748 100644 --- a/React/Base/RCTWeakProxy.h +++ b/React/Base/RCTWeakProxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/RCTWeakProxy.m b/React/Base/RCTWeakProxy.m index 725d738a9143..b6547eb7689b 100644 --- a/React/Base/RCTWeakProxy.m +++ b/React/Base/RCTWeakProxy.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurface.h b/React/Base/Surface/RCTSurface.h index b776443800da..1e6d340bf41b 100644 --- a/React/Base/Surface/RCTSurface.h +++ b/React/Base/Surface/RCTSurface.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurface.mm b/React/Base/Surface/RCTSurface.mm index 67c56cb86dc0..49890e732f89 100644 --- a/React/Base/Surface/RCTSurface.mm +++ b/React/Base/Surface/RCTSurface.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -567,18 +567,16 @@ - (void)uiManagerDidPerformMounting:(__unused RCTUIManager *)manager } } -- (BOOL)start +- (void)start { // Does nothing. // The Start&Stop feature is not implemented for regular Surface yet. - return YES; } -- (BOOL)stop +- (void)stop { // Does nothing. // The Start&Stop feature is not implemented for regular Surface yet. - return YES; } #pragma mark - Mounting/Unmounting of React components diff --git a/React/Base/Surface/RCTSurfaceDelegate.h b/React/Base/Surface/RCTSurfaceDelegate.h index 895c2eb97a6c..21d8b9d73dfe 100644 --- a/React/Base/Surface/RCTSurfaceDelegate.h +++ b/React/Base/Surface/RCTSurfaceDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceProtocol.h b/React/Base/Surface/RCTSurfaceProtocol.h index c274df73b17d..0a4bec61cc03 100644 --- a/React/Base/Surface/RCTSurfaceProtocol.h +++ b/React/Base/Surface/RCTSurfaceProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -68,13 +68,12 @@ NS_ASSUME_NONNULL_BEGIN @property (atomic, assign, readonly) CGSize intrinsicSize; #pragma mark - Start & Stop - /** * Starts or stops the Surface. * Those methods are a no-op for regular RCTSurface (for now), but all call sites must call them appropriately. */ -- (BOOL)start; -- (BOOL)stop; +- (void)start; +- (void)stop; @end diff --git a/React/Base/Surface/RCTSurfaceRootShadowView.h b/React/Base/Surface/RCTSurfaceRootShadowView.h index cab8b4ad067e..2898b16b385d 100644 --- a/React/Base/Surface/RCTSurfaceRootShadowView.h +++ b/React/Base/Surface/RCTSurfaceRootShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceRootShadowView.m b/React/Base/Surface/RCTSurfaceRootShadowView.m index 455af97b1ac2..37c551cb4bd3 100644 --- a/React/Base/Surface/RCTSurfaceRootShadowView.m +++ b/React/Base/Surface/RCTSurfaceRootShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h b/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h index 6ad7337d95a8..b13e2f4eb1dd 100644 --- a/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h +++ b/React/Base/Surface/RCTSurfaceRootShadowViewDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceRootView.h b/React/Base/Surface/RCTSurfaceRootView.h index 052476aeffb8..b11d3f476e0a 100644 --- a/React/Base/Surface/RCTSurfaceRootView.h +++ b/React/Base/Surface/RCTSurfaceRootView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceRootView.mm b/React/Base/Surface/RCTSurfaceRootView.mm index c1b929cd8ae2..9682dc5901cc 100644 --- a/React/Base/Surface/RCTSurfaceRootView.mm +++ b/React/Base/Surface/RCTSurfaceRootView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceStage.h b/React/Base/Surface/RCTSurfaceStage.h index 87bf9156f587..2397b752d085 100644 --- a/React/Base/Surface/RCTSurfaceStage.h +++ b/React/Base/Surface/RCTSurfaceStage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceStage.m b/React/Base/Surface/RCTSurfaceStage.m index d9760a1e1feb..937fbf0be095 100644 --- a/React/Base/Surface/RCTSurfaceStage.m +++ b/React/Base/Surface/RCTSurfaceStage.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceView+Internal.h b/React/Base/Surface/RCTSurfaceView+Internal.h index ac4f59fb3f88..c208e5de49fc 100644 --- a/React/Base/Surface/RCTSurfaceView+Internal.h +++ b/React/Base/Surface/RCTSurfaceView+Internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceView.h b/React/Base/Surface/RCTSurfaceView.h index a61e28c85b56..e6bfad491e1b 100644 --- a/React/Base/Surface/RCTSurfaceView.h +++ b/React/Base/Surface/RCTSurfaceView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/RCTSurfaceView.mm b/React/Base/Surface/RCTSurfaceView.mm index 07d0ffc701fb..0f49650d52c4 100644 --- a/React/Base/Surface/RCTSurfaceView.mm +++ b/React/Base/Surface/RCTSurfaceView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h index a7077a5772e8..3b2f79114640 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm index ab4b0fe8a12d..8f48551167f3 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -73,13 +73,10 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge // `RCTRootViewSizeFlexibilityNone` is the RCTRootView's default. RCTSurfaceSizeMeasureMode sizeMeasureMode = convertToSurfaceSizeMeasureMode(RCTRootViewSizeFlexibilityNone); - id surface = [[self class] createSurfaceWithBridge:bridge - moduleName:moduleName - initialProperties:initialProperties]; - [surface start]; - if (self = [super initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) { - // Nothing specific to do. - } + self = [super initWithBridge:bridge + moduleName:moduleName + initialProperties:initialProperties + sizeMeasureMode:sizeMeasureMode]; RCT_PROFILE_END_EVENT(RCTProfileTagAlways, @""); diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h index 0fbbdabc8966..cf301d7a4050 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm index 06d6eabe9d28..9dbfad6548dc 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -46,8 +46,10 @@ - (instancetype)initWithBridge:(RCTBridge *)bridge id surface = [[self class] createSurfaceWithBridge:bridge moduleName:moduleName initialProperties:initialProperties]; - [surface start]; - return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]; + if (self = [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]) { + [surface start]; + } + return self; } - (instancetype)initWithSurface:(id)surface diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h index 0ca27cd0944a..edfc5a0fbc53 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm index 0a88f4db7fe9..8bcb5d1d9324 100644 --- a/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm +++ b/React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/CoreModulesPlugins.h b/React/CoreModules/CoreModulesPlugins.h index 0dd21309bcee..55015a55c127 100644 --- a/React/CoreModules/CoreModulesPlugins.h +++ b/React/CoreModules/CoreModulesPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/CoreModulesPlugins.mm b/React/CoreModules/CoreModulesPlugins.mm index 42ba5e45c9ec..e74ddb8ee019 100644 --- a/React/CoreModules/CoreModulesPlugins.mm +++ b/React/CoreModules/CoreModulesPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAccessibilityManager+Internal.h b/React/CoreModules/RCTAccessibilityManager+Internal.h index e01e80074895..36842eeb214d 100644 --- a/React/CoreModules/RCTAccessibilityManager+Internal.h +++ b/React/CoreModules/RCTAccessibilityManager+Internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAccessibilityManager.h b/React/CoreModules/RCTAccessibilityManager.h index 7b5a132d2626..77f7388aacc5 100644 --- a/React/CoreModules/RCTAccessibilityManager.h +++ b/React/CoreModules/RCTAccessibilityManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAccessibilityManager.mm b/React/CoreModules/RCTAccessibilityManager.mm index 3d0c7765d059..f7ee29c812c1 100644 --- a/React/CoreModules/RCTAccessibilityManager.mm +++ b/React/CoreModules/RCTAccessibilityManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -301,6 +301,28 @@ static void setMultipliers( UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcement); } +RCT_EXPORT_METHOD(announceForAccessibilityWithOptions + : (NSString *)announcement options + : (JS::NativeAccessibilityManager::SpecAnnounceForAccessibilityWithOptionsOptions &)options) +{ + if (@available(iOS 11.0, *)) { + NSMutableDictionary *attrsDictionary = [NSMutableDictionary new]; + if (options.queue()) { + attrsDictionary[UIAccessibilitySpeechAttributeQueueAnnouncement] = @(*(options.queue()) ? YES : NO); + } + + if (attrsDictionary.count > 0) { + NSAttributedString *announcementWithAttrs = [[NSAttributedString alloc] initWithString:announcement + attributes:attrsDictionary]; + UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcementWithAttrs); + } else { + UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcement); + } + } else { + UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, announcement); + } +} + RCT_EXPORT_METHOD(getMultiplier : (RCTResponseSenderBlock)callback) { if (callback) { diff --git a/React/CoreModules/RCTActionSheetManager.h b/React/CoreModules/RCTActionSheetManager.h index 858afcfba562..338310b89c08 100644 --- a/React/CoreModules/RCTActionSheetManager.h +++ b/React/CoreModules/RCTActionSheetManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTActionSheetManager.mm b/React/CoreModules/RCTActionSheetManager.mm index 5cd782ea70a8..ee3c7b69b444 100644 --- a/React/CoreModules/RCTActionSheetManager.mm +++ b/React/CoreModules/RCTActionSheetManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAlertController.h b/React/CoreModules/RCTAlertController.h index f5c206cb1226..62adf2f3ac9e 100644 --- a/React/CoreModules/RCTAlertController.h +++ b/React/CoreModules/RCTAlertController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAlertController.m b/React/CoreModules/RCTAlertController.m index 8cd0babb5595..6287ebf8082d 100644 --- a/React/CoreModules/RCTAlertController.m +++ b/React/CoreModules/RCTAlertController.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #import -#import "RCTAlertController.h" +#import @interface RCTAlertController () @@ -35,6 +35,12 @@ - (void)show:(BOOL)animated completion:(void (^)(void))completion - (void)hide { + [_alertWindow setHidden:YES]; + + if (@available(iOS 13, *)) { + _alertWindow.windowScene = nil; + } + _alertWindow = nil; } diff --git a/React/CoreModules/RCTAlertManager.h b/React/CoreModules/RCTAlertManager.h index 8ea1d9b0204d..2d2a7446fd53 100644 --- a/React/CoreModules/RCTAlertManager.h +++ b/React/CoreModules/RCTAlertManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAlertManager.mm b/React/CoreModules/RCTAlertManager.mm index e0f450e480e7..c4a1cde52dcb 100644 --- a/React/CoreModules/RCTAlertManager.mm +++ b/React/CoreModules/RCTAlertManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAppState.h b/React/CoreModules/RCTAppState.h index 0921f70e4472..073d553b1533 100644 --- a/React/CoreModules/RCTAppState.h +++ b/React/CoreModules/RCTAppState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAppState.mm b/React/CoreModules/RCTAppState.mm index 5fc28ef71c87..5de33f4b037d 100644 --- a/React/CoreModules/RCTAppState.mm +++ b/React/CoreModules/RCTAppState.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAppearance.h b/React/CoreModules/RCTAppearance.h index d8c358522fd0..d8bb18b89ac3 100644 --- a/React/CoreModules/RCTAppearance.h +++ b/React/CoreModules/RCTAppearance.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,6 +12,7 @@ RCT_EXTERN void RCTEnableAppearancePreference(BOOL enabled); RCT_EXTERN void RCTOverrideAppearancePreference(NSString *const); +RCT_EXTERN NSString *RCTCurrentOverrideAppearancePreference(); RCT_EXTERN NSString *RCTColorSchemePreference(UITraitCollection *traitCollection); @interface RCTAppearance : RCTEventEmitter diff --git a/React/CoreModules/RCTAppearance.mm b/React/CoreModules/RCTAppearance.mm index 1d762b67cc5f..71259d4a98d1 100644 --- a/React/CoreModules/RCTAppearance.mm +++ b/React/CoreModules/RCTAppearance.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,6 +30,11 @@ void RCTOverrideAppearancePreference(NSString *const colorSchemeOverride) sColorSchemeOverride = colorSchemeOverride; } +NSString *RCTCurrentOverrideAppearancePreference() +{ + return sColorSchemeOverride; +} + NSString *RCTColorSchemePreference(UITraitCollection *traitCollection) { #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ diff --git a/React/CoreModules/RCTAsyncLocalStorage.h b/React/CoreModules/RCTAsyncLocalStorage.h index d43281cd10ee..66136c871107 100644 --- a/React/CoreModules/RCTAsyncLocalStorage.h +++ b/React/CoreModules/RCTAsyncLocalStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTAsyncLocalStorage.mm b/React/CoreModules/RCTAsyncLocalStorage.mm index f0fb9081a22d..326ea78f8d69 100644 --- a/React/CoreModules/RCTAsyncLocalStorage.mm +++ b/React/CoreModules/RCTAsyncLocalStorage.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTClipboard.h b/React/CoreModules/RCTClipboard.h index 1dd9789899eb..8606b225ea37 100644 --- a/React/CoreModules/RCTClipboard.h +++ b/React/CoreModules/RCTClipboard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTClipboard.mm b/React/CoreModules/RCTClipboard.mm index ffa1d8d1fdd7..2dc098a47302 100644 --- a/React/CoreModules/RCTClipboard.mm +++ b/React/CoreModules/RCTClipboard.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDevLoadingView.h b/React/CoreModules/RCTDevLoadingView.h index da5ad2d5e8e6..175adc56ccc7 100644 --- a/React/CoreModules/RCTDevLoadingView.h +++ b/React/CoreModules/RCTDevLoadingView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDevLoadingView.mm b/React/CoreModules/RCTDevLoadingView.mm index c81ba1fbfb49..316c2489207d 100644 --- a/React/CoreModules/RCTDevLoadingView.mm +++ b/React/CoreModules/RCTDevLoadingView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDevMenu.h b/React/CoreModules/RCTDevMenu.h index b322afb38b06..e0324754c8d5 100644 --- a/React/CoreModules/RCTDevMenu.h +++ b/React/CoreModules/RCTDevMenu.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDevMenu.mm b/React/CoreModules/RCTDevMenu.mm index 881c3f2eac19..6d47652b6afe 100644 --- a/React/CoreModules/RCTDevMenu.mm +++ b/React/CoreModules/RCTDevMenu.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -210,8 +210,7 @@ - (void)addItem:(RCTDevMenuItem *)item - (void)setDefaultJSBundle { [[RCTBundleURLProvider sharedSettings] resetToDefaults]; - self->_bundleManager.bundleURL = [[RCTBundleURLProvider sharedSettings] jsBundleURLForFallbackResource:nil - fallbackExtension:nil]; + self->_bundleManager.bundleURL = [[RCTBundleURLProvider sharedSettings] jsBundleURLForFallbackExtension:nil]; RCTTriggerReloadCommandListeners(@"Dev menu - reset to default"); } @@ -350,7 +349,7 @@ - (void)setDefaultJSBundle [weakSelf setDefaultJSBundle]; return; } - NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + NSNumberFormatter *formatter = [NSNumberFormatter new]; formatter.numberStyle = NSNumberFormatterDecimalStyle; NSNumber *portNumber = [formatter numberFromString:portTextField.text]; @@ -363,8 +362,7 @@ - (void)setDefaultJSBundle [bundleManager resetBundleURL]; } else { bundleManager.bundleURL = [[RCTBundleURLProvider sharedSettings] - jsBundleURLForBundleRoot:bundleRoot - fallbackResource:nil]; + jsBundleURLForBundleRoot:bundleRoot]; } RCTTriggerReloadCommandListeners(@"Dev menu - apply changes"); diff --git a/React/CoreModules/RCTDevSettings.h b/React/CoreModules/RCTDevSettings.h index 9661caf51bfb..c576e372f4b0 100644 --- a/React/CoreModules/RCTDevSettings.h +++ b/React/CoreModules/RCTDevSettings.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDevSettings.mm b/React/CoreModules/RCTDevSettings.mm index 47258efe7066..837865b5477f 100644 --- a/React/CoreModules/RCTDevSettings.mm +++ b/React/CoreModules/RCTDevSettings.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -202,20 +202,31 @@ - (void)initialize // We need this dispatch to the main thread because the bridge is not yet // finished with its initialisation. By the time it relinquishes control of // the main thread, this operation can be performed. + __weak __typeof(self) weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ - [self.bridge - dispatchBlock:^{ - [RCTInspectorDevServerHelper connectWithBundleURL:self.bundleManager.bundleURL]; - } - queue:RCTJSThread]; + __typeof(self) strongSelf = weakSelf; + if (!strongSelf) { + return; + } + id dispatchBlock = ^{ + __typeof(self) strongSelf2 = weakSelf; + if (!strongSelf2) { + return; + } + NSURL *url = strongSelf2.bundleManager.bundleURL; + [RCTInspectorDevServerHelper connectWithBundleURL:url]; + }; + [strongSelf.bridge dispatchBlock:dispatchBlock queue:RCTJSThread]; }); } else { - [RCTInspectorDevServerHelper connectWithBundleURL:self.bundleManager.bundleURL]; + NSURL *url = self.bundleManager.bundleURL; + [RCTInspectorDevServerHelper connectWithBundleURL:url]; } #endif + __weak __typeof(self) weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ - [self _synchronizeAllSettings]; + [weakSelf _synchronizeAllSettings]; }); } @@ -350,8 +361,13 @@ - (void)_profilingSettingDidChange if (enabled) { [self.bridge startProfiling]; } else { + __weak __typeof(self) weakSelf = self; [self.bridge stopProfiling:^(NSData *logData) { - RCTProfileSendResult(self.bridge, @"systrace", logData); + __typeof(self) strongSelf = weakSelf; + if (!strongSelf) { + return; + } + RCTProfileSendResult(strongSelf.bridge, @"systrace", logData); }]; } } @@ -495,16 +511,21 @@ - (void)jsLoaded:(NSNotification *)notification } _isJSLoaded = YES; + __weak __typeof(self) weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ + __typeof(self) strongSelf = weakSelf; + if (!strongSelf) { + return; + } // update state again after the bridge has finished loading - [self _synchronizeAllSettings]; + [strongSelf _synchronizeAllSettings]; // Inspector can only be shown after JS has loaded - if ([self isElementInspectorShown]) { + if ([strongSelf isElementInspectorShown]) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[self.moduleRegistry moduleForName:"EventDispatcher"] sendDeviceEventWithName:@"toggleElementInspector" - body:nil]; + [[strongSelf.moduleRegistry moduleForName:"EventDispatcher"] sendDeviceEventWithName:@"toggleElementInspector" + body:nil]; #pragma clang diagnostic pop } }); diff --git a/React/CoreModules/RCTDevSplitBundleLoader.h b/React/CoreModules/RCTDevSplitBundleLoader.h index 52a115c12a87..c5a1efc3f5eb 100644 --- a/React/CoreModules/RCTDevSplitBundleLoader.h +++ b/React/CoreModules/RCTDevSplitBundleLoader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDevSplitBundleLoader.mm b/React/CoreModules/RCTDevSplitBundleLoader.mm index fc7b2df23eb1..8eb756db0e02 100644 --- a/React/CoreModules/RCTDevSplitBundleLoader.mm +++ b/React/CoreModules/RCTDevSplitBundleLoader.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDeviceInfo.h b/React/CoreModules/RCTDeviceInfo.h index cef03bee1be5..5b129ea8dced 100644 --- a/React/CoreModules/RCTDeviceInfo.h +++ b/React/CoreModules/RCTDeviceInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTDeviceInfo.mm b/React/CoreModules/RCTDeviceInfo.mm index 66951b13685b..b948e8e479b7 100644 --- a/React/CoreModules/RCTDeviceInfo.mm +++ b/React/CoreModules/RCTDeviceInfo.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTEventDispatcher.h b/React/CoreModules/RCTEventDispatcher.h index bbcd643cdfb0..3b31791ae73d 100644 --- a/React/CoreModules/RCTEventDispatcher.h +++ b/React/CoreModules/RCTEventDispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTEventDispatcher.mm b/React/CoreModules/RCTEventDispatcher.mm index 5b2dad2d61ba..ab63111c874a 100644 --- a/React/CoreModules/RCTEventDispatcher.mm +++ b/React/CoreModules/RCTEventDispatcher.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTExceptionsManager.h b/React/CoreModules/RCTExceptionsManager.h index 28ae105ef48c..4da14cb67f78 100644 --- a/React/CoreModules/RCTExceptionsManager.h +++ b/React/CoreModules/RCTExceptionsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTExceptionsManager.mm b/React/CoreModules/RCTExceptionsManager.mm index 749e3914eb6c..ca1aafca6d4a 100644 --- a/React/CoreModules/RCTExceptionsManager.mm +++ b/React/CoreModules/RCTExceptionsManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -91,7 +91,7 @@ - (void)reportFatal:(NSString *)message stack:(NSArray *)stack e : (double)exceptionId) { RCTRedBox *redbox = [_moduleRegistry moduleForName:"RedBox"]; - [redbox showErrorMessage:message withStack:stack errorCookie:(int)exceptionId]; + [redbox updateErrorMessage:message withStack:stack errorCookie:(int)exceptionId]; if (_delegate && [_delegate respondsToSelector:@selector(updateJSExceptionWithMessage:stack:exceptionId:)]) { [_delegate updateJSExceptionWithMessage:message stack:stack exceptionId:[NSNumber numberWithDouble:exceptionId]]; diff --git a/React/CoreModules/RCTFPSGraph.h b/React/CoreModules/RCTFPSGraph.h index 73dd6bd96aef..7b90481a6eba 100644 --- a/React/CoreModules/RCTFPSGraph.h +++ b/React/CoreModules/RCTFPSGraph.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTFPSGraph.m b/React/CoreModules/RCTFPSGraph.m index bee27f329463..afb4cfcf4e50 100644 --- a/React/CoreModules/RCTFPSGraph.m +++ b/React/CoreModules/RCTFPSGraph.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -97,18 +97,18 @@ - (void)onTick:(NSTimeInterval)timestamp self->_label.text = [NSString stringWithFormat:@"%lu", (unsigned long)self->_FPS]; }); - CGFloat scale = 60.0 / _height; + CGFloat scale = 60.0 / (CGFloat)_height; for (NSUInteger i = 0; i < _length - 1; i++) { _frames[i] = _frames[i + 1]; } _frames[_length - 1] = _FPS / scale; CGMutablePathRef path = CGPathCreateMutable(); - CGPathMoveToPoint(path, NULL, 0, _height); + CGPathMoveToPoint(path, NULL, 0, (CGFloat)_height); for (NSUInteger i = 0; i < _length; i++) { - CGPathAddLineToPoint(path, NULL, i, _height - _frames[i]); + CGPathAddLineToPoint(path, NULL, (CGFloat)i, _height - _frames[i]); } - CGPathAddLineToPoint(path, NULL, _length - 1, _height); + CGPathAddLineToPoint(path, NULL, (CGFloat)_length - 1, (CGFloat)_height); _graph.path = path; CGPathRelease(path); diff --git a/React/CoreModules/RCTI18nManager.h b/React/CoreModules/RCTI18nManager.h index 5f21ec47a96e..b500708be96b 100644 --- a/React/CoreModules/RCTI18nManager.h +++ b/React/CoreModules/RCTI18nManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTI18nManager.mm b/React/CoreModules/RCTI18nManager.mm index e9acaac29074..7d3b9eaa11cf 100644 --- a/React/CoreModules/RCTI18nManager.mm +++ b/React/CoreModules/RCTI18nManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTKeyboardObserver.h b/React/CoreModules/RCTKeyboardObserver.h index 320b65d61794..76c491dcd52f 100644 --- a/React/CoreModules/RCTKeyboardObserver.h +++ b/React/CoreModules/RCTKeyboardObserver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTKeyboardObserver.mm b/React/CoreModules/RCTKeyboardObserver.mm index 1901a08e1242..ce483ddceb95 100644 --- a/React/CoreModules/RCTKeyboardObserver.mm +++ b/React/CoreModules/RCTKeyboardObserver.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTLogBox.h b/React/CoreModules/RCTLogBox.h index e3bf6adc5d7a..17f7f4d98ef8 100644 --- a/React/CoreModules/RCTLogBox.h +++ b/React/CoreModules/RCTLogBox.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTLogBox.mm b/React/CoreModules/RCTLogBox.mm index 141daf8214ca..d8113e96b5fb 100644 --- a/React/CoreModules/RCTLogBox.mm +++ b/React/CoreModules/RCTLogBox.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -72,6 +72,7 @@ + (BOOL)requiresMainQueueSetup if (!strongSelf) { return; } + [strongSelf->_view setHidden:YES]; strongSelf->_view = nil; }); } diff --git a/React/CoreModules/RCTLogBoxView.h b/React/CoreModules/RCTLogBoxView.h index 7c05bcb8952b..30de9fda8889 100644 --- a/React/CoreModules/RCTLogBoxView.h +++ b/React/CoreModules/RCTLogBoxView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTLogBoxView.mm b/React/CoreModules/RCTLogBoxView.mm index ab42c906a740..c61b8c5ae206 100644 --- a/React/CoreModules/RCTLogBoxView.mm +++ b/React/CoreModules/RCTLogBoxView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTPerfMonitor.mm b/React/CoreModules/RCTPerfMonitor.mm index a28305f7f7c0..832cd32c3c1f 100644 --- a/React/CoreModules/RCTPerfMonitor.mm +++ b/React/CoreModules/RCTPerfMonitor.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,6 +24,7 @@ #import #import #import +#import #import #import #import @@ -40,6 +41,8 @@ typedef BOOL (*RCTJSCSetOptionType)(const char *); +NSArray *LabelsForRCTPerformanceLoggerTags(); + static BOOL RCTJSCSetOption(const char *option) { static RCTJSCSetOptionType setOption; @@ -515,7 +518,7 @@ - (void)loadPerformanceLoggerData NSMutableArray *data = [NSMutableArray new]; RCTPerformanceLogger *performanceLogger = [_bridge performanceLogger]; NSArray *values = [performanceLogger valuesForTags]; - for (NSString *label in [performanceLogger labelsForTags]) { + for (NSString *label in LabelsForRCTPerformanceLoggerTags()) { long long value = values[i + 1].longLongValue - values[i].longLongValue; NSString *unit = @"ms"; if ([label hasSuffix:@"Size"]) { @@ -572,6 +575,15 @@ - (CGFloat)tableView:(__unused UITableView *)tableView heightForRowAtIndexPath:( @end +NSArray *LabelsForRCTPerformanceLoggerTags() +{ + NSMutableArray *labels = [NSMutableArray new]; + for (int i = 0; i < RCTPLSize; i++) { + [labels addObject:RCTPLLabelForTag((RCTPLTag)i)]; + } + return labels; +} + #endif Class RCTPerfMonitorCls(void) diff --git a/React/CoreModules/RCTPlatform.h b/React/CoreModules/RCTPlatform.h index 64ce56705a66..f1e9d6a5e7ce 100644 --- a/React/CoreModules/RCTPlatform.h +++ b/React/CoreModules/RCTPlatform.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTPlatform.mm b/React/CoreModules/RCTPlatform.mm index fdf746726215..bf0fed1cdff1 100644 --- a/React/CoreModules/RCTPlatform.mm +++ b/React/CoreModules/RCTPlatform.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTRedBox.h b/React/CoreModules/RCTRedBox.h index d468f449fcc6..5d67a2a57a91 100644 --- a/React/CoreModules/RCTRedBox.h +++ b/React/CoreModules/RCTRedBox.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTRedBox.mm b/React/CoreModules/RCTRedBox.mm index 8a4f6573ed09..4d86309b0647 100644 --- a/React/CoreModules/RCTRedBox.mm +++ b/React/CoreModules/RCTRedBox.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -138,8 +138,8 @@ - (instancetype)initWithFrame:(CGRect)frame selector:@selector(showExtraDataViewController) block:nil]; - CGFloat buttonWidth = frame.size.width / (4 + [customButtonTitles count]); - CGFloat bottomButtonHeight = frame.size.height - buttonHeight - [self bottomSafeViewHeight]; + CGFloat buttonWidth = frame.size.width / (CGFloat)(4 + [customButtonTitles count]); + CGFloat bottomButtonHeight = frame.size.height - buttonHeight - (CGFloat)[self bottomSafeViewHeight]; dismissButton.frame = CGRectMake(0, bottomButtonHeight, buttonWidth, buttonHeight); reloadButton.frame = CGRectMake(buttonWidth, bottomButtonHeight, buttonWidth, buttonHeight); copyButton.frame = CGRectMake(buttonWidth * 2, bottomButtonHeight, buttonWidth, buttonHeight); @@ -167,8 +167,11 @@ - (instancetype)initWithFrame:(CGRect)frame UIView *bottomSafeView = [UIView new]; bottomSafeView.backgroundColor = [UIColor colorWithRed:0.1 green:0.1 blue:0.1 alpha:1]; - bottomSafeView.frame = - CGRectMake(0, frame.size.height - [self bottomSafeViewHeight], frame.size.width, [self bottomSafeViewHeight]); + bottomSafeView.frame = CGRectMake( + 0, + frame.size.height - (CGFloat)[self bottomSafeViewHeight], + frame.size.width, + (CGFloat)[self bottomSafeViewHeight]); [rootView addSubview:bottomSafeView]; } diff --git a/React/CoreModules/RCTSourceCode.h b/React/CoreModules/RCTSourceCode.h index fd0e38795750..e8332f78aa24 100644 --- a/React/CoreModules/RCTSourceCode.h +++ b/React/CoreModules/RCTSourceCode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTSourceCode.mm b/React/CoreModules/RCTSourceCode.mm index 1b3e424f831d..2589b34d3daa 100644 --- a/React/CoreModules/RCTSourceCode.mm +++ b/React/CoreModules/RCTSourceCode.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTStatusBarManager.h b/React/CoreModules/RCTStatusBarManager.h index db02b9176a69..ff1e02e0d679 100644 --- a/React/CoreModules/RCTStatusBarManager.h +++ b/React/CoreModules/RCTStatusBarManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTStatusBarManager.mm b/React/CoreModules/RCTStatusBarManager.mm index c40fdd4379e0..19d1d8f89ba9 100644 --- a/React/CoreModules/RCTStatusBarManager.mm +++ b/React/CoreModules/RCTStatusBarManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTTiming.h b/React/CoreModules/RCTTiming.h index 7c197aaa9c9d..1039f254ceae 100644 --- a/React/CoreModules/RCTTiming.h +++ b/React/CoreModules/RCTTiming.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTTiming.mm b/React/CoreModules/RCTTiming.mm index 70f0543eca7b..13d0d57296bb 100644 --- a/React/CoreModules/RCTTiming.mm +++ b/React/CoreModules/RCTTiming.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTWebSocketExecutor.h b/React/CoreModules/RCTWebSocketExecutor.h index 499664b3efc9..2c671d1f6779 100644 --- a/React/CoreModules/RCTWebSocketExecutor.h +++ b/React/CoreModules/RCTWebSocketExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTWebSocketExecutor.mm b/React/CoreModules/RCTWebSocketExecutor.mm index 5fd06fb09f67..9418dd63891e 100644 --- a/React/CoreModules/RCTWebSocketExecutor.mm +++ b/React/CoreModules/RCTWebSocketExecutor.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTWebSocketModule.h b/React/CoreModules/RCTWebSocketModule.h index c1a48d3d31b9..0e39e18f990c 100644 --- a/React/CoreModules/RCTWebSocketModule.h +++ b/React/CoreModules/RCTWebSocketModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/RCTWebSocketModule.mm b/React/CoreModules/RCTWebSocketModule.mm index 32889ea7d4bd..c099328eaff6 100644 --- a/React/CoreModules/RCTWebSocketModule.mm +++ b/React/CoreModules/RCTWebSocketModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CoreModules/React-CoreModules.podspec b/React/CoreModules/React-CoreModules.podspec index fa3bc3a106a8..3e0b4f7bfa76 100644 --- a/React/CoreModules/React-CoreModules.podspec +++ b/React/CoreModules/React-CoreModules.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -34,10 +34,10 @@ Pod::Spec.new do |s| s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\" \"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } - s.dependency "FBReactNativeSpec", version + s.dependency "React-Codegen", version s.dependency "RCT-Folly", folly_version s.dependency "RCTTypeSafety", version s.dependency "React-Core/CoreModulesHeaders", version diff --git a/React/CxxBridge/JSCExecutorFactory.h b/React/CxxBridge/JSCExecutorFactory.h index 27296f88f74d..17b64037c72e 100644 --- a/React/CxxBridge/JSCExecutorFactory.h +++ b/React/CxxBridge/JSCExecutorFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/JSCExecutorFactory.mm b/React/CxxBridge/JSCExecutorFactory.mm index 104375b1f694..4d8a1ba1b294 100644 --- a/React/CxxBridge/JSCExecutorFactory.mm +++ b/React/CxxBridge/JSCExecutorFactory.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/NSDataBigString.h b/React/CxxBridge/NSDataBigString.h index 8bf0706d278e..c7f5ae7f61ea 100644 --- a/React/CxxBridge/NSDataBigString.h +++ b/React/CxxBridge/NSDataBigString.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/NSDataBigString.mm b/React/CxxBridge/NSDataBigString.mm index b31daabac89f..5708fa78a243 100644 --- a/React/CxxBridge/NSDataBigString.mm +++ b/React/CxxBridge/NSDataBigString.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/RCTCxxBridge.mm b/React/CxxBridge/RCTCxxBridge.mm index 77bae805a7f7..64b456dfe089 100644 --- a/React/CxxBridge/RCTCxxBridge.mm +++ b/React/CxxBridge/RCTCxxBridge.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -76,7 +76,7 @@ /** * Must be kept in sync with `MessageQueue.js`. */ -typedef NS_ENUM(NSUInteger, RCTBridgeFields) { +typedef NS_ENUM(NSInteger, RCTBridgeFields) { RCTBridgeFieldRequestModuleIDs = 0, RCTBridgeFieldMethodIDs, RCTBridgeFieldParams, @@ -136,8 +136,7 @@ static void notifyAboutModuleSetup(RCTPerformanceLogger *performanceLogger, cons static void mapReactMarkerToPerformanceLogger( const ReactMarker::ReactMarkerId markerId, RCTPerformanceLogger *performanceLogger, - const char *tag, - int instanceKey) + const char *tag) { switch (markerId) { case ReactMarker::RUN_JS_BUNDLE_START: @@ -177,13 +176,8 @@ static void registerPerformanceLoggerHooks(RCTPerformanceLogger *performanceLogg { __weak RCTPerformanceLogger *weakPerformanceLogger = performanceLogger; ReactMarker::logTaggedMarker = [weakPerformanceLogger](const ReactMarker::ReactMarkerId markerId, const char *tag) { - mapReactMarkerToPerformanceLogger(markerId, weakPerformanceLogger, tag, 0); + mapReactMarkerToPerformanceLogger(markerId, weakPerformanceLogger, tag); }; - - ReactMarker::logTaggedMarkerWithInstanceKey = - [weakPerformanceLogger](const ReactMarker::ReactMarkerId markerId, const char *tag, const int instanceKey) { - mapReactMarkerToPerformanceLogger(markerId, weakPerformanceLogger, tag, instanceKey); - }; } @interface RCTCxxBridge () diff --git a/React/CxxBridge/RCTCxxBridgeDelegate.h b/React/CxxBridge/RCTCxxBridgeDelegate.h index c574eee4fe5c..0285b70f217e 100644 --- a/React/CxxBridge/RCTCxxBridgeDelegate.h +++ b/React/CxxBridge/RCTCxxBridgeDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.h b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.h index 9ec6bf958f70..2a40f8316ba2 100644 --- a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.h +++ b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm index ae811e14cb0b..da0f919a3f86 100644 --- a/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm +++ b/React/CxxBridge/RCTJSIExecutorRuntimeInstaller.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ #include "RCTJSIExecutorRuntimeInstaller.h" #import +#include namespace facebook { namespace react { @@ -21,8 +22,14 @@ bindNativeLogger(runtime, iosLoggingBinder); PerformanceNow iosPerformanceNowBinder = []() { - // CACurrentMediaTime() returns the current absolute time, in seconds - return CACurrentMediaTime() * 1000; + auto time = std::chrono::steady_clock::now(); + auto duration = std::chrono::duration_cast( + time.time_since_epoch()) + .count(); + + constexpr double NANOSECONDS_IN_MILLISECOND = 1000000.0; + + return duration / NANOSECONDS_IN_MILLISECOND; }; bindNativePerformanceNow(runtime, iosPerformanceNowBinder); diff --git a/React/CxxBridge/RCTMessageThread.h b/React/CxxBridge/RCTMessageThread.h index b15c536d0a14..c68fc281a405 100644 --- a/React/CxxBridge/RCTMessageThread.h +++ b/React/CxxBridge/RCTMessageThread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/RCTMessageThread.mm b/React/CxxBridge/RCTMessageThread.mm index c340fa7b737a..48b2a604e7ea 100644 --- a/React/CxxBridge/RCTMessageThread.mm +++ b/React/CxxBridge/RCTMessageThread.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/RCTObjcExecutor.h b/React/CxxBridge/RCTObjcExecutor.h index 49f21de2c0c8..9cba372d4b0f 100644 --- a/React/CxxBridge/RCTObjcExecutor.h +++ b/React/CxxBridge/RCTObjcExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxBridge/RCTObjcExecutor.mm b/React/CxxBridge/RCTObjcExecutor.mm index 7eebcfcdde23..df22d637bde3 100644 --- a/React/CxxBridge/RCTObjcExecutor.mm +++ b/React/CxxBridge/RCTObjcExecutor.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxLogUtils/RCTDefaultCxxLogFunction.h b/React/CxxLogUtils/RCTDefaultCxxLogFunction.h new file mode 100644 index 000000000000..2c745d5e7ede --- /dev/null +++ b/React/CxxLogUtils/RCTDefaultCxxLogFunction.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#import + +namespace facebook { +namespace react { + +void RCTDefaultCxxLogFunction(ReactNativeLogLevel level, const char *message); + +} // namespace react +} // namespace facebook diff --git a/React/CxxLogUtils/RCTDefaultCxxLogFunction.mm b/React/CxxLogUtils/RCTDefaultCxxLogFunction.mm new file mode 100644 index 000000000000..449c7b3b3a37 --- /dev/null +++ b/React/CxxLogUtils/RCTDefaultCxxLogFunction.mm @@ -0,0 +1,39 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTDefaultCxxLogFunction.h" +#import +#import + +namespace facebook { +namespace react { + +void RCTDefaultCxxLogFunction(ReactNativeLogLevel level, const char *message) +{ + NSString *messageString = [NSString stringWithUTF8String:message]; + + switch (level) { + case ReactNativeLogLevelInfo: + LOG(INFO) << message; + RCTLogInfo(@"%@", messageString); + break; + case ReactNativeLogLevelWarning: + LOG(WARNING) << message; + RCTLogWarn(@"%@", messageString); + break; + case ReactNativeLogLevelError: + LOG(ERROR) << message; + RCTLogError(@"%@", messageString); + break; + case ReactNativeLogLevelFatal: + LOG(FATAL) << message; + break; + } +} + +} // namespace react +} // namespace facebook diff --git a/React/CxxModule/DispatchMessageQueueThread.h b/React/CxxModule/DispatchMessageQueueThread.h index b6ca75a3de7e..76eaa15fd975 100644 --- a/React/CxxModule/DispatchMessageQueueThread.h +++ b/React/CxxModule/DispatchMessageQueueThread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTCxxMethod.h b/React/CxxModule/RCTCxxMethod.h index 6bac059e5a43..f126032dca48 100644 --- a/React/CxxModule/RCTCxxMethod.h +++ b/React/CxxModule/RCTCxxMethod.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTCxxMethod.mm b/React/CxxModule/RCTCxxMethod.mm index 7ae1419a5a5d..4fc4a2abbc39 100644 --- a/React/CxxModule/RCTCxxMethod.mm +++ b/React/CxxModule/RCTCxxMethod.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTCxxModule.h b/React/CxxModule/RCTCxxModule.h index 86ee35607222..75d95a30901d 100644 --- a/React/CxxModule/RCTCxxModule.h +++ b/React/CxxModule/RCTCxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTCxxModule.mm b/React/CxxModule/RCTCxxModule.mm index dd90009d4175..4ea318372599 100644 --- a/React/CxxModule/RCTCxxModule.mm +++ b/React/CxxModule/RCTCxxModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTCxxUtils.h b/React/CxxModule/RCTCxxUtils.h index caf584f35e46..cc1454f07601 100644 --- a/React/CxxModule/RCTCxxUtils.h +++ b/React/CxxModule/RCTCxxUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTCxxUtils.mm b/React/CxxModule/RCTCxxUtils.mm index b81a8da54ae9..03f0ad0c83d8 100644 --- a/React/CxxModule/RCTCxxUtils.mm +++ b/React/CxxModule/RCTCxxUtils.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTNativeModule.h b/React/CxxModule/RCTNativeModule.h index a59f9ae48181..a83b16dd7b79 100644 --- a/React/CxxModule/RCTNativeModule.h +++ b/React/CxxModule/RCTNativeModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxModule/RCTNativeModule.mm b/React/CxxModule/RCTNativeModule.mm index cea144f5f469..ebc3eda4eb59 100644 --- a/React/CxxModule/RCTNativeModule.mm +++ b/React/CxxModule/RCTNativeModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxUtils/RCTFollyConvert.h b/React/CxxUtils/RCTFollyConvert.h index cd87ddcb5948..7a0c23953976 100644 --- a/React/CxxUtils/RCTFollyConvert.h +++ b/React/CxxUtils/RCTFollyConvert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/CxxUtils/RCTFollyConvert.mm b/React/CxxUtils/RCTFollyConvert.mm index 59f10e321db0..4efcdcd3d8bf 100644 --- a/React/CxxUtils/RCTFollyConvert.mm +++ b/React/CxxUtils/RCTFollyConvert.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTDevLoadingViewProtocol.h b/React/DevSupport/RCTDevLoadingViewProtocol.h index 001a18e13f9d..ec9ed3a36c81 100644 --- a/React/DevSupport/RCTDevLoadingViewProtocol.h +++ b/React/DevSupport/RCTDevLoadingViewProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTDevLoadingViewSetEnabled.h b/React/DevSupport/RCTDevLoadingViewSetEnabled.h index 1ad182578cde..8657489ff58b 100644 --- a/React/DevSupport/RCTDevLoadingViewSetEnabled.h +++ b/React/DevSupport/RCTDevLoadingViewSetEnabled.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTDevLoadingViewSetEnabled.m b/React/DevSupport/RCTDevLoadingViewSetEnabled.m index 0c90e6638520..34527776b120 100644 --- a/React/DevSupport/RCTDevLoadingViewSetEnabled.m +++ b/React/DevSupport/RCTDevLoadingViewSetEnabled.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTInspectorDevServerHelper.h b/React/DevSupport/RCTInspectorDevServerHelper.h index b69fa02bc2a2..f527f50a1a2f 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.h +++ b/React/DevSupport/RCTInspectorDevServerHelper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTInspectorDevServerHelper.mm b/React/DevSupport/RCTInspectorDevServerHelper.mm index 21000646fad7..687297d8c46f 100644 --- a/React/DevSupport/RCTInspectorDevServerHelper.mm +++ b/React/DevSupport/RCTInspectorDevServerHelper.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTPackagerClient.h b/React/DevSupport/RCTPackagerClient.h index 3a7a3fd504f7..6dea84f358a5 100644 --- a/React/DevSupport/RCTPackagerClient.h +++ b/React/DevSupport/RCTPackagerClient.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTPackagerClient.m b/React/DevSupport/RCTPackagerClient.m index 1cd9a07a576f..2caa336f72dc 100644 --- a/React/DevSupport/RCTPackagerClient.m +++ b/React/DevSupport/RCTPackagerClient.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTPackagerConnection.h b/React/DevSupport/RCTPackagerConnection.h index 795a3fcad5b3..014f73f97933 100644 --- a/React/DevSupport/RCTPackagerConnection.h +++ b/React/DevSupport/RCTPackagerConnection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/DevSupport/RCTPackagerConnection.mm b/React/DevSupport/RCTPackagerConnection.mm index 4434d67ca62f..199f8ac42ad3 100644 --- a/React/DevSupport/RCTPackagerConnection.mm +++ b/React/DevSupport/RCTPackagerConnection.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/FBReactNativeSpec/FBReactNativeSpec.podspec b/React/FBReactNativeSpec/FBReactNativeSpec.podspec index 55e45fbbb9d2..16079fdb166a 100644 --- a/React/FBReactNativeSpec/FBReactNativeSpec.podspec +++ b/React/FBReactNativeSpec/FBReactNativeSpec.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -32,13 +32,14 @@ Pod::Spec.new do |s| s.platforms = { :ios => "11.0" } s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' s.source = source - s.source_files = "**/FBReactNativeSpec*.{h,mm}" + # This podspec is used to trigger the codegen, and built files are generated in a different location. + # We don't want this pod to actually include any files. s.header_dir = "FBReactNativeSpec" s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", "CLANG_CXX_LANGUAGE_STANDARD" => "c++14", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/React/FBReactNativeSpec\" \"$(PODS_ROOT)/RCT-Folly\"" + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\"" } s.dependency "RCT-Folly", folly_version @@ -53,6 +54,5 @@ Pod::Spec.new do |s| :js_srcs_dir => "#{react_native_path}/Libraries", :library_name => "FBReactNativeSpec", :library_type => "modules", - :output_dir => "#{react_native_path}/React/FBReactNativeSpec/FBReactNativeSpec" }) end diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h index 6cb02fc89491..0551b81eb709 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm index f5c0a1e421de..3f2335784125 100644 --- a/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ActivityIndicator/RCTActivityIndicatorViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h index 64bdbfd3bb8e..d64bcbdc1a55 100644 --- a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm index e43b04b69c2f..9d7b67f07d4d 100644 --- a/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Image/RCTImageComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h index 37abe305e0d0..c2c80a662203 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm index e53c8570d95c..f78c2797f0ef 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h index 15c80e6a0245..0054ce06aeae 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm index 1d112b51c1c8..09de04019100 100644 --- a/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm +++ b/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryContentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,21 +24,12 @@ - (instancetype)init _heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0]; _heightConstraint.active = YES; - if (@available(iOS 11.0, *)) { - [NSLayoutConstraint activateConstraints:@[ - [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor], - [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor], - [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor], - [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor] - ]]; - } else { - [NSLayoutConstraint activateConstraints:@[ - [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.bottomAnchor], - [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.topAnchor], - [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor], - [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor] - ]]; - } + [NSLayoutConstraint activateConstraints:@[ + [_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor], + [_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor], + [_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor], + [_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor] + ]]; } return self; } diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h index 9f025aadc00e..942275910d89 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index 3e216fb625b8..da216f7548e6 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h index 56fc5c6dd4c4..6fb76564eb51 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm index 15980bcfd9f6..1a9611ea5eba 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropCoordinatorAdapter.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h index f794b067c754..149a9788e2c1 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm index feac1dd6d211..f15c2ecafb06 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h index 3a93dbc70cc5..75a134f7d010 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm index 5d2b1d347c3b..6cbe904eec9d 100644 --- a/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h index 78e52b5e3f5e..a2cc0aa7567e 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.h @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,6 +17,7 @@ // OSS-compatibility layer #import +#import #import #pragma GCC diagnostic push diff --git a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm index 2d11085a92a3..84cbe8d55b3a 100644 --- a/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm +++ b/React/Fabric/Mounting/ComponentViews/RCTFabricComponentsPlugins.mm @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -37,7 +37,7 @@ auto classFunc = p->second; return classFunc(); } - return nil; + return RCTThirdPartyFabricComponentsProvider(name); } #endif // RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h index ed3d3d5f1143..cce48d6ffcb9 100644 --- a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm index f41f0fb79d2f..4efa8b34b4a7 100644 --- a/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h index bcd4a9a3b711..542b88cf14fa 100644 --- a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm index fa362f134a4b..31ae9ecd96cc 100644 --- a/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/SafeAreaView/RCTSafeAreaViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h index fa0c29dd6d97..6402bc6c86c1 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm index 80514c2a54f6..93af874f451c 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,12 +30,10 @@ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key - (instancetype)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { - if (@available(iOS 11.0, *)) { - // We set the default behavior to "never" so that iOS - // doesn't do weird things to UIScrollView insets automatically - // and keeps it as an opt-in behavior. - self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } + // We set the default behavior to "never" so that iOS + // doesn't do weird things to UIScrollView insets automatically + // and keeps it as an opt-in behavior. + self.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; // We intentionally force `UIScrollView`s `semanticContentAttribute` to `LTR` here // because this attribute affects a position of vertical scrollbar; we don't want this @@ -248,7 +246,7 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView NSInteger snapIndex = velocityAlongAxis > 0.0 ? ceil(fractionalIndex) : velocityAlongAxis < 0.0 ? floor(fractionalIndex) : round(fractionalIndex); - CGFloat newTargetContentOffset = (snapIndex * snapToIntervalF) - alignmentOffset; + CGFloat newTargetContentOffset = ((CGFloat)snapIndex * snapToIntervalF) - alignmentOffset; // Set new targetContentOffset if (isHorizontal) { diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h index 57e4a15416d3..3048aa48f9ba 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm index 6d89e699307d..325b0a042c19 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -39,7 +39,7 @@ - (instancetype)initWithFrame:(CGRect)frame static auto const defaultProps = std::make_shared(); _props = defaultProps; - _refreshControl = [[UIRefreshControl alloc] init]; + _refreshControl = [UIRefreshControl new]; [_refreshControl addTarget:self action:@selector(handleUIControlEventValueChanged) forControlEvents:UIControlEventValueChanged]; diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h index 96b07f92725c..8edb46868b19 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN /* * Finds and returns the closet RCTScrollViewComponentView component to the given view */ -+ (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view; ++ (nullable RCTScrollViewComponentView *)findScrollViewComponentViewForView:(UIView *)view; /* * Returns an actual UIScrollView that this component uses under the hood. diff --git a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 082933ad6a6f..79f3cf315ed5 100644 --- a/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -87,8 +87,6 @@ @implementation RCTScrollViewComponentView { BOOL _isUserTriggeredScrolling; CGPoint _contentOffsetWhenClipped; - NSMutableArray *> *_childComponentViews; - BOOL _subviewClippingEnabled; } + (RCTScrollViewComponentView *_Nullable)findScrollViewComponentViewForView:(UIView *)view @@ -105,15 +103,12 @@ - (instancetype)initWithFrame:(CGRect)frame static const auto defaultProps = std::make_shared(); _props = defaultProps; - _childComponentViews = [[NSMutableArray alloc] init]; - _scrollView = [[RCTEnhancedScrollView alloc] initWithFrame:self.bounds]; _scrollView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; _scrollView.delaysContentTouches = NO; ((RCTEnhancedScrollView *)_scrollView).overridingDelegate = self; _isUserTriggeredScrolling = NO; [self addSubview:_scrollView]; - _subviewClippingEnabled = RCTGetRemoveClippedSubviewsEnabled(); _containerView = [[UIView alloc] initWithFrame:CGRectZero]; [_scrollView addSubview:_containerView]; @@ -258,18 +253,16 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & } } - if (@available(iOS 11.0, *)) { - if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) { - auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior; - if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Automatic) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; - } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::ScrollableAxes) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; - } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) { - scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways; - } + if (oldScrollViewProps.contentInsetAdjustmentBehavior != newScrollViewProps.contentInsetAdjustmentBehavior) { + auto const contentInsetAdjustmentBehavior = newScrollViewProps.contentInsetAdjustmentBehavior; + if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Never) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Automatic) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; + } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::ScrollableAxes) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic; + } else if (contentInsetAdjustmentBehavior == ContentInsetAdjustmentBehavior::Always) { + scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAlways; } } @@ -326,24 +319,11 @@ - (void)_preserveContentOffsetIfNeededWithBlock:(void (^)())block - (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - if (_subviewClippingEnabled) { - [_containerView insertSubview:childComponentView atIndex:index]; - } else { - [_childComponentViews insertObject:childComponentView atIndex:index]; - } + [_containerView insertSubview:childComponentView atIndex:index]; } - (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index { - if (!_subviewClippingEnabled) { - RCTAssert( - [_childComponentViews objectAtIndex:index] == childComponentView, - @"Attempt to unmount improperly mounted component view."); - [_childComponentViews removeObjectAtIndex:index]; - } - - // In addition to removing a view from `_childComponentViews`, - // we have to unmount views immediately to not mess with recycling. [childComponentView removeFromSuperview]; } @@ -628,68 +608,8 @@ - (void)_remountChildrenIfNeeded - (void)_remountChildren { - if (_subviewClippingEnabled) { - [_scrollView updateClippedSubviewsWithClipRect:CGRectInset(_scrollView.bounds, -kClippingLeeway, -kClippingLeeway) - relativeToView:_scrollView]; - } else { - CGRect visibleFrame = [_scrollView convertRect:_scrollView.bounds toView:_containerView]; - visibleFrame = CGRectInset(visibleFrame, -kClippingLeeway, -kClippingLeeway); - - // `zoomScale` is negative in RTL. Absolute value is needed. - CGFloat scale = 1.0 / std::abs(_scrollView.zoomScale); - visibleFrame.origin.x *= scale; - visibleFrame.origin.y *= scale; - visibleFrame.size.width *= scale; - visibleFrame.size.height *= scale; -#ifndef NDEBUG - NSMutableArray *> *expectedSubviews = [NSMutableArray new]; -#endif - - NSInteger mountedIndex = 0; - for (UIView *componentView in _childComponentViews) { - BOOL shouldBeMounted = YES; - BOOL isMounted = componentView.superview != nil; - - // It's simpler and faster to not mess with views that are not `RCTViewComponentView` subclasses. - if ([componentView isKindOfClass:[RCTViewComponentView class]]) { - RCTViewComponentView *viewComponentView = (RCTViewComponentView *)componentView; - auto layoutMetrics = viewComponentView->_layoutMetrics; - - if (layoutMetrics.overflowInset == EdgeInsets{}) { - shouldBeMounted = CGRectIntersectsRect(visibleFrame, componentView.frame); - } - } - - if (shouldBeMounted != isMounted) { - if (shouldBeMounted) { - [_containerView insertSubview:componentView atIndex:mountedIndex]; - } else { - [componentView removeFromSuperview]; - } - } - - if (shouldBeMounted) { - mountedIndex++; - } - -#ifndef NDEBUG - if (shouldBeMounted) { - [expectedSubviews addObject:componentView]; - } -#endif - } - -#ifndef NDEBUG - RCTAssert( - _containerView.subviews.count == expectedSubviews.count, - @"-[RCTScrollViewComponentView _remountChildren]: Inconsistency detected."); - for (NSInteger i = 0; i < expectedSubviews.count; i++) { - RCTAssert( - [_containerView.subviews objectAtIndex:i] == [expectedSubviews objectAtIndex:i], - @"-[RCTScrollViewComponentView _remountChildren]: Inconsistency detected."); - } -#endif - } + [_scrollView updateClippedSubviewsWithClipRect:CGRectInset(_scrollView.bounds, -kClippingLeeway, -kClippingLeeway) + relativeToView:_scrollView]; } #pragma mark - RCTScrollableProtocol diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h index 7ecd72f16739..5ddbef2017ad 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm index f9c4d89f9b10..72970a1e9cde 100644 --- a/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Slider/RCTSliderComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -55,7 +55,7 @@ - (instancetype)initWithFrame:(CGRect)frame action:@selector(sliderTouchEnd:) forControlEvents:(UIControlEventTouchUpInside | UIControlEventTouchUpOutside | UIControlEventTouchCancel)]; - _sliderView.value = defaultProps->value; + _sliderView.value = (float)defaultProps->value; _trackImageResponseObserverProxy = RCTImageResponseObserverProxy(self); _minimumTrackImageResponseObserverProxy = RCTImageResponseObserverProxy(self); @@ -94,8 +94,8 @@ - (void)prepareForRecycle _thumbImage = nil; const auto &props = *std::static_pointer_cast(_props); - _sliderView.value = props.value; - _previousValue = props.value; + _sliderView.value = (float)props.value; + _previousValue = (float)props.value; } #pragma mark - RCTComponentViewProtocol @@ -112,18 +112,18 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & // `minimumValue` if (oldSliderProps.minimumValue != newSliderProps.minimumValue) { - _sliderView.minimumValue = newSliderProps.minimumValue; + _sliderView.minimumValue = (float)newSliderProps.minimumValue; } // `maximumValue` if (oldSliderProps.maximumValue != newSliderProps.maximumValue) { - _sliderView.maximumValue = newSliderProps.maximumValue; + _sliderView.maximumValue = (float)newSliderProps.maximumValue; } // `value` if (oldSliderProps.value != newSliderProps.value) { - _sliderView.value = newSliderProps.value; - _previousValue = newSliderProps.value; + _sliderView.value = (float)newSliderProps.value; + _previousValue = (float)newSliderProps.value; } // `disabled` @@ -301,9 +301,10 @@ - (void)onChange:(UISlider *)sender withContinuous:(BOOL)continuous const auto &props = *std::static_pointer_cast(_props); if (props.step > 0 && props.step <= (props.maximumValue - props.minimumValue)) { - value = MAX( + value = (float)std::max( props.minimumValue, - MIN(props.maximumValue, props.minimumValue + round((value - props.minimumValue) / props.step) * props.step)); + std::min( + props.maximumValue, props.minimumValue + round((value - props.minimumValue) / props.step) * props.step)); [_sliderView setValue:value animated:YES]; } diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h index 861b54a19f02..09fb855be5bd 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm index 970414806e1c..844b60c120ef 100644 --- a/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Switch/RCTSwitchComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h index 9a814731a9c2..7d06fb61ba82 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm index d9dcfd73c918..7ce44a3f1741 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTAccessibilityElement.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h index d2b2fc0eb1fc..3fb0da7c2a5f 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm index 1048679265d6..13723e178bc6 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentAccessibilityProvider.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h index 164a1c8c2e88..0744e4a530c8 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index 53dfe92b9a10..048d1b3dd9a2 100644 --- a/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h index 7540f05274c0..927fbc4e3d33 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index 8fe5537da5c3..1c3b916163ca 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -67,7 +67,7 @@ - (instancetype)initWithFrame:(CGRect)frame _props = defaultProps; auto &props = *defaultProps; - _backedTextInputView = props.traits.multiline ? [[RCTUITextView alloc] init] : [[RCTUITextField alloc] init]; + _backedTextInputView = props.traits.multiline ? [RCTUITextView new] : [RCTUITextField new]; _backedTextInputView.textInputDelegate = self; _ignoreNextTextInputCall = NO; _comingFromJS = NO; @@ -323,16 +323,23 @@ - (void)textInputDidReturn - (NSString *)textInputShouldChangeText:(NSString *)text inRange:(NSRange)range { + auto const &props = *std::static_pointer_cast(_props); + if (!_backedTextInputView.textWasPasted) { if (_eventEmitter) { KeyPressMetrics keyPressMetrics; keyPressMetrics.text = RCTStringFromNSString(text); keyPressMetrics.eventCount = _mostRecentEventCount; - std::static_pointer_cast(_eventEmitter)->onKeyPress(keyPressMetrics); + + auto const &textInputEventEmitter = *std::static_pointer_cast(_eventEmitter); + if (props.onKeyPressSync) { + textInputEventEmitter.onKeyPressSync(keyPressMetrics); + } else { + textInputEventEmitter.onKeyPress(keyPressMetrics); + } } } - auto const &props = *std::static_pointer_cast(_props); if (props.maxLength) { NSInteger allowedLength = props.maxLength - _backedTextInputView.attributedText.string.length + range.length; @@ -374,7 +381,13 @@ - (void)textInputDidChange [self _updateState]; if (_eventEmitter) { - std::static_pointer_cast(_eventEmitter)->onChange([self _textInputMetrics]); + auto const &textInputEventEmitter = *std::static_pointer_cast(_eventEmitter); + auto const &props = *std::static_pointer_cast(_props); + if (props.onChangeSync) { + textInputEventEmitter.onChangeSync([self _textInputMetrics]); + } else { + textInputEventEmitter.onChange([self _textInputMetrics]); + } } } @@ -394,6 +407,15 @@ - (void)textInputDidChangeSelection } } +#pragma mark - RCTBackedTextInputDelegate (UIScrollViewDelegate) + +- (void)scrollViewDidScroll:(UIScrollView *)scrollView +{ + if (_eventEmitter) { + std::static_pointer_cast(_eventEmitter)->onScroll([self _textInputMetrics]); + } +} + #pragma mark - Native Commands - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args @@ -420,7 +442,7 @@ - (void)setTextAndSelection:(NSInteger)eventCount return; } _comingFromJS = YES; - if (![value isEqualToString:_backedTextInputView.attributedText.string]) { + if (value && ![value isEqualToString:_backedTextInputView.attributedText.string]) { NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:value attributes:_backedTextInputView.defaultTextAttributes]; [self _setAttributedString:attributedString]; @@ -465,7 +487,7 @@ - (void)setDefaultInputAccessoryView } if (shouldHaveInputAccesoryView) { - UIToolbar *toolbarView = [[UIToolbar alloc] init]; + UIToolbar *toolbarView = [UIToolbar new]; [toolbarView sizeToFit]; UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; @@ -499,6 +521,22 @@ - (TextInputMetrics)_textInputMetrics metrics.text = RCTStringFromNSString(_backedTextInputView.attributedText.string); metrics.selectionRange = [self _selectionRange]; metrics.eventCount = _mostRecentEventCount; + + CGPoint contentOffset = _backedTextInputView.contentOffset; + metrics.contentOffset = {contentOffset.x, contentOffset.y}; + + UIEdgeInsets contentInset = _backedTextInputView.contentInset; + metrics.contentInset = {contentInset.left, contentInset.top, contentInset.right, contentInset.bottom}; + + CGSize contentSize = _backedTextInputView.contentSize; + metrics.contentSize = {contentSize.width, contentSize.height}; + + CGSize layoutMeasurement = _backedTextInputView.bounds.size; + metrics.layoutMeasurement = {layoutMeasurement.width, layoutMeasurement.height}; + + CGFloat zoomScale = _backedTextInputView.zoomScale; + metrics.zoomScale = zoomScale; + return metrics; } @@ -565,8 +603,7 @@ - (void)_setAttributedString:(NSAttributedString *)attributedString - (void)_setMultiline:(BOOL)multiline { [_backedTextInputView removeFromSuperview]; - UIView *backedTextInputView = - multiline ? [[RCTUITextView alloc] init] : [[RCTUITextField alloc] init]; + UIView *backedTextInputView = multiline ? [RCTUITextView new] : [RCTUITextField new]; backedTextInputView.frame = _backedTextInputView.frame; RCTCopyBackedTextInput(_backedTextInputView, backedTextInputView); _backedTextInputView = backedTextInputView; @@ -580,8 +617,9 @@ - (BOOL)_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldTe // the settings on a dictation. // Similarly, when the user is in the middle of inputting some text in Japanese/Chinese, there will be styling on the // text that we should disregard. See - // https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc for more info. If - // the user added an emoji, the system adds a font attribute for the emoji and stores the original font in + // https://developer.apple.com/documentation/uikit/uitextinput/1614489-markedtextrange?language=objc for more info. + // Also, updating the attributed text while inputting Korean language will break input mechanism. + // If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in // NSOriginalFont. Lastly, when entering a password, etc., there will be additional styling on the field as the native // text view handles showing the last character for a split second. __block BOOL fontHasBeenUpdatedBySystem = false; @@ -596,6 +634,7 @@ - (BOOL)_textOf:(NSAttributedString *)newText equals:(NSAttributedString *)oldTe BOOL shouldFallbackToBareTextComparison = [_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"dictation"] || + [_backedTextInputView.textInputMode.primaryLanguage isEqualToString:@"ko-KR"] || _backedTextInputView.markedTextRange || _backedTextInputView.isSecureTextEntry || fontHasBeenUpdatedBySystem; if (shouldFallbackToBareTextComparison) { diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputNativeCommands.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputNativeCommands.h index 6af78ddf7e18..947b1b48cb7f 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputNativeCommands.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputNativeCommands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h index 94191bfea359..08bdb6bffcf0 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,7 @@ #import #import -#import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -17,7 +17,7 @@ void RCTCopyBackedTextInput( UIView *fromTextInput, UIView *toTextInput); -UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::better::optional autoCorrect); +UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::butter::optional autoCorrect); UITextAutocapitalizationType RCTUITextAutocapitalizationTypeFromAutocapitalizationType( facebook::react::AutocapitalizationType autocapitalizationType); @@ -25,7 +25,7 @@ UITextAutocapitalizationType RCTUITextAutocapitalizationTypeFromAutocapitalizati UIKeyboardAppearance RCTUIKeyboardAppearanceFromKeyboardAppearance( facebook::react::KeyboardAppearance keyboardAppearance); -UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::better::optional spellCheck); +UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::butter::optional spellCheck); UITextFieldViewMode RCTUITextFieldViewModeFromTextInputAccessoryVisibilityMode( facebook::react::TextInputAccessoryVisibilityMode mode); diff --git a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index a861c36c38ae..a0880581c4d4 100644 --- a/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -51,7 +51,7 @@ void RCTCopyBackedTextInput( [toTextInput setSelectedTextRange:fromTextInput.selectedTextRange notifyDelegate:NO]; } -UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::better::optional autoCorrect) +UITextAutocorrectionType RCTUITextAutocorrectionTypeFromOptionalBool(facebook::butter::optional autoCorrect) { return autoCorrect.has_value() ? (*autoCorrect ? UITextAutocorrectionTypeYes : UITextAutocorrectionTypeNo) : UITextAutocorrectionTypeDefault; @@ -84,7 +84,7 @@ UIKeyboardAppearance RCTUIKeyboardAppearanceFromKeyboardAppearance(KeyboardAppea } } -UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::better::optional spellCheck) +UITextSpellCheckingType RCTUITextSpellCheckingTypeFromOptionalBool(facebook::butter::optional spellCheck) { return spellCheck.has_value() ? (*spellCheck ? UITextSpellCheckingTypeYes : UITextSpellCheckingTypeNo) : UITextSpellCheckingTypeDefault; @@ -210,13 +210,10 @@ UITextContentType RCTUITextContentTypeFromString(std::string const &contentType) @"streetAddressLine2" : UITextContentTypeStreetAddressLine2, @"sublocality" : UITextContentTypeSublocality, @"telephoneNumber" : UITextContentTypeTelephoneNumber, + @"username" : UITextContentTypeUsername, + @"password" : UITextContentTypePassword, } mutableCopy]; - if (@available(iOS 11.0, *)) { - [mutableContentTypeMap - addEntriesFromDictionary:@{@"username" : UITextContentTypeUsername, @"password" : UITextContentTypePassword}]; - } - if (@available(iOS 12.0, *)) { [mutableContentTypeMap addEntriesFromDictionary:@{ @"newPassword" : UITextContentTypeNewPassword, diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h index 1a3ff9bd7eec..fcd2ebe7b7cc 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm index 09e8e3f7ed84..6c38b8bda685 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedComponent/RCTUnimplementedNativeComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h index 4aa0fb5be10f..8c2c82a3f0c5 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm index 04e426d7ab9e..1112c5a98954 100644 --- a/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/UnimplementedView/RCTUnimplementedViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h index 4abe9e9652ab..48298f3fc90a 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index 2b9d5381adb0..5c25be602151 100644 --- a/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -189,12 +189,11 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & // `opacity` if (oldViewProps.opacity != newViewProps.opacity && ![_propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN containsObject:@"opacity"]) { - self.layer.opacity = (CGFloat)newViewProps.opacity; + self.layer.opacity = (float)newViewProps.opacity; needsInvalidateLayer = YES; } - if (RCTGetRemoveClippedSubviewsEnabled() && - oldViewProps.removeClippedSubviews != newViewProps.removeClippedSubviews) { + if (oldViewProps.removeClippedSubviews != newViewProps.removeClippedSubviews) { _removeClippedSubviews = newViewProps.removeClippedSubviews; if (_removeClippedSubviews && self.subviews.count > 0) { _reactSubviews = [NSMutableArray arrayWithArray:self.subviews]; @@ -228,7 +227,7 @@ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const & // `shadowOpacity` if (oldViewProps.shadowOpacity != newViewProps.shadowOpacity) { - self.layer.shadowOpacity = (CGFloat)newViewProps.shadowOpacity; + self.layer.shadowOpacity = (float)newViewProps.shadowOpacity; needsInvalidateLayer = YES; } @@ -418,7 +417,7 @@ - (void)prepareForRecycle self.layer.transform = RCTCATransform3DFromTransformMatrix(props.transform); } if ([_propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN containsObject:@"opacity"]) { - self.layer.opacity = (CGFloat)props.opacity; + self.layer.opacity = (float)props.opacity; } _propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN = nil; @@ -578,7 +577,7 @@ - (void)invalidateLayer layer.backgroundColor = _backgroundColor.CGColor; } else { if (!_borderLayer) { - _borderLayer = [[CALayer alloc] init]; + _borderLayer = [CALayer new]; _borderLayer.zPosition = -1024.0f; _borderLayer.frame = layer.bounds; _borderLayer.magnificationFilter = kCAFilterNearest; diff --git a/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h b/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h index c235d42a7c19..b03a4642a981 100644 --- a/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h +++ b/React/Fabric/Mounting/RCTComponentViewClassDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTComponentViewDescriptor.h b/React/Fabric/Mounting/RCTComponentViewDescriptor.h index b77f04d23cb9..f933f2520b07 100644 --- a/React/Fabric/Mounting/RCTComponentViewDescriptor.h +++ b/React/Fabric/Mounting/RCTComponentViewDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.h b/React/Fabric/Mounting/RCTComponentViewFactory.h index a5193e63d956..771131d50f44 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.h +++ b/React/Fabric/Mounting/RCTComponentViewFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTComponentViewFactory.mm b/React/Fabric/Mounting/RCTComponentViewFactory.mm index eef565f17dc8..cf5a9181243b 100644 --- a/React/Fabric/Mounting/RCTComponentViewFactory.mm +++ b/React/Fabric/Mounting/RCTComponentViewFactory.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,9 +10,9 @@ #import #import -#import -#import -#import +#import +#import +#import #import #import @@ -41,6 +41,7 @@ using namespace facebook::react; +// Allow JS runtime to register native components as needed. For static view configs. void RCTInstallNativeComponentRegistryBinding(facebook::jsi::Runtime &runtime) { auto hasComponentProvider = [](std::string const &name) -> bool { @@ -56,10 +57,10 @@ void RCTInstallNativeComponentRegistryBinding(facebook::jsi::Runtime &runtime) } @implementation RCTComponentViewFactory { - better::map _componentViewClasses; - better::set _registeredComponentsNames; + butter::map _componentViewClasses; + butter::set _registeredComponentsNames; ComponentDescriptorProviderRegistry _providerRegistry; - better::shared_mutex _mutex; + butter::shared_mutex _mutex; } + (RCTComponentViewFactory *)currentComponentViewFactory @@ -68,7 +69,7 @@ + (RCTComponentViewFactory *)currentComponentViewFactory static RCTComponentViewFactory *componentViewFactory; dispatch_once(&onceToken, ^{ - componentViewFactory = [[RCTComponentViewFactory alloc] init]; + componentViewFactory = [RCTComponentViewFactory new]; [componentViewFactory registerComponentViewClass:[RCTRootComponentView class]]; [componentViewFactory registerComponentViewClass:[RCTViewComponentView class]]; [componentViewFactory registerComponentViewClass:[RCTParagraphComponentView class]]; @@ -149,7 +150,7 @@ - (BOOL)registerComponentIfPossible:(std::string const &)name - (void)registerComponentViewClass:(Class)componentViewClass { RCTAssert(componentViewClass, @"RCTComponentViewFactory: Provided `componentViewClass` is `nil`."); - std::unique_lock lock(_mutex); + std::unique_lock lock(_mutex); auto componentDescriptorProvider = [componentViewClass componentDescriptorProvider]; _componentViewClasses[componentDescriptorProvider.handle] = @@ -171,7 +172,7 @@ - (void)_addDescriptorToProviderRegistry:(ComponentDescriptorProvider const &)pr - (RCTComponentViewDescriptor)createComponentViewWithComponentHandle:(facebook::react::ComponentHandle)componentHandle { RCTAssertMainQueue(); - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); auto iterator = _componentViewClasses.find(componentHandle); RCTAssert( @@ -183,7 +184,7 @@ - (RCTComponentViewDescriptor)createComponentViewWithComponentHandle:(facebook:: Class viewClass = componentViewClassDescriptor.viewClass; return RCTComponentViewDescriptor{ - .view = [[viewClass alloc] init], + .view = [viewClass new], .observesMountingTransactionWillMount = componentViewClassDescriptor.observesMountingTransactionWillMount, .observesMountingTransactionDidMount = componentViewClassDescriptor.observesMountingTransactionDidMount, }; @@ -192,7 +193,7 @@ - (RCTComponentViewDescriptor)createComponentViewWithComponentHandle:(facebook:: - (facebook::react::ComponentDescriptorRegistry::Shared)createComponentDescriptorRegistryWithParameters: (facebook::react::ComponentDescriptorParameters)parameters { - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); return _providerRegistry.createComponentDescriptorRegistry(parameters); } diff --git a/React/Fabric/Mounting/RCTComponentViewProtocol.h b/React/Fabric/Mounting/RCTComponentViewProtocol.h index 11493c42798f..2c64989a1a00 100644 --- a/React/Fabric/Mounting/RCTComponentViewProtocol.h +++ b/React/Fabric/Mounting/RCTComponentViewProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.h b/React/Fabric/Mounting/RCTComponentViewRegistry.h index 7119449660da..bcf78a20ccd2 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.h +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTComponentViewRegistry.mm b/React/Fabric/Mounting/RCTComponentViewRegistry.mm index 1217cf71bf87..afd8024939f7 100644 --- a/React/Fabric/Mounting/RCTComponentViewRegistry.mm +++ b/React/Fabric/Mounting/RCTComponentViewRegistry.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,15 +15,15 @@ #import "RCTParagraphComponentView.h" #import "RCTViewComponentView.h" -#import +#import using namespace facebook::react; const NSInteger RCTComponentViewRegistryRecyclePoolMaxSize = 1024; @implementation RCTComponentViewRegistry { - better::map _registry; - better::map> _recyclePool; + butter::map _registry; + butter::map> _recyclePool; } - (instancetype)init diff --git a/React/Fabric/Mounting/RCTMountingManager.h b/React/Fabric/Mounting/RCTMountingManager.h index cf713c1468f5..7f91164376db 100644 --- a/React/Fabric/Mounting/RCTMountingManager.h +++ b/React/Fabric/Mounting/RCTMountingManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTMountingManager.mm b/React/Fabric/Mounting/RCTMountingManager.mm index f09ae72ce41a..4f396bc72a57 100644 --- a/React/Fabric/Mounting/RCTMountingManager.mm +++ b/React/Fabric/Mounting/RCTMountingManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #import "RCTMountingManager.h" -#import +#import #import #import @@ -155,7 +155,7 @@ @implementation RCTMountingManager { - (instancetype)init { if (self = [super init]) { - _componentViewRegistry = [[RCTComponentViewRegistry alloc] init]; + _componentViewRegistry = [RCTComponentViewRegistry new]; } return self; diff --git a/React/Fabric/Mounting/RCTMountingManagerDelegate.h b/React/Fabric/Mounting/RCTMountingManagerDelegate.h index bcc3a0485cf8..21653fe03361 100644 --- a/React/Fabric/Mounting/RCTMountingManagerDelegate.h +++ b/React/Fabric/Mounting/RCTMountingManagerDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h index 31da581bfdff..8f0f57234e2d 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h +++ b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,8 +8,8 @@ #import #import "RCTMountingTransactionObserverCoordinator.h" -#import -#import +#import +#import #import @@ -36,8 +36,8 @@ class RCTMountingTransactionObserverCoordinator final { facebook::react::MountingTransactionMetadata const &metadata) const; private: - facebook::better::map< + facebook::butter::map< facebook::react::SurfaceId, - facebook::better::set> + facebook::butter::set> registry_; }; diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm index 39d56121b2fe..959c14603733 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm +++ b/React/Fabric/Mounting/RCTMountingTransactionObserverCoordinator.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/RCTMountingTransactionObserving.h b/React/Fabric/Mounting/RCTMountingTransactionObserving.h index 477c97df02af..35594d87ad61 100644 --- a/React/Fabric/Mounting/RCTMountingTransactionObserving.h +++ b/React/Fabric/Mounting/RCTMountingTransactionObserving.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/UIView+ComponentViewProtocol.h b/React/Fabric/Mounting/UIView+ComponentViewProtocol.h index 2a3fdc9b3de2..b161d37d108e 100644 --- a/React/Fabric/Mounting/UIView+ComponentViewProtocol.h +++ b/React/Fabric/Mounting/UIView+ComponentViewProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm b/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm index a3704408f2d2..2e97a8afdae4 100644 --- a/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm +++ b/React/Fabric/Mounting/UIView+ComponentViewProtocol.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTConversions.h b/React/Fabric/RCTConversions.h index 495198b97093..65b7e3dd8bd9 100644 --- a/React/Fabric/RCTConversions.h +++ b/React/Fabric/RCTConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTImageResponseDelegate.h b/React/Fabric/RCTImageResponseDelegate.h index 29f641518043..be55fa93f533 100644 --- a/React/Fabric/RCTImageResponseDelegate.h +++ b/React/Fabric/RCTImageResponseDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTImageResponseObserverProxy.h b/React/Fabric/RCTImageResponseObserverProxy.h index c86005206b2d..b12b3485ceb4 100644 --- a/React/Fabric/RCTImageResponseObserverProxy.h +++ b/React/Fabric/RCTImageResponseObserverProxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTImageResponseObserverProxy.mm b/React/Fabric/RCTImageResponseObserverProxy.mm index ffb68fbdef75..609dbba90853 100644 --- a/React/Fabric/RCTImageResponseObserverProxy.mm +++ b/React/Fabric/RCTImageResponseObserverProxy.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTLocalizationProvider.h b/React/Fabric/RCTLocalizationProvider.h index be98107c6f64..19f871847164 100644 --- a/React/Fabric/RCTLocalizationProvider.h +++ b/React/Fabric/RCTLocalizationProvider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTLocalizationProvider.mm b/React/Fabric/RCTLocalizationProvider.mm index 4359af2527ec..ef6a3d3e950a 100644 --- a/React/Fabric/RCTLocalizationProvider.mm +++ b/React/Fabric/RCTLocalizationProvider.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTPrimitives.h b/React/Fabric/RCTPrimitives.h index a4a56dcf04bf..8b45be5984a5 100644 --- a/React/Fabric/RCTPrimitives.h +++ b/React/Fabric/RCTPrimitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTScheduler.h b/React/Fabric/RCTScheduler.h index 68353bfea68d..b201c0a75f56 100644 --- a/React/Fabric/RCTScheduler.h +++ b/React/Fabric/RCTScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)schedulerDidDispatchCommand:(facebook::react::ShadowView const &)shadowView commandName:(std::string const &)commandName - args:(folly::dynamic const)args; + args:(folly::dynamic const &)args; - (void)schedulerDidSendAccessibilityEvent:(facebook::react::ShadowView const &)shadowView eventType:(std::string const &)eventType; diff --git a/React/Fabric/RCTScheduler.mm b/React/Fabric/RCTScheduler.mm index 389ae00f1b2e..4bc19fd9c8c7 100644 --- a/React/Fabric/RCTScheduler.mm +++ b/React/Fabric/RCTScheduler.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -48,7 +48,7 @@ void schedulerDidCloneShadowNode( void schedulerDidDispatchCommand( const ShadowView &shadowView, const std::string &commandName, - const folly::dynamic args) override + const folly::dynamic &args) override { RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_; [scheduler.delegate schedulerDidDispatchCommand:shadowView commandName:commandName args:args]; @@ -155,7 +155,8 @@ - (void)dealloc if (_animationDriver) { _animationDriver->setLayoutAnimationStatusDelegate(nullptr); } - _animationDriver = nullptr; + + _scheduler->setDelegate(nullptr); } - (void)registerSurface:(facebook::react::SurfaceHandler const &)surfaceHandler diff --git a/React/Fabric/RCTSurfacePresenter.h b/React/Fabric/RCTSurfacePresenter.h index 0053a376ee1c..62d87be045e5 100644 --- a/React/Fabric/RCTSurfacePresenter.h +++ b/React/Fabric/RCTSurfacePresenter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTSurfacePresenter.mm b/React/Fabric/RCTSurfacePresenter.mm index 57b6889bc202..cc16148690f5 100644 --- a/React/Fabric/RCTSurfacePresenter.mm +++ b/React/Fabric/RCTSurfacePresenter.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -79,7 +79,7 @@ @implementation RCTSurfacePresenter { ContextContainer::Shared _contextContainer; // Protected by `_schedulerLifeCycleMutex`. RuntimeExecutor _runtimeExecutor; // Protected by `_schedulerLifeCycleMutex`. - better::shared_mutex _observerListMutex; + butter::shared_mutex _observerListMutex; NSMutableArray> *_observers; } @@ -91,8 +91,8 @@ - (instancetype)initWithContextContainer:(ContextContainer::Shared)contextContai _runtimeExecutor = runtimeExecutor; _contextContainer = contextContainer; - _surfaceRegistry = [[RCTSurfaceRegistry alloc] init]; - _mountingManager = [[RCTMountingManager alloc] init]; + _surfaceRegistry = [RCTSurfaceRegistry new]; + _mountingManager = [RCTMountingManager new]; _mountingManager.contextContainer = contextContainer; _mountingManager.delegate = self; @@ -255,10 +255,6 @@ - (RCTScheduler *)_createScheduler RCTExperimentSetPreemptiveViewAllocationDisabled(YES); } - if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_remove_clipped_subviews_ios")) { - RCTSetRemoveClippedSubviewsEnabled(YES); - } - auto componentRegistryFactory = [factory = wrapManagedObject(_mountingManager.componentViewRegistry.componentViewFactory)]( EventDispatcher::Weak const &eventDispatcher, ContextContainer::Shared const &contextContainer) { @@ -275,8 +271,6 @@ - (RCTScheduler *)_createScheduler auto weakRuntimeScheduler = _contextContainer->find>("RuntimeScheduler"); auto runtimeScheduler = weakRuntimeScheduler.hasValue() ? weakRuntimeScheduler.value().lock() : nullptr; if (runtimeScheduler) { - runtimeScheduler->setEnableYielding( - reactNativeConfig->getBool("react_native_new_architecture:runtimescheduler_enable_yielding_ios")); runtimeExecutor = [runtimeScheduler](std::function &&callback) { runtimeScheduler->scheduleWork(std::move(callback)); }; @@ -289,9 +283,7 @@ - (RCTScheduler *)_createScheduler return std::make_unique(activities, owner); }; - if (reactNativeConfig && reactNativeConfig->getBool("react_fabric:enable_background_executor_ios")) { - toolbox.backgroundExecutor = RCTGetBackgroundExecutor(); - } + toolbox.backgroundExecutor = RCTGetBackgroundExecutor(); toolbox.synchronousEventBeatFactory = [runtimeExecutor, runtimeScheduler = runtimeScheduler](EventBeat::SharedOwnerBox const &ownerBox) { @@ -342,7 +334,7 @@ - (void)schedulerDidFinishTransaction:(MountingCoordinator::Shared const &)mount - (void)schedulerDidDispatchCommand:(ShadowView const &)shadowView commandName:(std::string const &)commandName - args:(folly::dynamic const)args + args:(folly::dynamic const &)args { ReactTag tag = shadowView.tag; NSString *commandStr = [[NSString alloc] initWithUTF8String:commandName.c_str()]; @@ -371,13 +363,13 @@ - (void)schedulerDidSetIsJSResponder:(BOOL)isJSResponder - (void)addObserver:(id)observer { - std::unique_lock lock(_observerListMutex); + std::unique_lock lock(_observerListMutex); [self->_observers addObject:observer]; } - (void)removeObserver:(id)observer { - std::unique_lock lock(_observerListMutex); + std::unique_lock lock(_observerListMutex); [self->_observers removeObject:observer]; } @@ -387,7 +379,7 @@ - (void)mountingManager:(RCTMountingManager *)mountingManager willMountComponent { RCTAssertMainQueue(); - std::shared_lock lock(_observerListMutex); + std::shared_lock lock(_observerListMutex); for (id observer in _observers) { if ([observer respondsToSelector:@selector(willMountComponentsWithRootTag:)]) { [observer willMountComponentsWithRootTag:rootTag]; @@ -399,7 +391,7 @@ - (void)mountingManager:(RCTMountingManager *)mountingManager didMountComponents { RCTAssertMainQueue(); - std::shared_lock lock(_observerListMutex); + std::shared_lock lock(_observerListMutex); for (id observer in _observers) { if ([observer respondsToSelector:@selector(didMountComponentsWithRootTag:)]) { [observer didMountComponentsWithRootTag:rootTag]; diff --git a/React/Fabric/RCTSurfacePresenterBridgeAdapter.h b/React/Fabric/RCTSurfacePresenterBridgeAdapter.h index da2eedb3a2e6..188d19992c67 100644 --- a/React/Fabric/RCTSurfacePresenterBridgeAdapter.h +++ b/React/Fabric/RCTSurfacePresenterBridgeAdapter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm b/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm index e39c269bc3c2..834022691380 100644 --- a/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm +++ b/React/Fabric/RCTSurfacePresenterBridgeAdapter.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTSurfaceRegistry.h b/React/Fabric/RCTSurfaceRegistry.h index 07fb4062f926..4b369cc64b41 100644 --- a/React/Fabric/RCTSurfaceRegistry.h +++ b/React/Fabric/RCTSurfaceRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTSurfaceRegistry.mm b/React/Fabric/RCTSurfaceRegistry.mm index 25487f3d74b7..50c08f49752e 100644 --- a/React/Fabric/RCTSurfaceRegistry.mm +++ b/React/Fabric/RCTSurfaceRegistry.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #import "RCTSurfaceRegistry.h" -#import +#import #import #import @@ -16,7 +16,7 @@ using namespace facebook; @implementation RCTSurfaceRegistry { - better::shared_mutex _mutex; + butter::shared_mutex _mutex; NSMapTable *_registry; } @@ -32,13 +32,13 @@ - (instancetype)init - (void)enumerateWithBlock:(RCTSurfaceEnumeratorBlock)block { - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); block([_registry objectEnumerator]); } - (void)registerSurface:(RCTFabricSurface *)surface { - std::unique_lock lock(_mutex); + std::unique_lock lock(_mutex); ReactTag rootTag = surface.rootViewTag.integerValue; [_registry setObject:surface forKey:(__bridge id)(void *)rootTag]; @@ -46,7 +46,7 @@ - (void)registerSurface:(RCTFabricSurface *)surface - (void)unregisterSurface:(RCTFabricSurface *)surface { - std::unique_lock lock(_mutex); + std::unique_lock lock(_mutex); ReactTag rootTag = surface.rootViewTag.integerValue; [_registry removeObjectForKey:(__bridge id)(void *)rootTag]; @@ -54,7 +54,7 @@ - (void)unregisterSurface:(RCTFabricSurface *)surface - (RCTFabricSurface *)surfaceForRootTag:(ReactTag)rootTag { - std::shared_lock lock(_mutex); + std::shared_lock lock(_mutex); return [_registry objectForKey:(__bridge id)(void *)rootTag]; } diff --git a/React/Fabric/RCTSurfaceTouchHandler.h b/React/Fabric/RCTSurfaceTouchHandler.h index b20e195322ab..6515e5f1750c 100644 --- a/React/Fabric/RCTSurfaceTouchHandler.h +++ b/React/Fabric/RCTSurfaceTouchHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTSurfaceTouchHandler.mm b/React/Fabric/RCTSurfaceTouchHandler.mm index eb5d126eda33..b19d046e4259 100644 --- a/React/Fabric/RCTSurfaceTouchHandler.mm +++ b/React/Fabric/RCTSurfaceTouchHandler.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/RCTTouchableComponentViewProtocol.h b/React/Fabric/RCTTouchableComponentViewProtocol.h index 78eb34c3b590..162aa866cb3e 100644 --- a/React/Fabric/RCTTouchableComponentViewProtocol.h +++ b/React/Fabric/RCTTouchableComponentViewProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Surface/RCTFabricSurface.h b/React/Fabric/Surface/RCTFabricSurface.h index 77b3c906cc7d..7e9d280210de 100644 --- a/React/Fabric/Surface/RCTFabricSurface.h +++ b/React/Fabric/Surface/RCTFabricSurface.h @@ -1,13 +1,11 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import -#import -#import #import NS_ASSUME_NONNULL_BEGIN @@ -15,7 +13,6 @@ NS_ASSUME_NONNULL_BEGIN @class RCTBridge; @class RCTSurfaceView; @class RCTSurfacePresenter; -@protocol RCTSurfaceDelegate; /** * (This is Fabric-compatible RCTSurface implementation.) @@ -41,6 +38,15 @@ NS_ASSUME_NONNULL_BEGIN moduleName:(NSString *)moduleName initialProperties:(NSDictionary *)initialProperties; +#pragma mark - Surface presenter + +/** + * EXPERIMENTAL + * Reset's the Surface to it's initial stage. + * It uses the passed in surface presenter, and whatever else was passed in init. + */ +- (void)resetWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter; + #pragma mark - Dealing with UIView representation, the Main thread only access /** @@ -57,27 +63,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (RCTSurfaceView *)view; -#pragma mark - Start & Stop - -/** - * Starts or stops the Surface. - * A Surface object can be stopped and then restarted. - * The starting process includes initializing all underlying React Native - * infrastructure and running React app. - * Surface stops itself on deallocation automatically. - * Returns YES in case of success. Returns NO if the Surface is already - * started or stopped. - */ -- (BOOL)start; -- (BOOL)stop; - -/** - * EXPERIMENTAL - * Reset's the Surface to it's initial stage. - * It uses the passed in surface presenter, and whatever else was passed in init. - */ -- (void)resetWithSurfacePresenter:(RCTSurfacePresenter *)surfacePresenter; - #pragma mark - Layout: Setting the size constrains /** diff --git a/React/Fabric/Surface/RCTFabricSurface.mm b/React/Fabric/Surface/RCTFabricSurface.mm index 686e7794c472..13683a25aa6e 100644 --- a/React/Fabric/Surface/RCTFabricSurface.mm +++ b/React/Fabric/Surface/RCTFabricSurface.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,6 +22,7 @@ #import #import #import +#import #import "RCTSurfacePresenter.h" @@ -33,7 +34,7 @@ @implementation RCTFabricSurface { // `SurfaceHandler` is a thread-safe object, so we don't need additional synchronization. // Objective-C++ classes cannot have instance variables without default constructors, // hence we wrap a value into `optional` to workaround it. - better::optional _surfaceHandler; + butter::optional _surfaceHandler; // Protects Surface's start and stop processes. // Even though SurfaceHandler is tread-safe, it will crash if we try to stop a surface that is not running. @@ -88,12 +89,12 @@ - (void)dealloc #pragma mark - Life-cycle management -- (BOOL)start +- (void)start { std::lock_guard lock(_surfaceMutex); if (_surfaceHandler->getStatus() != SurfaceHandler::Status::Registered) { - return NO; + return; } // We need to register a root view component here synchronously because right after @@ -107,15 +108,14 @@ - (BOOL)start [self _propagateStageChange]; [_surfacePresenter setupAnimationDriverWithSurfaceHandler:*_surfaceHandler]; - return YES; } -- (BOOL)stop +- (void)stop { std::lock_guard lock(_surfaceMutex); if (_surfaceHandler->getStatus() != SurfaceHandler::Status::Running) { - return NO; + return; } _surfaceHandler->stop(); @@ -125,8 +125,6 @@ - (BOOL)stop [self->_surfacePresenter.mountingManager detachSurfaceFromView:self.view surfaceId:self->_surfaceHandler->getSurfaceId()]; }); - - return YES; } #pragma mark - Immutable Properties (no need to enforce synchronization) diff --git a/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h b/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h index 6639d5716861..c50144a8ee4f 100644 --- a/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h +++ b/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm b/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm index 3cbbcfa2ba0b..5c399d8a33fc 100644 --- a/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm +++ b/React/Fabric/Surface/RCTFabricSurfaceHostingProxyRootView.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Surface/RCTFabricSurfaceHostingView.h b/React/Fabric/Surface/RCTFabricSurfaceHostingView.h deleted file mode 100644 index c3f2c85090d8..000000000000 --- a/React/Fabric/Surface/RCTFabricSurfaceHostingView.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -/** - * Fabric-compatible RCTSurfaceHostingView implementation. - */ -@interface RCTFabricSurfaceHostingView : RCTSurfaceHostingView - -@end diff --git a/React/Fabric/Surface/RCTFabricSurfaceHostingView.mm b/React/Fabric/Surface/RCTFabricSurfaceHostingView.mm deleted file mode 100644 index 44c92cd74336..000000000000 --- a/React/Fabric/Surface/RCTFabricSurfaceHostingView.mm +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTFabricSurfaceHostingView.h" - -#import -#import "RCTFabricSurface.h" - -@implementation RCTFabricSurfaceHostingView - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties - sizeMeasureMode:(RCTSurfaceSizeMeasureMode)sizeMeasureMode -{ - RCTSurface *surface = (RCTSurface *)[[RCTFabricSurface alloc] initWithBridge:bridge - moduleName:moduleName - initialProperties:initialProperties]; - [surface start]; - return [self initWithSurface:surface sizeMeasureMode:sizeMeasureMode]; -} - -@end diff --git a/React/Fabric/Utils/PlatformRunLoopObserver.h b/React/Fabric/Utils/PlatformRunLoopObserver.h index bbdf31fbe8a6..98505f239aca 100644 --- a/React/Fabric/Utils/PlatformRunLoopObserver.h +++ b/React/Fabric/Utils/PlatformRunLoopObserver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Utils/PlatformRunLoopObserver.mm b/React/Fabric/Utils/PlatformRunLoopObserver.mm index 09731eda3b08..9f6268df4473 100644 --- a/React/Fabric/Utils/PlatformRunLoopObserver.mm +++ b/React/Fabric/Utils/PlatformRunLoopObserver.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Utils/RCTGenericDelegateSplitter.h b/React/Fabric/Utils/RCTGenericDelegateSplitter.h index d79640203a93..77bbac20d7dd 100644 --- a/React/Fabric/Utils/RCTGenericDelegateSplitter.h +++ b/React/Fabric/Utils/RCTGenericDelegateSplitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Fabric/Utils/RCTGenericDelegateSplitter.mm b/React/Fabric/Utils/RCTGenericDelegateSplitter.mm index 7a7e109fb115..2f4ce5cf7349 100644 --- a/React/Fabric/Utils/RCTGenericDelegateSplitter.mm +++ b/React/Fabric/Utils/RCTGenericDelegateSplitter.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Inspector/RCTInspector.h b/React/Inspector/RCTInspector.h index 97c8d2e62ba2..49acfcd7224f 100644 --- a/React/Inspector/RCTInspector.h +++ b/React/Inspector/RCTInspector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Inspector/RCTInspector.mm b/React/Inspector/RCTInspector.mm index 1f10fd8db860..ff1c007dd098 100644 --- a/React/Inspector/RCTInspector.mm +++ b/React/Inspector/RCTInspector.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Inspector/RCTInspectorPackagerConnection.h b/React/Inspector/RCTInspectorPackagerConnection.h index de086945e5a6..184b05d5970e 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.h +++ b/React/Inspector/RCTInspectorPackagerConnection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Inspector/RCTInspectorPackagerConnection.m b/React/Inspector/RCTInspectorPackagerConnection.m index 33febedb9f26..532c2d9c78bb 100644 --- a/React/Inspector/RCTInspectorPackagerConnection.m +++ b/React/Inspector/RCTInspectorPackagerConnection.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTEventEmitter.h b/React/Modules/RCTEventEmitter.h index e3bb12f77722..82fbf407e244 100644 --- a/React/Modules/RCTEventEmitter.h +++ b/React/Modules/RCTEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTEventEmitter.m b/React/Modules/RCTEventEmitter.m index 20af19f91a5d..477d0250e107 100644 --- a/React/Modules/RCTEventEmitter.m +++ b/React/Modules/RCTEventEmitter.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTI18nUtil.h b/React/Modules/RCTI18nUtil.h index 79828eb74958..c105344bf019 100644 --- a/React/Modules/RCTI18nUtil.h +++ b/React/Modules/RCTI18nUtil.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,19 +18,11 @@ + (instancetype)sharedInstance; - (BOOL)isRTL; - -/** - * Should be used very early during app start up - * Before the bridge is initialized - */ -@property (atomic, setter=allowRTL:) BOOL isRTLAllowed; - -/** - * Could be used to test RTL layout with English - * Used for development and testing purpose - */ -@property (atomic, setter=forceRTL:) BOOL isRTLForced; - -@property (atomic, setter=swapLeftAndRightInRTL:) BOOL doLeftAndRightSwapInRTL; +- (BOOL)isRTLAllowed; +- (void)allowRTL:(BOOL)value; +- (BOOL)isRTLForced; +- (void)forceRTL:(BOOL)value; +- (BOOL)doLeftAndRightSwapInRTL; +- (void)swapLeftAndRightInRTL:(BOOL)value; @end diff --git a/React/Modules/RCTI18nUtil.m b/React/Modules/RCTI18nUtil.m index 17207d053635..f77cb0c103bf 100644 --- a/React/Modules/RCTI18nUtil.m +++ b/React/Modules/RCTI18nUtil.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,6 @@ + (instancetype)sharedInstance dispatch_once(&onceToken, ^{ sharedInstance = [self new]; [sharedInstance swapLeftAndRightInRTL:true]; - [sharedInstance allowRTL:true]; }); return sharedInstance; @@ -41,6 +40,53 @@ - (BOOL)isRTL return NO; } +/** + * Should be used very early during app start up + * Before the bridge is initialized + * @return whether the app allows RTL layout, default is true + */ +- (BOOL)isRTLAllowed +{ + NSNumber *value = [[NSUserDefaults standardUserDefaults] objectForKey:@"RCTI18nUtil_allowRTL"]; + if (value == nil) { + return YES; + } + return [value boolValue]; +} + +- (void)allowRTL:(BOOL)rtlStatus +{ + [[NSUserDefaults standardUserDefaults] setBool:rtlStatus forKey:@"RCTI18nUtil_allowRTL"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +/** + * Could be used to test RTL layout with English + * Used for development and testing purpose + */ +- (BOOL)isRTLForced +{ + BOOL rtlStatus = [[NSUserDefaults standardUserDefaults] boolForKey:@"RCTI18nUtil_forceRTL"]; + return rtlStatus; +} + +- (void)forceRTL:(BOOL)rtlStatus +{ + [[NSUserDefaults standardUserDefaults] setBool:rtlStatus forKey:@"RCTI18nUtil_forceRTL"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +- (BOOL)doLeftAndRightSwapInRTL +{ + return [[NSUserDefaults standardUserDefaults] boolForKey:@"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"]; +} + +- (void)swapLeftAndRightInRTL:(BOOL)value +{ + [[NSUserDefaults standardUserDefaults] setBool:value forKey:@"RCTI18nUtil_makeRTLFlipLeftAndRightStyles"]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + // Check if the current device language is RTL - (BOOL)isDevicePreferredLanguageRTL { diff --git a/React/Modules/RCTLayoutAnimation.h b/React/Modules/RCTLayoutAnimation.h index e907a997d7b2..4248dca850a3 100644 --- a/React/Modules/RCTLayoutAnimation.h +++ b/React/Modules/RCTLayoutAnimation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTLayoutAnimation.m b/React/Modules/RCTLayoutAnimation.m index 7b702c18d80d..d88fa0fba699 100644 --- a/React/Modules/RCTLayoutAnimation.m +++ b/React/Modules/RCTLayoutAnimation.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTLayoutAnimationGroup.h b/React/Modules/RCTLayoutAnimationGroup.h index f13d046f61ec..02ae76278f15 100644 --- a/React/Modules/RCTLayoutAnimationGroup.h +++ b/React/Modules/RCTLayoutAnimationGroup.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTLayoutAnimationGroup.m b/React/Modules/RCTLayoutAnimationGroup.m index bffa03328592..88f9f5826010 100644 --- a/React/Modules/RCTLayoutAnimationGroup.m +++ b/React/Modules/RCTLayoutAnimationGroup.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTRedBoxExtraDataViewController.h b/React/Modules/RCTRedBoxExtraDataViewController.h index 8d2b4c2210bb..1308cdea2f49 100644 --- a/React/Modules/RCTRedBoxExtraDataViewController.h +++ b/React/Modules/RCTRedBoxExtraDataViewController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTRedBoxExtraDataViewController.m b/React/Modules/RCTRedBoxExtraDataViewController.m index 9b006ec68c1e..fb2b2e338477 100644 --- a/React/Modules/RCTRedBoxExtraDataViewController.m +++ b/React/Modules/RCTRedBoxExtraDataViewController.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTSurfacePresenterStub.h b/React/Modules/RCTSurfacePresenterStub.h index 32a2b80e3c82..9ffc2813120b 100644 --- a/React/Modules/RCTSurfacePresenterStub.h +++ b/React/Modules/RCTSurfacePresenterStub.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTSurfacePresenterStub.m b/React/Modules/RCTSurfacePresenterStub.m index 8a78199147b6..e4e0ec7404be 100644 --- a/React/Modules/RCTSurfacePresenterStub.m +++ b/React/Modules/RCTSurfacePresenterStub.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTUIManager.h b/React/Modules/RCTUIManager.h index 65309cc0cc49..77472622f3f8 100644 --- a/React/Modules/RCTUIManager.h +++ b/React/Modules/RCTUIManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 58f6a4afd10e..995068e5846a 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTUIManagerObserverCoordinator.h b/React/Modules/RCTUIManagerObserverCoordinator.h index f3511595bd82..eeb569c41ee2 100644 --- a/React/Modules/RCTUIManagerObserverCoordinator.h +++ b/React/Modules/RCTUIManagerObserverCoordinator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTUIManagerObserverCoordinator.mm b/React/Modules/RCTUIManagerObserverCoordinator.mm index 389bedab3fb6..dc560e38c0c9 100644 --- a/React/Modules/RCTUIManagerObserverCoordinator.mm +++ b/React/Modules/RCTUIManagerObserverCoordinator.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTUIManagerUtils.h b/React/Modules/RCTUIManagerUtils.h index 2bf9f57d2041..80228dbd71a4 100644 --- a/React/Modules/RCTUIManagerUtils.h +++ b/React/Modules/RCTUIManagerUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Modules/RCTUIManagerUtils.m b/React/Modules/RCTUIManagerUtils.m index 7b19bf2cf353..3ec59399ef79 100644 --- a/React/Modules/RCTUIManagerUtils.m +++ b/React/Modules/RCTUIManagerUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTMacros.h b/React/Profiler/RCTMacros.h index 9144bbe7dfc5..b636f9a831d4 100644 --- a/React/Profiler/RCTMacros.h +++ b/React/Profiler/RCTMacros.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTProfile.h b/React/Profiler/RCTProfile.h index 7c6dec159c85..7341566ce86b 100644 --- a/React/Profiler/RCTProfile.h +++ b/React/Profiler/RCTProfile.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTProfile.m b/React/Profiler/RCTProfile.m index d57c098e0989..75200bed749a 100644 --- a/React/Profiler/RCTProfile.m +++ b/React/Profiler/RCTProfile.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTProfileTrampoline-arm.S b/React/Profiler/RCTProfileTrampoline-arm.S index f304932c9231..32d17e04d5f7 100644 --- a/React/Profiler/RCTProfileTrampoline-arm.S +++ b/React/Profiler/RCTProfileTrampoline-arm.S @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTProfileTrampoline-arm64.S b/React/Profiler/RCTProfileTrampoline-arm64.S index c858371f3306..87650f498aff 100644 --- a/React/Profiler/RCTProfileTrampoline-arm64.S +++ b/React/Profiler/RCTProfileTrampoline-arm64.S @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTProfileTrampoline-i386.S b/React/Profiler/RCTProfileTrampoline-i386.S index d213c46321ac..2f0e1837f585 100644 --- a/React/Profiler/RCTProfileTrampoline-i386.S +++ b/React/Profiler/RCTProfileTrampoline-i386.S @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Profiler/RCTProfileTrampoline-x86_64.S b/React/Profiler/RCTProfileTrampoline-x86_64.S index a40795c81b7d..f7bb214b14e6 100644 --- a/React/Profiler/RCTProfileTrampoline-x86_64.S +++ b/React/Profiler/RCTProfileTrampoline-x86_64.S @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/React-RCTFabric.podspec b/React/React-RCTFabric.podspec index 21352e308a11..9ea86d4aa2d9 100644 --- a/React/React-RCTFabric.podspec +++ b/React/React-RCTFabric.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -36,7 +36,7 @@ Pod::Spec.new do |s| s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags s.header_dir = "React" s.framework = "JavaScriptCore" - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\"" } + s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\" \"$(PODS_ROOT)/Headers/Public/React-Codegen\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" } s.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\"", "OTHER_CFLAGS" => "$(inherited) -DRN_FABRIC_ENABLED" + " " + folly_flags } diff --git a/React/Tests/Mounting/RCTComponentViewRegistryTests.mm b/React/Tests/Mounting/RCTComponentViewRegistryTests.mm index b76038969b29..9bb5484a4c5c 100644 --- a/React/Tests/Mounting/RCTComponentViewRegistryTests.mm +++ b/React/Tests/Mounting/RCTComponentViewRegistryTests.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Tests/Text/RCTParagraphComponentViewTests.mm b/React/Tests/Text/RCTParagraphComponentViewTests.mm index e847ef76f2f4..9ed0483b4b17 100644 --- a/React/Tests/Text/RCTParagraphComponentViewTests.mm +++ b/React/Tests/Text/RCTParagraphComponentViewTests.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -322,17 +322,17 @@ - (void)setUp - (void)testAttributedString { ParagraphShadowNode::ConcreteState::Shared _stateA = stateWithShadowNode(ParagrahShadowNodeA_); - RCTParagraphComponentView *paragraphComponentViewA = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentViewA = [RCTParagraphComponentView new]; [paragraphComponentViewA updateProps:ParagrahShadowNodeA_->getProps() oldProps:nullptr]; [paragraphComponentViewA updateState:_stateA oldState:nil]; ParagraphShadowNode::ConcreteState::Shared _stateB = stateWithShadowNode(ParagrahShadowNodeB_); - RCTParagraphComponentView *paragraphComponentViewB = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentViewB = [RCTParagraphComponentView new]; [paragraphComponentViewB updateProps:ParagrahShadowNodeB_->getProps() oldProps:nullptr]; [paragraphComponentViewB updateState:_stateB oldState:nil]; ParagraphShadowNode::ConcreteState::Shared _stateC = stateWithShadowNode(ParagrahShadowNodeC_); - RCTParagraphComponentView *paragraphComponentViewC = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentViewC = [RCTParagraphComponentView new]; [paragraphComponentViewC updateProps:ParagrahShadowNodeC_->getProps() oldProps:nullptr]; [paragraphComponentViewC updateState:_stateC oldState:nil]; @@ -358,7 +358,7 @@ - (void)testAccessibilityMultipleLinks { // initialize the paragraphComponentView to get the accessibilityElements ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(ParagrahShadowNodeA_); - RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentView = [RCTParagraphComponentView new]; [paragraphComponentView updateProps:ParagrahShadowNodeA_->getProps() oldProps:nullptr]; [paragraphComponentView updateState:_state oldState:nil]; @@ -379,7 +379,7 @@ - (void)testAccessibilityMultipleLinks - (void)testAccessibilityLinkWrappingMultipleLines { ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(ParagrahShadowNodeB_); - RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentView = [RCTParagraphComponentView new]; [paragraphComponentView updateProps:ParagrahShadowNodeB_->getProps() oldProps:nullptr]; [paragraphComponentView updateState:_state oldState:nil]; @@ -393,7 +393,7 @@ - (void)testAccessibilityLinkWrappingMultipleLines - (void)testAccessibilityTruncatedText { ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(ParagrahShadowNodeC_); - RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentView = [RCTParagraphComponentView new]; [paragraphComponentView updateProps:ParagrahShadowNodeC_->getProps() oldProps:nullptr]; [paragraphComponentView updateState:_state oldState:nil]; @@ -458,7 +458,7 @@ - (void)testEntireParagraphLink rootShadowNode->layoutIfNeeded(); ParagraphShadowNode::ConcreteState::Shared _state = stateWithShadowNode(paragrahShadowNode); - RCTParagraphComponentView *paragraphComponentView = [[RCTParagraphComponentView alloc] init]; + RCTParagraphComponentView *paragraphComponentView = [RCTParagraphComponentView new]; [paragraphComponentView updateProps:paragrahShadowNode->getProps() oldProps:nullptr]; [paragraphComponentView updateState:_state oldState:nil]; diff --git a/React/UIUtils/RCTUIUtils.h b/React/UIUtils/RCTUIUtils.h index 14fadee007aa..8fd1850fb73a 100644 --- a/React/UIUtils/RCTUIUtils.h +++ b/React/UIUtils/RCTUIUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/UIUtils/RCTUIUtils.m b/React/UIUtils/RCTUIUtils.m index ba9443e298a0..9dce915ae94b 100644 --- a/React/UIUtils/RCTUIUtils.m +++ b/React/UIUtils/RCTUIUtils.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTActivityIndicatorView.h b/React/Views/RCTActivityIndicatorView.h index 62d5f328a347..1d5015501e59 100644 --- a/React/Views/RCTActivityIndicatorView.h +++ b/React/Views/RCTActivityIndicatorView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTActivityIndicatorView.m b/React/Views/RCTActivityIndicatorView.m index 0a90bb0a5ea1..14c9fb17f6ad 100644 --- a/React/Views/RCTActivityIndicatorView.m +++ b/React/Views/RCTActivityIndicatorView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTActivityIndicatorViewManager.h b/React/Views/RCTActivityIndicatorViewManager.h index 61bbd7261b0b..2d31e2cf98bf 100644 --- a/React/Views/RCTActivityIndicatorViewManager.h +++ b/React/Views/RCTActivityIndicatorViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTActivityIndicatorViewManager.m b/React/Views/RCTActivityIndicatorViewManager.m index 13f8b910310e..10ef8ae76302 100644 --- a/React/Views/RCTActivityIndicatorViewManager.m +++ b/React/Views/RCTActivityIndicatorViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTAnimationType.h b/React/Views/RCTAnimationType.h index 4dcb316011e0..005b6dc09ae0 100644 --- a/React/Views/RCTAnimationType.h +++ b/React/Views/RCTAnimationType.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTAutoInsetsProtocol.h b/React/Views/RCTAutoInsetsProtocol.h index fc18a9adff6e..0d12aba5e760 100644 --- a/React/Views/RCTAutoInsetsProtocol.h +++ b/React/Views/RCTAutoInsetsProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTBorderDrawing.h b/React/Views/RCTBorderDrawing.h index 884aa79f4e87..4c92868f7c60 100644 --- a/React/Views/RCTBorderDrawing.h +++ b/React/Views/RCTBorderDrawing.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTBorderDrawing.m b/React/Views/RCTBorderDrawing.m index afc99f41a472..140b9877f63d 100644 --- a/React/Views/RCTBorderDrawing.m +++ b/React/Views/RCTBorderDrawing.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTBorderStyle.h b/React/Views/RCTBorderStyle.h index 70d6d72011f9..6a97af6804ff 100644 --- a/React/Views/RCTBorderStyle.h +++ b/React/Views/RCTBorderStyle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTComponent.h b/React/Views/RCTComponent.h index 4258334f2032..d6098c7072ab 100644 --- a/React/Views/RCTComponent.h +++ b/React/Views/RCTComponent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTComponentData.h b/React/Views/RCTComponentData.h index 6a1fdb7a2f0d..352f8262506d 100644 --- a/React/Views/RCTComponentData.h +++ b/React/Views/RCTComponentData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTComponentData.m b/React/Views/RCTComponentData.m index 5819e4d1f982..99807d4debec 100644 --- a/React/Views/RCTComponentData.m +++ b/React/Views/RCTComponentData.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -428,10 +428,18 @@ - (void)setProps:(NSDictionary *)props forShadowView:(RCTShadowV if ([type isEqualToString:@"RCTBubblingEventBlock"]) { [bubblingEvents addObject:RCTNormalizeInputEventName(name)]; - propTypes[name] = @"BOOL"; + + // TODO(109509380): Remove this gating + if (!RCTViewConfigEventValidAttributesDisabled()) { + propTypes[name] = @"BOOL"; + } } else if ([type isEqualToString:@"RCTDirectEventBlock"]) { [directEvents addObject:RCTNormalizeInputEventName(name)]; - propTypes[name] = @"BOOL"; + + // TODO(109509380): Remove this gating + if (!RCTViewConfigEventValidAttributesDisabled()) { + propTypes[name] = @"BOOL"; + } } else { propTypes[name] = type; } diff --git a/React/Views/RCTConvert+CoreLocation.h b/React/Views/RCTConvert+CoreLocation.h index 251202f99900..096f2ac3c78c 100644 --- a/React/Views/RCTConvert+CoreLocation.h +++ b/React/Views/RCTConvert+CoreLocation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTConvert+CoreLocation.m b/React/Views/RCTConvert+CoreLocation.m index 0fd6bb13a138..a4d0516a28e6 100644 --- a/React/Views/RCTConvert+CoreLocation.m +++ b/React/Views/RCTConvert+CoreLocation.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTConvert+Transform.h b/React/Views/RCTConvert+Transform.h index 07a7b2c05f1c..9ad72aef37e6 100644 --- a/React/Views/RCTConvert+Transform.h +++ b/React/Views/RCTConvert+Transform.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTConvert+Transform.m b/React/Views/RCTConvert+Transform.m index 06a0db3b4863..1d2b99b3a055 100644 --- a/React/Views/RCTConvert+Transform.m +++ b/React/Views/RCTConvert+Transform.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTDatePicker.h b/React/Views/RCTDatePicker.h index 14f9a2ef8e53..e5a60fb7e23b 100644 --- a/React/Views/RCTDatePicker.h +++ b/React/Views/RCTDatePicker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTDatePicker.m b/React/Views/RCTDatePicker.m index 064191b3e8aa..15851858177f 100644 --- a/React/Views/RCTDatePicker.m +++ b/React/Views/RCTDatePicker.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTDatePickerManager.h b/React/Views/RCTDatePickerManager.h index bd14cd3b7c89..fbc6f52f5042 100644 --- a/React/Views/RCTDatePickerManager.h +++ b/React/Views/RCTDatePickerManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTDatePickerManager.m b/React/Views/RCTDatePickerManager.m index f6fec6d739f1..53ec102257cd 100644 --- a/React/Views/RCTDatePickerManager.m +++ b/React/Views/RCTDatePickerManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTFont.h b/React/Views/RCTFont.h index 15437dd0889e..5ddc34da35f1 100644 --- a/React/Views/RCTFont.h +++ b/React/Views/RCTFont.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTFont.mm b/React/Views/RCTFont.mm index 549adca51b19..679f2cea43eb 100644 --- a/React/Views/RCTFont.mm +++ b/React/Views/RCTFont.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -355,16 +355,18 @@ + (UIFont *)updateFont:(UIFont *)font } } - // Get the closest font that matches the given weight for the fontFamily - CGFloat closestWeight = INFINITY; NSArray *names = fontNamesForFamilyName(familyName); - for (NSString *name in names) { - UIFont *match = [UIFont fontWithName:name size:fontSize]; - if (isItalic == isItalicFont(match) && isCondensed == isCondensedFont(match)) { - CGFloat testWeight = weightOfFont(match); - if (ABS(testWeight - fontWeight) < ABS(closestWeight - fontWeight)) { - font = match; - closestWeight = testWeight; + if (!didFindFont) { + // Get the closest font that matches the given weight for the fontFamily + CGFloat closestWeight = INFINITY; + for (NSString *name in names) { + UIFont *match = [UIFont fontWithName:name size:fontSize]; + if (isItalic == isItalicFont(match) && isCondensed == isCondensedFont(match)) { + CGFloat testWeight = weightOfFont(match); + if (ABS(testWeight - fontWeight) < ABS(closestWeight - fontWeight)) { + font = match; + closestWeight = testWeight; + } } } } diff --git a/React/Views/RCTLayout.h b/React/Views/RCTLayout.h index d83803284fc2..55340ad938d1 100644 --- a/React/Views/RCTLayout.h +++ b/React/Views/RCTLayout.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTLayout.m b/React/Views/RCTLayout.m index b6e66d409623..e11d7e4b8189 100644 --- a/React/Views/RCTLayout.m +++ b/React/Views/RCTLayout.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTMaskedView.h b/React/Views/RCTMaskedView.h index 46282400246b..cab90b6cdca3 100644 --- a/React/Views/RCTMaskedView.h +++ b/React/Views/RCTMaskedView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTMaskedView.m b/React/Views/RCTMaskedView.m index bea280fe454a..bf9bd88edf84 100644 --- a/React/Views/RCTMaskedView.m +++ b/React/Views/RCTMaskedView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTMaskedViewManager.h b/React/Views/RCTMaskedViewManager.h index a37f85a33e6f..6aaf61fa281d 100644 --- a/React/Views/RCTMaskedViewManager.h +++ b/React/Views/RCTMaskedViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTMaskedViewManager.m b/React/Views/RCTMaskedViewManager.m index 6f463c560cb1..956ccf97998a 100644 --- a/React/Views/RCTMaskedViewManager.m +++ b/React/Views/RCTMaskedViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTModalHostView.h b/React/Views/RCTModalHostView.h index 01d386154000..0246328f99f2 100644 --- a/React/Views/RCTModalHostView.h +++ b/React/Views/RCTModalHostView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,6 +25,11 @@ @property (nonatomic, copy) RCTDirectEventBlock onShow; @property (nonatomic, assign) BOOL visible; +// Android only +@property (nonatomic, assign) BOOL statusBarTranslucent; +@property (nonatomic, assign) BOOL hardwareAccelerated; +@property (nonatomic, assign) BOOL animated; + @property (nonatomic, copy) NSNumber *identifier; @property (nonatomic, weak) id delegate; diff --git a/React/Views/RCTModalHostView.m b/React/Views/RCTModalHostView.m index bea9e08af961..65428a037d7a 100644 --- a/React/Views/RCTModalHostView.m +++ b/React/Views/RCTModalHostView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTModalHostViewController.h b/React/Views/RCTModalHostViewController.h index a3f66b6b0683..b12b0f7fc151 100644 --- a/React/Views/RCTModalHostViewController.h +++ b/React/Views/RCTModalHostViewController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTModalHostViewController.m b/React/Views/RCTModalHostViewController.m index 00c149d3db84..c9f717e09435 100644 --- a/React/Views/RCTModalHostViewController.m +++ b/React/Views/RCTModalHostViewController.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTModalHostViewManager.h b/React/Views/RCTModalHostViewManager.h index e5b08157128a..11b52984b308 100644 --- a/React/Views/RCTModalHostViewManager.h +++ b/React/Views/RCTModalHostViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTModalHostViewManager.m b/React/Views/RCTModalHostViewManager.m index 80342bac8dd7..7fab70ef6363 100644 --- a/React/Views/RCTModalHostViewManager.m +++ b/React/Views/RCTModalHostViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -116,6 +116,9 @@ - (void)invalidate RCT_EXPORT_VIEW_PROPERTY(animationType, NSString) RCT_EXPORT_VIEW_PROPERTY(presentationStyle, UIModalPresentationStyle) RCT_EXPORT_VIEW_PROPERTY(transparent, BOOL) +RCT_EXPORT_VIEW_PROPERTY(statusBarTranslucent, BOOL) +RCT_EXPORT_VIEW_PROPERTY(hardwareAccelerated, BOOL) +RCT_EXPORT_VIEW_PROPERTY(animated, BOOL) RCT_EXPORT_VIEW_PROPERTY(onShow, RCTDirectEventBlock) RCT_EXPORT_VIEW_PROPERTY(identifier, NSNumber) RCT_EXPORT_VIEW_PROPERTY(supportedOrientations, NSArray) diff --git a/React/Views/RCTModalManager.h b/React/Views/RCTModalManager.h index 4fbe6dfbd01e..237037fd8db6 100644 --- a/React/Views/RCTModalManager.h +++ b/React/Views/RCTModalManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTModalManager.m b/React/Views/RCTModalManager.m index 992b73c62db6..85ddb29b1490 100644 --- a/React/Views/RCTModalManager.m +++ b/React/Views/RCTModalManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTPointerEvents.h b/React/Views/RCTPointerEvents.h index 001c85f4184c..ff8d53357ad6 100644 --- a/React/Views/RCTPointerEvents.h +++ b/React/Views/RCTPointerEvents.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTProgressViewManager.h b/React/Views/RCTProgressViewManager.h index 32b09881e7fb..2fb02c8083fe 100644 --- a/React/Views/RCTProgressViewManager.h +++ b/React/Views/RCTProgressViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTProgressViewManager.m b/React/Views/RCTProgressViewManager.m index ed434250101f..12299b5c536d 100644 --- a/React/Views/RCTProgressViewManager.m +++ b/React/Views/RCTProgressViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTRootShadowView.h b/React/Views/RCTRootShadowView.h index 74af7e82f28d..a312d9abfede 100644 --- a/React/Views/RCTRootShadowView.h +++ b/React/Views/RCTRootShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTRootShadowView.m b/React/Views/RCTRootShadowView.m index a68c3a397cc4..9db376d7c49f 100644 --- a/React/Views/RCTRootShadowView.m +++ b/React/Views/RCTRootShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSegmentedControl.h b/React/Views/RCTSegmentedControl.h index b428f4d86b31..7cb9ffd03dc8 100644 --- a/React/Views/RCTSegmentedControl.h +++ b/React/Views/RCTSegmentedControl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSegmentedControl.m b/React/Views/RCTSegmentedControl.m index 1ffdb59921a3..254b8ce6d5ca 100644 --- a/React/Views/RCTSegmentedControl.m +++ b/React/Views/RCTSegmentedControl.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSegmentedControlManager.h b/React/Views/RCTSegmentedControlManager.h index edc9df9a792e..cf85c389f00b 100644 --- a/React/Views/RCTSegmentedControlManager.h +++ b/React/Views/RCTSegmentedControlManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSegmentedControlManager.m b/React/Views/RCTSegmentedControlManager.m index a5e921d3c1e4..cdb62cf9a367 100644 --- a/React/Views/RCTSegmentedControlManager.m +++ b/React/Views/RCTSegmentedControlManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTShadowView+Internal.h b/React/Views/RCTShadowView+Internal.h index b871ce6086f8..0455863f726d 100644 --- a/React/Views/RCTShadowView+Internal.h +++ b/React/Views/RCTShadowView+Internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTShadowView+Internal.m b/React/Views/RCTShadowView+Internal.m index 61676e7b1242..f87cd084abff 100644 --- a/React/Views/RCTShadowView+Internal.m +++ b/React/Views/RCTShadowView+Internal.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTShadowView+Layout.h b/React/Views/RCTShadowView+Layout.h index 7e0967432743..e3209520881d 100644 --- a/React/Views/RCTShadowView+Layout.h +++ b/React/Views/RCTShadowView+Layout.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTShadowView+Layout.m b/React/Views/RCTShadowView+Layout.m index 91662c0b6468..6595f4e75a71 100644 --- a/React/Views/RCTShadowView+Layout.m +++ b/React/Views/RCTShadowView+Layout.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTShadowView.h b/React/Views/RCTShadowView.h index 4696b142137d..428d2eb9fc31 100644 --- a/React/Views/RCTShadowView.h +++ b/React/Views/RCTShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTShadowView.m b/React/Views/RCTShadowView.m index af103bb1f0d0..016060a226c4 100644 --- a/React/Views/RCTShadowView.m +++ b/React/Views/RCTShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSlider.h b/React/Views/RCTSlider.h index 355cc362fcb4..6eae1920cc5e 100644 --- a/React/Views/RCTSlider.h +++ b/React/Views/RCTSlider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSlider.m b/React/Views/RCTSlider.m index 29918c7b889e..a58427b89697 100644 --- a/React/Views/RCTSlider.m +++ b/React/Views/RCTSlider.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSliderManager.h b/React/Views/RCTSliderManager.h index 49de42c5654c..cbe097644c2e 100644 --- a/React/Views/RCTSliderManager.h +++ b/React/Views/RCTSliderManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSliderManager.m b/React/Views/RCTSliderManager.m index e2c281011021..9c871f6941a9 100644 --- a/React/Views/RCTSliderManager.m +++ b/React/Views/RCTSliderManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -86,5 +86,6 @@ - (void)sliderTouchEnd:(RCTSlider *)sender view.enabled = defaultView.enabled; } } +RCT_CUSTOM_VIEW_PROPERTY(enabled, BOOL, RCTSlider) {} @end diff --git a/React/Views/RCTSwitch.h b/React/Views/RCTSwitch.h index 3b42a50070cd..dfbc7a0b32ea 100644 --- a/React/Views/RCTSwitch.h +++ b/React/Views/RCTSwitch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSwitch.m b/React/Views/RCTSwitch.m index 8abd4d5afba9..0cce9e180357 100644 --- a/React/Views/RCTSwitch.m +++ b/React/Views/RCTSwitch.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSwitchManager.h b/React/Views/RCTSwitchManager.h index 06015b19edb0..8e1fc5d47976 100644 --- a/React/Views/RCTSwitchManager.h +++ b/React/Views/RCTSwitchManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTSwitchManager.m b/React/Views/RCTSwitchManager.m index f37df49c4dfa..b04b51f844e1 100644 --- a/React/Views/RCTSwitchManager.m +++ b/React/Views/RCTSwitchManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTTextDecorationLineType.h b/React/Views/RCTTextDecorationLineType.h index ddf9195f7fd0..bf14d85a9de9 100644 --- a/React/Views/RCTTextDecorationLineType.h +++ b/React/Views/RCTTextDecorationLineType.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTView.h b/React/Views/RCTView.h index c82242d90b10..120677e9ee66 100644 --- a/React/Views/RCTView.h +++ b/React/Views/RCTView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,14 +10,11 @@ #import #import #import -#import extern const UIAccessibilityTraits SwitchAccessibilityTrait; @protocol RCTAutoInsetsProtocol; -@class RCTView; - @interface RCTView : UIView /** @@ -37,11 +34,6 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait; withScrollView:(UIScrollView *)scrollView updateOffset:(BOOL)updateOffset; -/** - * Find the first view controller whose view, or any subview is the specified view. - */ -+ (UIEdgeInsets)contentInsetsForView:(UIView *)curView; - /** * Layout direction of the view. * This is inherited from UIView+React, but we override it here diff --git a/React/Views/RCTView.m b/React/Views/RCTView.m index e2cdef652ad0..8ed93cdf51cf 100644 --- a/React/Views/RCTView.m +++ b/React/Views/RCTView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,10 +9,9 @@ #import "RCTAutoInsetsProtocol.h" #import "RCTBorderDrawing.h" -#import "RCTConvert.h" #import "RCTI18nUtil.h" #import "RCTLog.h" -#import "RCTUtils.h" +#import "RCTViewUtils.h" #import "UIView+React.h" UIAccessibilityTraits const SwitchAccessibilityTrait = 0x20000000000001; @@ -232,8 +231,8 @@ - (NSString *)accessibilityLabel return nil; } - accessibilityActionsNameMap = [[NSMutableDictionary alloc] init]; - accessibilityActionsLabelMap = [[NSMutableDictionary alloc] init]; + accessibilityActionsNameMap = [NSMutableDictionary new]; + accessibilityActionsLabelMap = [NSMutableDictionary new]; NSMutableArray *actions = [NSMutableArray array]; for (NSDictionary *action in self.accessibilityActions) { if (action[@"name"]) { @@ -458,7 +457,7 @@ + (void)autoAdjustInsetsForView:(UIView *)parentView CGPoint contentOffset = scrollView.contentOffset; if (parentView.automaticallyAdjustContentInsets) { - UIEdgeInsets autoInset = [self contentInsetsForView:parentView]; + UIEdgeInsets autoInset = RCTContentInsets(parentView); baseInset.top += autoInset.top; baseInset.bottom += autoInset.bottom; baseInset.left += autoInset.left; @@ -480,18 +479,6 @@ + (void)autoAdjustInsetsForView:(UIView *)parentView } } -+ (UIEdgeInsets)contentInsetsForView:(UIView *)view -{ - while (view) { - UIViewController *controller = view.reactViewController; - if (controller) { - return controller.view.safeAreaInsets; - } - view = view.superview; - } - return UIEdgeInsetsZero; -} - #pragma mark - View Unmounting - (void)react_remountAllSubviews diff --git a/React/Views/RCTViewManager.h b/React/Views/RCTViewManager.h index 5c1eba4d80a9..1676e69f2aca 100644 --- a/React/Views/RCTViewManager.h +++ b/React/Views/RCTViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTViewManager.m b/React/Views/RCTViewManager.m index 72e195c556b9..a46158dcee39 100644 --- a/React/Views/RCTViewManager.m +++ b/React/Views/RCTViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -163,8 +163,9 @@ - (RCTShadowView *)shadowView RCT_CUSTOM_VIEW_PROPERTY(transform, CATransform3D, RCTView) { view.layer.transform = json ? [RCTConvert CATransform3D:json] : defaultView.layer.transform; - // Enable edge antialiasing in perspective transforms - view.layer.allowsEdgeAntialiasing = !(view.layer.transform.m34 == 0.0f); + // Enable edge antialiasing in rotation, skew, or perspective transforms + view.layer.allowsEdgeAntialiasing = + view.layer.transform.m12 != 0.0f || view.layer.transform.m21 != 0.0f || view.layer.transform.m34 != 0.0f; } RCT_CUSTOM_VIEW_PROPERTY(accessibilityRole, UIAccessibilityTraits, RCTView) @@ -189,7 +190,7 @@ - (RCTShadowView *)shadowView RCT_CUSTOM_VIEW_PROPERTY(accessibilityState, NSDictionary, RCTView) { NSDictionary *state = json ? [RCTConvert NSDictionary:json] : nil; - NSMutableDictionary *newState = [[NSMutableDictionary alloc] init]; + NSMutableDictionary *newState = [NSMutableDictionary new]; if (!state) { return; diff --git a/React/Views/RCTViewUtils.h b/React/Views/RCTViewUtils.h new file mode 100644 index 000000000000..a6204c5faa9f --- /dev/null +++ b/React/Views/RCTViewUtils.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +RCT_EXTERN_C_BEGIN + +UIEdgeInsets RCTContentInsets(UIView *view); + +RCT_EXTERN_C_END + +NS_ASSUME_NONNULL_END diff --git a/React/Views/RCTViewUtils.m b/React/Views/RCTViewUtils.m new file mode 100644 index 000000000000..d852325e6f5f --- /dev/null +++ b/React/Views/RCTViewUtils.m @@ -0,0 +1,22 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RCTViewUtils.h" + +#import "UIView+React.h" + +UIEdgeInsets RCTContentInsets(UIView *view) +{ + while (view) { + UIViewController *controller = view.reactViewController; + if (controller) { + return controller.view.safeAreaInsets; + } + view = view.superview; + } + return UIEdgeInsetsZero; +} diff --git a/React/Views/RCTWeakViewHolder.h b/React/Views/RCTWeakViewHolder.h index ce39eee5d38c..5417f2e2e775 100644 --- a/React/Views/RCTWeakViewHolder.h +++ b/React/Views/RCTWeakViewHolder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTWrapperViewController.h b/React/Views/RCTWrapperViewController.h index dc9b0d6dba4d..b8277587684b 100644 --- a/React/Views/RCTWrapperViewController.h +++ b/React/Views/RCTWrapperViewController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RCTWrapperViewController.m b/React/Views/RCTWrapperViewController.m index 20dd2101e918..25f325b970eb 100644 --- a/React/Views/RCTWrapperViewController.m +++ b/React/Views/RCTWrapperViewController.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RefreshControl/RCTRefreshControl.h b/React/Views/RefreshControl/RCTRefreshControl.h index c17b226e069f..35c60c2878b6 100644 --- a/React/Views/RefreshControl/RCTRefreshControl.h +++ b/React/Views/RefreshControl/RCTRefreshControl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RefreshControl/RCTRefreshControl.m b/React/Views/RefreshControl/RCTRefreshControl.m index 38f2ab53a104..d6c6e487ab06 100644 --- a/React/Views/RefreshControl/RCTRefreshControl.m +++ b/React/Views/RefreshControl/RCTRefreshControl.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RefreshControl/RCTRefreshControlManager.h b/React/Views/RefreshControl/RCTRefreshControlManager.h index 107a9db57c31..123af7426c12 100644 --- a/React/Views/RefreshControl/RCTRefreshControlManager.h +++ b/React/Views/RefreshControl/RCTRefreshControlManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RefreshControl/RCTRefreshControlManager.m b/React/Views/RefreshControl/RCTRefreshControlManager.m index 87c997a8edda..40aaf9c51ebd 100644 --- a/React/Views/RefreshControl/RCTRefreshControlManager.m +++ b/React/Views/RefreshControl/RCTRefreshControlManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/RefreshControl/RCTRefreshableProtocol.h b/React/Views/RefreshControl/RCTRefreshableProtocol.h index 9271e2d853d5..b0b06f2e4db7 100644 --- a/React/Views/RefreshControl/RCTRefreshableProtocol.h +++ b/React/Views/RefreshControl/RCTRefreshableProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaShadowView.h b/React/Views/SafeAreaView/RCTSafeAreaShadowView.h index 784a4e00640f..5a5caaaefb71 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaShadowView.h +++ b/React/Views/SafeAreaView/RCTSafeAreaShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaShadowView.m b/React/Views/SafeAreaView/RCTSafeAreaShadowView.m index ea6f1398bd86..a9a7bee303e3 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaShadowView.m +++ b/React/Views/SafeAreaView/RCTSafeAreaShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaView.h b/React/Views/SafeAreaView/RCTSafeAreaView.h index ae1b6b325641..c0fea6b7bacf 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaView.h +++ b/React/Views/SafeAreaView/RCTSafeAreaView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaView.m b/React/Views/SafeAreaView/RCTSafeAreaView.m index 93ca0423a0b8..89efb7ff5852 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaView.m +++ b/React/Views/SafeAreaView/RCTSafeAreaView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h b/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h index 24c776c510cd..b78edb76c35e 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h +++ b/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m b/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m index 456df9dae336..76c3558b27af 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m +++ b/React/Views/SafeAreaView/RCTSafeAreaViewLocalData.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaViewManager.h b/React/Views/SafeAreaView/RCTSafeAreaViewManager.h index 71dcc3ca5c7f..4572832c849c 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaViewManager.h +++ b/React/Views/SafeAreaView/RCTSafeAreaViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/SafeAreaView/RCTSafeAreaViewManager.m b/React/Views/SafeAreaView/RCTSafeAreaViewManager.m index cb22ab661971..01c24f4f2913 100644 --- a/React/Views/SafeAreaView/RCTSafeAreaViewManager.m +++ b/React/Views/SafeAreaView/RCTSafeAreaViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollContentShadowView.h b/React/Views/ScrollView/RCTScrollContentShadowView.h index ecae4761671b..126a57586b6d 100644 --- a/React/Views/ScrollView/RCTScrollContentShadowView.h +++ b/React/Views/ScrollView/RCTScrollContentShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollContentShadowView.m b/React/Views/ScrollView/RCTScrollContentShadowView.m index bb27f2ab55f8..c892556c6aa1 100644 --- a/React/Views/ScrollView/RCTScrollContentShadowView.m +++ b/React/Views/ScrollView/RCTScrollContentShadowView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollContentView.h b/React/Views/ScrollView/RCTScrollContentView.h index 8d33a5ad39ec..853a76b647ce 100644 --- a/React/Views/ScrollView/RCTScrollContentView.h +++ b/React/Views/ScrollView/RCTScrollContentView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollContentView.m b/React/Views/ScrollView/RCTScrollContentView.m index 8006540a70f1..08fcd52c499b 100644 --- a/React/Views/ScrollView/RCTScrollContentView.m +++ b/React/Views/ScrollView/RCTScrollContentView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollContentViewManager.h b/React/Views/ScrollView/RCTScrollContentViewManager.h index 7645c0464e3c..9b5dbbfe51b5 100644 --- a/React/Views/ScrollView/RCTScrollContentViewManager.h +++ b/React/Views/ScrollView/RCTScrollContentViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollContentViewManager.m b/React/Views/ScrollView/RCTScrollContentViewManager.m index 818d8f5c24e3..5ebbddf30cce 100644 --- a/React/Views/ScrollView/RCTScrollContentViewManager.m +++ b/React/Views/ScrollView/RCTScrollContentViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollEvent.h b/React/Views/ScrollView/RCTScrollEvent.h index 29a645d30c69..f756c22165c3 100644 --- a/React/Views/ScrollView/RCTScrollEvent.h +++ b/React/Views/ScrollView/RCTScrollEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollEvent.m b/React/Views/ScrollView/RCTScrollEvent.m index ce2a6b6971cd..944c64cdb408 100644 --- a/React/Views/ScrollView/RCTScrollEvent.m +++ b/React/Views/ScrollView/RCTScrollEvent.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollView.h b/React/Views/ScrollView/RCTScrollView.h index 765d3b3378a5..14554f688ac6 100644 --- a/React/Views/ScrollView/RCTScrollView.h +++ b/React/Views/ScrollView/RCTScrollView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,6 +35,7 @@ @property (nonatomic, assign) UIEdgeInsets contentInset; @property (nonatomic, assign) BOOL automaticallyAdjustContentInsets; +@property (nonatomic, assign) BOOL automaticallyAdjustKeyboardInsets; @property (nonatomic, assign) BOOL DEPRECATED_sendUpdatedChildFrames; @property (nonatomic, assign) NSTimeInterval scrollEventThrottle; @property (nonatomic, assign) BOOL centerContent; diff --git a/React/Views/ScrollView/RCTScrollView.m b/React/Views/ScrollView/RCTScrollView.m index eb8f90e1cd93..f0f64021aca6 100644 --- a/React/Views/ScrollView/RCTScrollView.m +++ b/React/Views/ScrollView/RCTScrollView.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,6 +17,7 @@ #import "RCTUIManagerObserverCoordinator.h" #import "RCTUIManagerUtils.h" #import "RCTUtils.h" +#import "RCTViewUtils.h" #import "UIView+Private.h" #import "UIView+React.h" @@ -273,11 +274,80 @@ @implementation RCTScrollView { NSHashTable *_scrollListeners; } +- (void)_registerKeyboardListener +{ + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(_keyboardWillChangeFrame:) + name:UIKeyboardWillChangeFrameNotification + object:nil]; +} + +- (void)_unregisterKeyboardListener +{ + [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillChangeFrameNotification object:nil]; +} + +static inline UIViewAnimationOptions animationOptionsWithCurve(UIViewAnimationCurve curve) +{ + // UIViewAnimationCurve #7 is used for keyboard and therefore private - so we can't use switch/case here. + // source: https://stackoverflow.com/a/7327374/5281431 + RCTAssert( + UIViewAnimationCurveLinear << 16 == UIViewAnimationOptionCurveLinear, + @"Unexpected implementation of UIViewAnimationCurve"); + return curve << 16; +} + +- (void)_keyboardWillChangeFrame:(NSNotification *)notification +{ + if (![self automaticallyAdjustKeyboardInsets]) { + return; + } + if ([self isHorizontal:_scrollView]) { + return; + } + + double duration = [notification.userInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; + UIViewAnimationCurve curve = + (UIViewAnimationCurve)[notification.userInfo[UIKeyboardAnimationCurveUserInfoKey] unsignedIntegerValue]; + CGRect beginFrame = [notification.userInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue]; + CGRect endFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; + + CGPoint absoluteViewOrigin = [self convertPoint:self.bounds.origin toView:nil]; + CGFloat scrollViewLowerY = self.inverted ? absoluteViewOrigin.y : absoluteViewOrigin.y + self.bounds.size.height; + + UIEdgeInsets newEdgeInsets = _scrollView.contentInset; + CGFloat inset = MAX(scrollViewLowerY - endFrame.origin.y, 0); + if (self.inverted) { + newEdgeInsets.top = MAX(inset, _contentInset.top); + } else { + newEdgeInsets.bottom = MAX(inset, _contentInset.bottom); + } + + CGPoint newContentOffset = _scrollView.contentOffset; + CGFloat contentDiff = endFrame.origin.y - beginFrame.origin.y; + if (self.inverted) { + newContentOffset.y += contentDiff; + } else { + newContentOffset.y -= contentDiff; + } + + [UIView animateWithDuration:duration + delay:0.0 + options:animationOptionsWithCurve(curve) + animations:^{ + self->_scrollView.contentInset = newEdgeInsets; + self->_scrollView.scrollIndicatorInsets = newEdgeInsets; + [self scrollToOffset:newContentOffset animated:NO]; + } + completion:nil]; +} + - (instancetype)initWithEventDispatcher:(id)eventDispatcher { RCTAssertParam(eventDispatcher); if ((self = [super initWithFrame:CGRectZero])) { + [self _registerKeyboardListener]; _eventDispatcher = eventDispatcher; _scrollView = [[RCTCustomScrollView alloc] initWithFrame:CGRectZero]; @@ -285,13 +355,10 @@ - (instancetype)initWithEventDispatcher:(id)eventDis _scrollView.delegate = self; _scrollView.delaysContentTouches = NO; - // `contentInsetAdjustmentBehavior` is only available since iOS 11. // We set the default behavior to "never" so that iOS // doesn't do weird things to UIScrollView insets automatically // and keeps it as an opt-in behavior. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; - } + _scrollView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; _automaticallyAdjustContentInsets = YES; _contentInset = UIEdgeInsetsZero; @@ -398,6 +465,7 @@ - (void)dealloc { _scrollView.delegate = nil; [_eventDispatcher.bridge.uiManager.observerCoordinator removeObserver:self]; + [self _unregisterKeyboardListener]; } - (void)layoutSubviews @@ -796,7 +864,7 @@ - (CGSize)_calculateViewportSize { CGSize viewportSize = self.bounds.size; if (_automaticallyAdjustContentInsets) { - UIEdgeInsets contentInsets = [RCTView contentInsetsForView:self]; + UIEdgeInsets contentInsets = RCTContentInsets(self); viewportSize = CGSizeMake( self.bounds.size.width - contentInsets.left - contentInsets.right, self.bounds.size.height - contentInsets.top - contentInsets.bottom); @@ -834,23 +902,33 @@ - (void)setMaintainVisibleContentPosition:(NSDictionary *)maintainVisibleContent - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager { RCTAssertUIManagerQueue(); - [manager - prependUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { - BOOL horz = [self isHorizontal:self->_scrollView]; - NSUInteger minIdx = [self->_maintainVisibleContentPosition[@"minIndexForVisible"] integerValue]; - for (NSUInteger ii = minIdx; ii < self->_contentView.subviews.count; ++ii) { - // Find the first entirely visible view. This must be done after we update the content offset - // or it will tend to grab rows that were made visible by the shift in position - UIView *subview = self->_contentView.subviews[ii]; - if ((horz ? subview.frame.origin.x >= self->_scrollView.contentOffset.x - : subview.frame.origin.y >= self->_scrollView.contentOffset.y) || - ii == self->_contentView.subviews.count - 1) { - self->_prevFirstVisibleFrame = subview.frame; - self->_firstVisibleView = subview; - break; - } - } - }]; + + [manager prependUIBlock:^( + __unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { + BOOL horz = [self isHorizontal:self->_scrollView]; + NSUInteger minIdx = [self->_maintainVisibleContentPosition[@"minIndexForVisible"] integerValue]; + for (NSUInteger ii = minIdx; ii < self->_contentView.subviews.count; ++ii) { + // Find the first entirely visible view. This must be done after we update the content offset + // or it will tend to grab rows that were made visible by the shift in position + UIView *subview = self->_contentView.subviews[ii]; + BOOL hasNewView = NO; + if (horz) { + CGFloat leftInset = self.inverted ? self->_scrollView.contentInset.right : self->_scrollView.contentInset.left; + CGFloat x = self->_scrollView.contentOffset.x + leftInset; + hasNewView = subview.frame.origin.x > x; + } else { + CGFloat bottomInset = + self.inverted ? self->_scrollView.contentInset.top : self->_scrollView.contentInset.bottom; + CGFloat y = self->_scrollView.contentOffset.y + bottomInset; + hasNewView = subview.frame.origin.y > y; + } + if (hasNewView || ii == self->_contentView.subviews.count - 1) { + self->_prevFirstVisibleFrame = subview.frame; + self->_firstVisibleView = subview; + break; + } + } + }]; [manager addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary *viewRegistry) { if (self->_maintainVisibleContentPosition == nil) { return; // The prop might have changed in the previous UIBlocks, so need to abort here. @@ -860,12 +938,14 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager if ([self isHorizontal:self->_scrollView]) { CGFloat deltaX = self->_firstVisibleView.frame.origin.x - self->_prevFirstVisibleFrame.origin.x; if (ABS(deltaX) > 0.1) { + CGFloat leftInset = self.inverted ? self->_scrollView.contentInset.right : self->_scrollView.contentInset.left; + CGFloat x = self->_scrollView.contentOffset.x + leftInset; self->_scrollView.contentOffset = CGPointMake(self->_scrollView.contentOffset.x + deltaX, self->_scrollView.contentOffset.y); if (autoscrollThreshold != nil) { // If the offset WAS within the threshold of the start, animate to the start. - if (self->_scrollView.contentOffset.x - deltaX <= [autoscrollThreshold integerValue]) { - [self scrollToOffset:CGPointMake(0, self->_scrollView.contentOffset.y) animated:YES]; + if (x - deltaX <= [autoscrollThreshold integerValue]) { + [self scrollToOffset:CGPointMake(-leftInset, self->_scrollView.contentOffset.y) animated:YES]; } } } @@ -873,12 +953,15 @@ - (void)uiManagerWillPerformMounting:(RCTUIManager *)manager CGRect newFrame = self->_firstVisibleView.frame; CGFloat deltaY = newFrame.origin.y - self->_prevFirstVisibleFrame.origin.y; if (ABS(deltaY) > 0.1) { + CGFloat bottomInset = + self.inverted ? self->_scrollView.contentInset.top : self->_scrollView.contentInset.bottom; + CGFloat y = self->_scrollView.contentOffset.y + bottomInset; self->_scrollView.contentOffset = CGPointMake(self->_scrollView.contentOffset.x, self->_scrollView.contentOffset.y + deltaY); if (autoscrollThreshold != nil) { // If the offset WAS within the threshold of the start, animate to the start. - if (self->_scrollView.contentOffset.y - deltaY <= [autoscrollThreshold integerValue]) { - [self scrollToOffset:CGPointMake(self->_scrollView.contentOffset.x, 0) animated:YES]; + if (y - deltaY <= [autoscrollThreshold integerValue]) { + [self scrollToOffset:CGPointMake(self->_scrollView.contentOffset.x, -bottomInset) animated:YES]; } } } @@ -936,12 +1019,9 @@ - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts - (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior { - // `contentInsetAdjustmentBehavior` is available since iOS 11. - if ([_scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - CGPoint contentOffset = _scrollView.contentOffset; - _scrollView.contentInsetAdjustmentBehavior = behavior; - _scrollView.contentOffset = contentOffset; - } + CGPoint contentOffset = _scrollView.contentOffset; + _scrollView.contentInsetAdjustmentBehavior = behavior; + _scrollView.contentOffset = contentOffset; } - (void)sendScrollEventWithName:(NSString *)eventName diff --git a/React/Views/ScrollView/RCTScrollViewManager.h b/React/Views/ScrollView/RCTScrollViewManager.h index 94f6e1901e5f..3709180eb41b 100644 --- a/React/Views/ScrollView/RCTScrollViewManager.h +++ b/React/Views/ScrollView/RCTScrollViewManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/ScrollView/RCTScrollViewManager.m b/React/Views/ScrollView/RCTScrollViewManager.m index bd5573f6a558..37f6416c7cc6 100644 --- a/React/Views/ScrollView/RCTScrollViewManager.m +++ b/React/Views/ScrollView/RCTScrollViewManager.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -66,6 +66,7 @@ - (UIView *)view RCT_EXPORT_VIEW_PROPERTY(centerContent, BOOL) RCT_EXPORT_VIEW_PROPERTY(maintainVisibleContentPosition, NSDictionary) RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL) +RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustKeyboardInsets, BOOL) RCT_EXPORT_VIEW_PROPERTY(decelerationRate, CGFloat) RCT_EXPORT_VIEW_PROPERTY(directionalLockEnabled, BOOL) RCT_EXPORT_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle) diff --git a/React/Views/ScrollView/RCTScrollableProtocol.h b/React/Views/ScrollView/RCTScrollableProtocol.h index ec6772e8f314..706900b25148 100644 --- a/React/Views/ScrollView/RCTScrollableProtocol.h +++ b/React/Views/ScrollView/RCTScrollableProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/UIView+Private.h b/React/Views/UIView+Private.h index a5cb4405abcc..dde159827ab6 100644 --- a/React/Views/UIView+Private.h +++ b/React/Views/UIView+Private.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/UIView+React.h b/React/Views/UIView+React.h index 67c665b2bc71..23246cfb2257 100644 --- a/React/Views/UIView+React.h +++ b/React/Views/UIView+React.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/Views/UIView+React.m b/React/Views/UIView+React.m index ffe1e02bfa45..16169c62f246 100644 --- a/React/Views/UIView+React.m +++ b/React/Views/UIView+React.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/React/third-party.xcconfig b/React/third-party.xcconfig index 683e73b1ebb4..63c2bcd93a9e 100644 --- a/React/third-party.xcconfig +++ b/React/third-party.xcconfig @@ -2,7 +2,7 @@ // folly.xcconfig // CxxReact // -// Copyright (c) Facebook, Inc. and its affiliates. +// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/Android-prebuilt.mk b/ReactAndroid/Android-prebuilt.mk index 18f8c2662045..45db144a4263 100644 --- a/ReactAndroid/Android-prebuilt.mk +++ b/ReactAndroid/Android-prebuilt.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -6,7 +6,7 @@ # This configuration provides access to most common React Native prebuilt .so files # to avoid recompiling each of the libraries outside of ReactAndroid NDK compilation. # Hosting app's/library's Android.mk can include this Android-prebuilt.mk file to -# get access to those .so to depend on. +# get access to those libraries to depend on. # NOTES: # * Currently, it assumes building React Native from source. # * Not every .so is listed here (yet). @@ -19,7 +19,7 @@ THIRD_PARTY_NDK_DIR := $(REACT_ANDROID_BUILD_DIR)/third-party-ndk REACT_ANDROID_SRC_DIR := $(REACT_ANDROID_DIR)/src/main REACT_COMMON_DIR := $(REACT_ANDROID_DIR)/../ReactCommon REACT_GENERATED_SRC_DIR := $(REACT_ANDROID_BUILD_DIR)/generated/source -# Note: this only have .so, not .a +# Note: this have only .so files REACT_NDK_EXPORT_DIR := $(PROJECT_BUILD_DIR)/react-ndk/exported # fb @@ -114,6 +114,15 @@ LOCAL_EXPORT_C_INCLUDES := \ $(REACT_COMMON_DIR)/react/renderer/debug include $(PREBUILT_SHARED_LIBRARY) +# react_debug +include $(CLEAR_VARS) +LOCAL_MODULE := react_debug +LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_debug.so +LOCAL_EXPORT_C_INCLUDES := \ + $(REACT_COMMON_DIR)/react/debug +LOCAL_SHARED_LIBRARIES := libfolly_json +include $(PREBUILT_SHARED_LIBRARY) + # react_render_graphics include $(CLEAR_VARS) LOCAL_MODULE := react_render_graphics @@ -156,6 +165,22 @@ LOCAL_EXPORT_C_INCLUDES := \ $(REACT_COMMON_DIR)/react/renderer/components/view include $(PREBUILT_SHARED_LIBRARY) +# fabricjni +include $(CLEAR_VARS) +LOCAL_MODULE := fabricjni +LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libfabricjni.so +LOCAL_EXPORT_C_INCLUDES := \ + $(REACT_ANDROID_SRC_DIR)/java/com/facebook/react/fabric/jni +include $(PREBUILT_SHARED_LIBRARY) + +# react_render_componentregistry +include $(CLEAR_VARS) +LOCAL_MODULE := react_render_componentregistry +LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_componentregistry.so +LOCAL_EXPORT_C_INCLUDES := \ + $(REACT_COMMON_DIR)/react/renderer/componentregistry +include $(PREBUILT_SHARED_LIBRARY) + # jsi include $(CLEAR_VARS) LOCAL_MODULE := jsi @@ -172,5 +197,13 @@ LOCAL_EXPORT_C_INCLUDES := \ $(REACT_GENERATED_SRC_DIR)/codegen/jni include $(PREBUILT_SHARED_LIBRARY) +# runtimeexecutor +include $(CLEAR_VARS) +LOCAL_MODULE := runtimeexecutor +LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libruntimeexecutor.so +LOCAL_C_INCLUDES := $(REACT_COMMON_DIR)/runtimeexecutor +LOCAL_EXPORT_C_INCLUDES := $(REACT_COMMON_DIR)/runtimeexecutor +include $(PREBUILT_SHARED_LIBRARY) + # fbjni include $(FIRST_PARTY_NDK_DIR)/fbjni/Android.mk diff --git a/ReactAndroid/DevExperience.md b/ReactAndroid/DevExperience.md index aa56e8c1e5b0..c0d259daae20 100644 --- a/ReactAndroid/DevExperience.md +++ b/ReactAndroid/DevExperience.md @@ -1,4 +1,4 @@ -Here's how to test the whole dev experience end-to-end. This will be eventually merged into the [Getting Started guide](https://reactnative.dev/docs/getting-started.html). +Here's how to test the whole dev experience end-to-end. This will be eventually merged into the [Getting Started guide](https://reactnative.dev/docs/getting-started). Assuming you have the [Android SDK](https://developer.android.com/sdk/installing/index.html) installed, run `android` to open the Android SDK Manager. diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 513d76c64f11..f49c6e221569 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,6 +12,8 @@ plugins { id("de.undercouch.download") } +import com.facebook.react.tasks.internal.* + import java.nio.file.Paths import de.undercouch.gradle.tasks.download.Download @@ -54,15 +56,11 @@ task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) { dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz")) } -task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) { - from(boostPath ?: tarTree(resources.gzip(downloadBoost.dest))) - from("src/main/jni/third-party/boost") - include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp", "asm/**/*.S") - includeEmptyDirs = false - into("$thirdPartyNdkDir/boost") - doLast { - file("$thirdPartyNdkDir/boost/boost").renameTo("$thirdPartyNdkDir/boost/boost_${BOOST_VERSION}") - } +final def prepareBoost = tasks.register("prepareBoost", PrepareBoostTask) { + it.dependsOn(boostPath ? [] : [downloadBoost]) + it.boostPath.setFrom(boostPath ?: tarTree(resources.gzip(downloadBoost.dest))) + it.boostVersion.set(BOOST_VERSION) + it.outputDir.set(new File(thirdPartyNdkDir, "boost")) } task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) { @@ -120,26 +118,12 @@ task downloadLibevent(dependsOn: createNativeDepsDirectories, type: Download) { dest(new File(downloadsDir, "libevent-${LIBEVENT_VERSION}.tar.gz")) } -task prepareLibevent(dependsOn: dependenciesPath ? [] : [downloadLibevent], type: Copy) { - from(dependenciesPath ?: tarTree(downloadLibevent.dest)) - from("src/main/jni/third-party/libevent/Android.mk") - from("src/main/jni/third-party/libevent/event-config.h") - from("src/main/jni/third-party/libevent/evconfig-private.h") - include( - "libevent-${LIBEVENT_VERSION}-stable/*.c", - "libevent-${LIBEVENT_VERSION}-stable/*.h", - "libevent-${LIBEVENT_VERSION}-stable/include/**/*", - "evconfig-private.h", - "event-config.h", - "Android.mk" - ) - eachFile { fname -> fname.path = (fname.path - "libevent-${LIBEVENT_VERSION}-stable/") } - includeEmptyDirs = false - into("$thirdPartyNdkDir/libevent") - doLast { - ant.move(file: "$thirdPartyNdkDir/libevent/event-config.h", tofile: "$thirdPartyNdkDir/libevent/include/event2/event-config.h") - } +final def prepareLibevent = tasks.register("prepareLibevent", PrepareLibeventTask) { + it.dependsOn(dependenciesPath ? [] : [downloadLibevent]) + it.libeventPath.setFrom(dependenciesPath ?: tarTree(downloadLibevent.dest)) + it.libeventVersion.set(LIBEVENT_VERSION) + it.outputDir.set(new File(thirdPartyNdkDir, "libevent")) } task prepareHermes(dependsOn: createNativeDepsDirectories, type: Copy) { @@ -169,73 +153,19 @@ task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) { // Prepare glog sources to be compiled, this task will perform steps that normally should've been // executed by automake. This way we can avoid dependencies on make/automake -task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) { - duplicatesStrategy("warn") - from(dependenciesPath ?: tarTree(downloadGlog.dest)) - from("src/main/jni/third-party/glog/") - include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h") - includeEmptyDirs = false - filesMatching("**/*.h.in") { - filter(ReplaceTokens, tokens: [ - ac_cv_have_unistd_h : "1", - ac_cv_have_stdint_h : "1", - ac_cv_have_systypes_h : "1", - ac_cv_have_inttypes_h : "1", - ac_cv_have_libgflags : "0", - ac_google_start_namespace : "namespace google {", - ac_cv_have_uint16_t : "1", - ac_cv_have_u_int16_t : "1", - ac_cv_have___uint16 : "0", - ac_google_end_namespace : "}", - ac_cv_have___builtin_expect : "1", - ac_google_namespace : "google", - ac_cv___attribute___noinline : "__attribute__ ((noinline))", - ac_cv___attribute___noreturn : "__attribute__ ((noreturn))", - ac_cv___attribute___printf_4_5: "__attribute__((__format__ (__printf__, 4, 5)))" - ]) - it.path = (it.name - ".in") - } - into("$thirdPartyNdkDir/glog") - - doLast { - copy { - from(fileTree(dir: "$thirdPartyNdkDir/glog", includes: ["stl_logging.h", "logging.h", "raw_logging.h", "vlog_is_on.h", "**/src/glog/log_severity.h"]).files) - includeEmptyDirs = false - into("$thirdPartyNdkDir/glog/exported/glog") - } - } +final def prepareGlog = tasks.register("prepareGlog", PrepareGlogTask) { + it.dependsOn(dependenciesPath ? [] : [downloadGlog]) + it.glogPath.setFrom(dependenciesPath ?: tarTree(downloadGlog.dest)) + it.glogVersion.set(GLOG_VERSION) + it.outputDir.set(new File(thirdPartyNdkDir, "glog")) } // Create Android.mk library module based on jsc from npm -task prepareJSC { - doLast { - def jscPackagePath = findNodeModulePath(projectDir, "jsc-android") - if (!jscPackagePath) { - throw new GradleScriptException("Could not find the jsc-android npm package", null) - } - - def jscDist = file("$jscPackagePath/dist") - if (!jscDist.exists()) { - throw new GradleScriptException("The jsc-android npm package is missing its \"dist\" directory", null) - } - - def jscAAR = fileTree(jscDist).matching({ it.include "**/android-jsc/**/*.aar" }).singleFile - def soFiles = zipTree(jscAAR).matching({ it.include "**/*.so" }) - - def headerFiles = fileTree(jscDist).matching({ it.include "**/include/*.h" }) - - copy { - from(soFiles) - from(headerFiles) - from("src/main/jni/third-party/jsc/Android.mk") - - filesMatching("**/*.h", { it.path = "JavaScriptCore/${it.name}" }) - - includeEmptyDirs(false) - into("$thirdPartyNdkDir/jsc") - } - } +tasks.register('prepareJSC', PrepareJSCTask) { + it.jscPackagePath.set(findNodeModulePath(projectDir, "jsc-android")) + it.outputDir = project.layout.buildDirectory.dir("third-party-ndk/jsc") } + task downloadNdkBuildDependencies { if (!boostPath) { dependsOn(downloadBoost) @@ -282,39 +212,6 @@ def findNodeModulePath(baseDir, packageName) { return null } -def getNdkBuildName() { - if (Os.isFamily(Os.FAMILY_WINDOWS)) { - return "ndk-build.cmd" - } else { - return "ndk-build" - } -} - -def findNdkBuildFullPath() { - // android.ndkDirectory should return project.android.ndkVersion ndkDirectory - def ndkDir = android.ndkDirectory ? android.ndkDirectory.absolutePath : null - if (ndkDir) { - return new File(ndkDir, getNdkBuildName()).getAbsolutePath() - } - - // we allow to provide full path to ndk-build tool - if (hasProperty("ndk.command")) { - return property("ndk.command") - } - // or just a path to the containing directory - if (hasProperty("ndk.path")) { - ndkDir = property("ndk.path") - return new File(ndkDir, getNdkBuildName()).getAbsolutePath() - } - - // @TODO ANDROID_NDK && ndk.dir is deprecated and will be removed in the future. - if (System.getenv("ANDROID_NDK") != null) { - ndkDir = System.getenv("ANDROID_NDK") - return new File(ndkDir, getNdkBuildName()).getAbsolutePath() - } - - return null -} def reactNativeDevServerPort() { def value = project.getProperties().get("reactNativeDevServerPort") @@ -327,134 +224,75 @@ def reactNativeInspectorProxyPort() { } def reactNativeArchitectures() { - def isDebug = gradle.startParameter.taskRequests.any { - it.args.any { it.endsWith("Debug") } - } - def value = project.getProperties().get("reactNativeDebugArchitectures") - return value != null && isDebug ? value : "all" -} - -def getNdkBuildFullPath() { - def ndkBuildFullPath = findNdkBuildFullPath() - if (ndkBuildFullPath == null) { - throw new GradleScriptException( - "ndk-build binary cannot be found, check if you've set " + - "\$ANDROID_NDK environment variable correctly or if ndk.dir is " + - "setup in local.properties", - null) - } - if (!new File(ndkBuildFullPath).canExecute()) { - throw new GradleScriptException( - "ndk-build binary " + ndkBuildFullPath + " doesn't exist or isn't executable.\n" + - "Check that the \$ANDROID_NDK environment variable, or ndk.dir in local.properties, is set correctly.\n" + - "(On Windows, make sure you escape backslashes in local.properties or use forward slashes, e.g. C:\\\\ndk or C:/ndk rather than C:\\ndk)", - null) - } - return ndkBuildFullPath -} - -def buildReactNdkLib = tasks.register("buildReactNdkLib", Exec) { - dependsOn(prepareJSC, prepareHermes, prepareBoost, prepareDoubleConversion, prepareFmt, prepareFolly, prepareGlog, prepareLibevent, extractAARHeaders, extractJNIFiles) - dependsOn("generateCodegenArtifactsFromSchema"); - - inputs.dir("$projectDir/../ReactCommon") - inputs.dir("src/main/jni") - inputs.dir("src/main/java/com/facebook/react/turbomodule/core/jni") - inputs.dir("src/main/java/com/facebook/react/modules/blob") - outputs.dir("$buildDir/react-ndk/all") - def commandLineArgs = [ - getNdkBuildFullPath(), - "APP_ABI=${reactNativeArchitectures()}", - "NDK_DEBUG=" + (nativeBuildType.equalsIgnoreCase("debug") ? "1" : "0"), - "NDK_PROJECT_PATH=null", - "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", - "NDK_OUT=" + temporaryDir, - "NDK_LIBS_OUT=$buildDir/react-ndk/all", - "THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir", - "REACT_COMMON_DIR=$projectDir/../ReactCommon", - "REACT_GENERATED_SRC_DIR=$buildDir/generated/source", - "REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react", - "-C", file("src/main/jni/react/jni").absolutePath, - "--jobs", project.findProperty("jobs") ?: Runtime.runtime.availableProcessors() - ] - if (Os.isFamily(Os.FAMILY_MAC)) { - // This flag will suppress "fcntl(): Bad file descriptor" warnings on local builds. - commandLineArgs.add("--output-sync=none") - } - commandLine(commandLineArgs) -} - -def cleanReactNdkLib = tasks.register("cleanReactNdkLib", Exec) { - ignoreExitValue(true) - errorOutput(new ByteArrayOutputStream()) - commandLine(getNdkBuildFullPath(), - "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", - "THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir", - "REACT_COMMON_DIR=$projectDir/../ReactCommon", - "-C", file("src/main/jni/react/jni").absolutePath, - "clean") - doLast { - file(AAR_OUTPUT_URL).delete() - println("Deleted aar output dir at ${file(AAR_OUTPUT_URL)}") - } + def value = project.getProperties().get("reactNativeArchitectures") + return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] } -def packageReactNdkLibs = tasks.register("packageReactNdkLibs", Copy) { - dependsOn(buildReactNdkLib) - from("$buildDir/react-ndk/all") - into("$buildDir/react-ndk/exported") - exclude("**/libjsc.so") - exclude("**/libhermes.so") +def ndkBuildJobs() { + return project.findProperty("jobs") ?: Runtime.runtime.availableProcessors() } -def packageReactNdkLibsForBuck = tasks.register("packageReactNdkLibsForBuck", Copy) { - dependsOn(packageReactNdkLibs) - from("$buildDir/react-ndk/exported") +tasks.register("packageReactNdkLibsForBuck") { + dependsOn("packageReactNdkDebugLibsForBuck") +} + +tasks.register("packageReactNdkDebugLibsForBuck", Copy) { + dependsOn("mergeDebugNativeLibs") + // Shared libraries (.so) are copied from the merged_native_libs folder instead + from("$buildDir/intermediates/merged_native_libs/debug/out/lib/") + exclude("**/libjsc.so") + exclude("**/libhermes.so") into("src/main/jni/prebuilt/lib") } -task extractAARHeaders { - doLast { - configurations.extractHeaders.files.each { - def file = it.absoluteFile - def packageName = file.name.tokenize('-')[0] - copy { - from zipTree(file) - into "$projectDir/src/main/jni/first-party/$packageName/headers" - include "**/*.h" - } - } - } +tasks.register("packageReactNdkReleaseLibsForBuck", Copy) { + dependsOn("mergeReleaseNativeLibs") + // Shared libraries (.so) are copied from the merged_native_libs folder instead + from("$buildDir/intermediates/merged_native_libs/release/out/lib/") + exclude("**/libjsc.so") + exclude("**/libhermes.so") + into("src/main/jni/prebuilt/lib") } -task extractJNIFiles { - doLast { - configurations.extractJNI.files.each { - def file = it.absoluteFile - def packageName = file.name.tokenize('-')[0] - copy { - from zipTree(file) - into "$projectDir/src/main/jni/first-party/$packageName/" - include "jni/**/*" - } - } - } +final def extractNativeDependencies = tasks.register('extractNativeDependencies', ExtractJniAndHeadersTask) { + it.extractHeadersConfiguration.setFrom(configurations.extractHeaders) + it.extractJniConfiguration.setFrom(configurations.extractJNI) + it.baseOutputDir = project.file("src/main/jni/first-party/") + // Sadly this task as an output folder path that is directly dependent on + // the task input (i.e. src/main/jni/first-party//... + // This means that this task is using the parent folder (first-party/) as + // @OutputFolder. The `prepareHermes` task will also output inside that + // folder and if the two tasks happen to be inside the same run, we want + // `extractNativeDependencies` to run after `prepareHermes` to do not + // invalidate the input/output calculation for this task. + it.mustRunAfter(prepareHermes) } task installArchives { dependsOn("publishReleasePublicationToNpmRepository") } +// Creating sources with comments +task androidSourcesJar(type: Jar) { + classifier = 'sources' + from android.sourceSets.main.java.srcDirs +} + android { - compileSdkVersion 30 - ndkVersion ANDROID_NDK_VERSION - if (ANDROID_NDK_PATH != null) { - ndkPath ANDROID_NDK_PATH + compileSdkVersion 31 + + // Used to override the NDK path/version on internal CI or by allowing + // users to customize the NDK path/version from their root project (e.g. for M1 support) + if (rootProject.hasProperty("ndkPath")) { + ndkPath rootProject.ext.ndkPath + } + if (rootProject.hasProperty("ndkVersion")) { + ndkVersion rootProject.ext.ndkVersion } defaultConfig { minSdkVersion(21) - targetSdkVersion(28) + targetSdkVersion(31) versionCode(1) versionName("1.0") @@ -469,11 +307,43 @@ android { testApplicationId("com.facebook.react.tests.gradle") testInstrumentationRunner("androidx.test.runner.AndroidJUnitRunner") + + externalNativeBuild { + ndkBuild { + arguments "NDK_APPLICATION_MK=$projectDir/src/main/jni/Application.mk", + "THIRD_PARTY_NDK_DIR=$thirdPartyNdkDir", + "REACT_COMMON_DIR=$projectDir/../ReactCommon", + "REACT_GENERATED_SRC_DIR=$buildDir/generated/source", + "REACT_SRC_DIR=$projectDir/src/main/java/com/facebook/react", + "-j${ndkBuildJobs()}" + + if (Os.isFamily(Os.FAMILY_MAC)) { + // This flag will suppress "fcntl(): Bad file descriptor" warnings on local builds. + arguments "--output-sync=none" + } + + // Fix for windows limit on number of character in file paths and in command lines + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + arguments "NDK_APP_SHORT_COMMANDS=true" + } + } + } + ndk { + abiFilters (*reactNativeArchitectures()) + } } + externalNativeBuild { + ndkBuild { + path "src/main/jni/react/jni/Android.mk" + } + } + + preBuild.dependsOn(prepareJSC, prepareHermes, prepareBoost, prepareDoubleConversion, prepareFmt, prepareFolly, prepareGlog, prepareLibevent, extractNativeDependencies) + preBuild.dependsOn("generateCodegenArtifactsFromSchema") + sourceSets.main { jni.srcDirs = [] - jniLibs.srcDir("$buildDir/react-ndk/exported") res.srcDirs = ["src/main/res/devsupport", "src/main/res/shell", "src/main/res/views/modal", "src/main/res/views/uimanager"] java { srcDirs = ["src/main/java", "src/main/libraries/soloader/java", "src/main/jni/first-party/fb/jni/java"] @@ -482,9 +352,6 @@ android { } } - preBuild.dependsOn(packageReactNdkLibs) - clean.dependsOn(cleanReactNdkLib) - lintOptions { abortOnError(false) } @@ -492,6 +359,12 @@ android { packagingOptions { exclude("META-INF/NOTICE") exclude("META-INF/LICENSE") + // We intentionally don't want to bundle any JS Runtime inside the Android AAR + // we produce. The reason behind this is that we want to allow users to pick the + // JS engine by specifying a dependency on either `hermes-engine` or `android-jsc` + // that will include the necessary .so files to load. + exclude("**/libhermes.so") + exclude("**/libjsc.so") } configurations { @@ -527,7 +400,7 @@ dependencies { testImplementation("org.powermock:powermock-module-junit4-rule:${POWERMOCK_VERSION}") testImplementation("org.powermock:powermock-classloading-xstream:${POWERMOCK_VERSION}") testImplementation("org.mockito:mockito-core:${MOCKITO_CORE_VERSION}") - testImplementation("org.easytesting:fest-assert-core:2.0M10") + testImplementation("org.assertj:assertj-core:3.21.0") testImplementation("org.robolectric:robolectric:${ROBOLECTRIC_VERSION}") androidTestImplementation(fileTree(dir: "src/main/third-party/java/buck-android-support/", include: ["*.jar"])) @@ -541,17 +414,29 @@ react { // This should be changed to a more generic name, e.g. `ReactCoreSpec`. libraryName = "rncore" jsRootDir = file("../Libraries") - reactRoot = file("$projectDir/..") - useJavaGenerator = System.getenv("USE_CODEGEN_JAVAPOET") ?: false + reactNativeDir = file("$projectDir/..") + useJavaGenerator = System.getenv("USE_CODEGEN_JAVAPOET")?.toBoolean() ?: false + // We search for the codegen in either one of the `node_modules` folder or in the + // root packages folder (that's for when we build from source without calling `yarn install`). + codegenDir = file(findNodeModulePath(projectDir, "react-native-codegen") ?: "../packages/react-native-codegen/") } afterEvaluate { + + // Needed as some of the native sources needs to be downloaded + // before configureNdkBuildDebug could be executed. + configureNdkBuildDebug.dependsOn(preBuild) + configureNdkBuildRelease.dependsOn(preBuild) + publishing { publications { release(MavenPublication) { // Applies the component for the release build variant. from components.release + // Add additional sourcesJar to artifacts + artifact(androidSourcesJar) + // You can then customize attributes of the publication as shown below. artifactId = POM_ARTIFACT_ID groupId = GROUP diff --git a/ReactAndroid/gradle.properties b/ReactAndroid/gradle.properties index b563dcad32b4..7f30bdf328de 100644 --- a/ReactAndroid/gradle.properties +++ b/ReactAndroid/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=1000.0.0-main +VERSION_NAME=0.68.3 GROUP=com.facebook.react POM_NAME=ReactNative @@ -12,8 +12,8 @@ JUNIT_VERSION=4.12 ANDROIDX_TEST_VERSION=1.1.0 FRESCO_VERSION=2.5.0 -OKHTTP_VERSION=4.9.1 -SO_LOADER_VERSION=0.10.1 +OKHTTP_VERSION=4.9.2 +SO_LOADER_VERSION=0.10.3 BOOST_VERSION=1_63_0 DOUBLE_CONVERSION_VERSION=1.1.6 diff --git a/ReactAndroid/proguard-rules.pro b/ReactAndroid/proguard-rules.pro index 93a74c617b83..2161cd7e7d66 100644 --- a/ReactAndroid/proguard-rules.pro +++ b/ReactAndroid/proguard-rules.pro @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -24,17 +24,15 @@ # See http://sourceforge.net/p/proguard/bugs/466/ -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters --keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip --keep,allowobfuscation @interface com.facebook.jni.annotations.DoNotStrip # Do not strip any method/class that is annotated with @DoNotStrip -keep @com.facebook.proguard.annotations.DoNotStrip class * --keep @com.facebook.common.internal.DoNotStrip class * --keep @com.facebook.jni.annotations.DoNotStrip class * -keepclassmembers class * { @com.facebook.proguard.annotations.DoNotStrip *; - @com.facebook.common.internal.DoNotStrip *; - @com.facebook.jni.annotations.DoNotStrip *; +} + +-keep @com.facebook.proguard.annotations.DoNotStripAny class * { + *; } -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { diff --git a/ReactAndroid/src/androidTest/AndroidManifest.xml b/ReactAndroid/src/androidTest/AndroidManifest.xml index 0ebc7b4768ec..31552b1abc0b 100644 --- a/ReactAndroid/src/androidTest/AndroidManifest.xml +++ b/ReactAndroid/src/androidTest/AndroidManifest.xml @@ -14,6 +14,7 @@ diff --git a/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml b/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml index 49b4a1fc433c..5e31d4403b2d 100644 --- a/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml +++ b/ReactAndroid/src/androidTest/buck-runner/AndroidManifest.xml @@ -15,7 +15,8 @@ + android:theme="@style/Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen" + android:exported="false"> diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/bridge/ArgumentsTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/bridge/ArgumentsTest.java index 7e26d3506fe3..a9df0445f67d 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/bridge/ArgumentsTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/bridge/ArgumentsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AbstractScrollViewTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AbstractScrollViewTestCase.java index 58e6d51e5863..618106f6f990 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AbstractScrollViewTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AbstractScrollViewTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AssertModule.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AssertModule.java index 586a98f19337..90e8a630f4d8 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AssertModule.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/AssertModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java index 5d7e7b4fddc6..c2b250428c04 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FabricUIManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeAsyncLocalStorage.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeAsyncLocalStorage.java index 57fda60fa8d0..d544be393a9a 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeAsyncLocalStorage.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeAsyncLocalStorage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeWebSocketModule.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeWebSocketModule.java index f21a22bd6feb..f2d544dc7058 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeWebSocketModule.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/FakeWebSocketModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/InstanceSpecForTestPackage.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/InstanceSpecForTestPackage.java index fc7a9d141452..d70069190b95 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/InstanceSpecForTestPackage.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/InstanceSpecForTestPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IntRecordingModule.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IntRecordingModule.java index 25bf339dc83e..3824383d8def 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IntRecordingModule.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/IntRecordingModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/JSIntegrationTestChecker.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/JSIntegrationTestChecker.java index c38b9cff8343..7f938986cf72 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/JSIntegrationTestChecker.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/JSIntegrationTestChecker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/MultipleFailureException.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/MultipleFailureException.java index 3b8aa6d3282d..4147077d8d6f 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/MultipleFailureException.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/MultipleFailureException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java index 036a2d5abcfe..fa6ee446671d 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppInstrumentationTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java index 017094b8b61f..308f2ae8d05b 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactAppTestActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstanceSpecForTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstanceSpecForTest.java index 915dc60b3954..7279fa498717 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstanceSpecForTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstanceSpecForTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstrumentationTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstrumentationTest.java index a34bfcdad15d..95e1c1dd58d1 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstrumentationTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactInstrumentationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java index 2eb14b735d86..e923c7a112b9 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactIntegrationTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java index de7f8cc1b76b..9376aa3493bc 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactSettingsForTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestAppShell.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestAppShell.java index d4d5497960f1..1290ea9e647b 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestAppShell.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestAppShell.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestApplicationImpl.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestApplicationImpl.java index 251878c6f62a..73867d3d7a39 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestApplicationImpl.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestApplicationImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestFactory.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestFactory.java index 142a2264d733..926d0383596e 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestFactory.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java index fa723d1418e7..bded7c858b45 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ReactTestHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ScreenshotingFrameLayout.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ScreenshotingFrameLayout.java index 1038e69927c9..98b922fbb3d8 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ScreenshotingFrameLayout.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/ScreenshotingFrameLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java index 032b6ad4d5b4..bc8564dbe979 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/SingleTouchGestureGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/StringRecordingModule.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/StringRecordingModule.java index 317454f218f6..05fb2137b391 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/StringRecordingModule.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/StringRecordingModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java index 67aad1a2d767..89cbf73d986b 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/IdleWaiter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java index 95e5d6085c95..a988351820b4 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactBridgeIdleSignaler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java index 4cdbf83a058d..a2e20984ec0f 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/idledetection/ReactIdleDetectionUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java index 3f5ca53c5b60..1a6db544aaf2 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/network/NetworkRecordingModuleMock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/rule/ReactNativeTestRule.java b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/rule/ReactNativeTestRule.java index 8d6252f28b8c..e8f6ff3971a2 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/testing/rule/ReactNativeTestRule.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/testing/rule/ReactNativeTestRule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ import android.app.Activity; import android.view.ViewTreeObserver.OnGlobalLayoutListener; import androidx.test.rule.ActivityTestRule; +import com.facebook.react.ReactInstanceEventListener; import com.facebook.react.ReactInstanceManager; import com.facebook.react.ReactPackage; import com.facebook.react.ReactRootView; @@ -90,7 +91,7 @@ public void run() { // This threading garbage will be replaced by Surface final AtomicBoolean isLayoutUpdated = new AtomicBoolean(false); mReactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { + new ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { final UIManagerModule uiManagerModule = diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/AnimatedTransformTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/AnimatedTransformTest.java index 12adeb3a19d3..cf2631779a6d 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/AnimatedTransformTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/AnimatedTransformTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMeasureLayoutTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMeasureLayoutTest.java index c42f4e5fb144..c7b45417f6c2 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMeasureLayoutTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMeasureLayoutTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java index 70b855b96b89..a36eb9a8b358 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystMultitouchHandlingTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJSToJavaParametersTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJSToJavaParametersTestCase.java index 5eb70b26739b..287884f7a071 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJSToJavaParametersTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJSToJavaParametersTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSArgumentsTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSArgumentsTestCase.java index 1090adb4e78a..0776e61361a4 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSArgumentsTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSArgumentsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSReturnValuesTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSReturnValuesTestCase.java index 1698fa3db07f..65bc4f27e465 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSReturnValuesTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystNativeJavaToJSReturnValuesTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystSubviewsClippingTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystSubviewsClippingTestCase.java index 058857679c9a..7d4b4b194070 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystSubviewsClippingTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystSubviewsClippingTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java index 92430db83a0a..98557aec5d11 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystTouchBubblingTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystUIManagerTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystUIManagerTestCase.java index 8a39cf6d3192..4d40bba1c608 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystUIManagerTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/CatalystUIManagerTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageErrorTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageErrorTestCase.java index f0737f79761f..e77487ee489f 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageErrorTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageErrorTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageOverlayColorTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageOverlayColorTestCase.java index 87265bc16051..30419772a4d9 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageOverlayColorTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ImageOverlayColorTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/InitialPropsTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/InitialPropsTestCase.java index dbb538457820..60548adf6239 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/InitialPropsTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/InitialPropsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSLocaleTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSLocaleTest.java index ca5933a14015..a270ff0d07d8 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSLocaleTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSLocaleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSResponderTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSResponderTestCase.java index 6268ac0a3678..ec947422fd34 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSResponderTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/JSResponderTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/LayoutEventsTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/LayoutEventsTestCase.java index 163b2147f887..b98a2789df2d 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/LayoutEventsTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/LayoutEventsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/NativeIdTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/NativeIdTestCase.java index 4f40a3568d8a..e09a4f1c2497 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/NativeIdTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/NativeIdTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ProgressBarTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ProgressBarTestCase.java index 2fb58ae1fb7a..f4c2210388c5 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ProgressBarTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ProgressBarTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactHorizontalScrollViewTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactHorizontalScrollViewTestCase.java index 6a7660dd8144..0a8f7a11a3d3 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactHorizontalScrollViewTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactHorizontalScrollViewTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactScrollViewTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactScrollViewTestCase.java index da5f7932d255..384ce67d5e37 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactScrollViewTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactScrollViewTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactSwipeRefreshLayoutTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactSwipeRefreshLayoutTestCase.java index b559bbe7fc92..7a2ebae7680d 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactSwipeRefreshLayoutTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ReactSwipeRefreshLayoutTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ShareTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ShareTestCase.java index 29a0247d5925..411ab0003473 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ShareTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ShareTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TestIdTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TestIdTestCase.java index 5804b5a502ba..04d8ec6348c7 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TestIdTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TestIdTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TextInputTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TextInputTestCase.java index 88e0cf51e09d..b4b3aaa7b4b5 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TextInputTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/TextInputTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ViewRenderingTestCase.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ViewRenderingTestCase.java index 9e9ce862e689..3a0db7743e8c 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ViewRenderingTestCase.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/ViewRenderingTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/BUCK b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/BUCK index 8ce6ba218f7c..1d681e40335f 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/BUCK +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/BUCK @@ -14,7 +14,7 @@ rn_android_library( is_androidx = True, deps = [ react_native_dep("third-party/android/androidx:test-espresso-core"), - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/android/androidx:test-rules"), react_native_dep("third-party/android/androidx:test-runner"), diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactInstanceManagerTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactInstanceManagerTest.java index 4bbb0fdee8e8..62c9811f0c91 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactInstanceManagerTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactInstanceManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactRootViewTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactRootViewTest.java index afc124894dd8..bf23d9e66cb9 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactRootViewTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/ReactRootViewTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.tests.core; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import android.app.Instrumentation; import android.view.View; diff --git a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/WritableNativeMapTest.java b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/WritableNativeMapTest.java index a858bee25582..c6997e6e0b31 100644 --- a/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/WritableNativeMapTest.java +++ b/ReactAndroid/src/androidTest/java/com/facebook/react/tests/core/WritableNativeMapTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.tests.core; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import androidx.test.runner.AndroidJUnit4; import com.facebook.react.bridge.NoSuchKeyException; diff --git a/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js b/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js index 425bc53c6c22..36288a8fb768 100644 --- a/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js +++ b/ReactAndroid/src/androidTest/js/AnimatedTransformTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/Asserts.js b/ReactAndroid/src/androidTest/js/Asserts.js index 2c9710fbd937..06605c0c5602 100644 --- a/ReactAndroid/src/androidTest/js/Asserts.js +++ b/ReactAndroid/src/androidTest/js/Asserts.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,7 +14,7 @@ const {NativeModules} = require('react-native'); const {Assert} = NativeModules; const Asserts = { - assertEquals: function(expected, actual, msg) { + assertEquals: function (expected, actual, msg) { if (expected !== actual) { Assert.fail( msg || @@ -30,7 +30,7 @@ const Asserts = { Assert.success(); } }, - assertTrue: function(expr, msg) { + assertTrue: function (expr, msg) { Asserts.assertEquals(true, expr, msg); }, }; diff --git a/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js b/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js index dd02631da37e..9e818ceb695a 100644 --- a/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js +++ b/ReactAndroid/src/androidTest/js/CatalystRootViewTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -41,7 +41,7 @@ class CatalystRootViewTestApp extends React.Component { } const ReactRootViewTestModule = { - setHeight: function(height) { + setHeight: function (height) { that.setState({height: height}); }, }; diff --git a/ReactAndroid/src/androidTest/js/ImageErrorTestApp.js b/ReactAndroid/src/androidTest/js/ImageErrorTestApp.js index aa651176477a..04a461f3afd7 100644 --- a/ReactAndroid/src/androidTest/js/ImageErrorTestApp.js +++ b/ReactAndroid/src/androidTest/js/ImageErrorTestApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/ImageOverlayColorTestApp.js b/ReactAndroid/src/androidTest/js/ImageOverlayColorTestApp.js index 796f6a5b4f20..e942bc315a1d 100644 --- a/ReactAndroid/src/androidTest/js/ImageOverlayColorTestApp.js +++ b/ReactAndroid/src/androidTest/js/ImageOverlayColorTestApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/InitialPropsTestApp.js b/ReactAndroid/src/androidTest/js/InitialPropsTestApp.js index 11f4c39f9737..3fe6ca666707 100644 --- a/ReactAndroid/src/androidTest/js/InitialPropsTestApp.js +++ b/ReactAndroid/src/androidTest/js/InitialPropsTestApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/JSResponderTestApp.js b/ReactAndroid/src/androidTest/js/JSResponderTestApp.js index 24191481050f..4967106a75bb 100644 --- a/ReactAndroid/src/androidTest/js/JSResponderTestApp.js +++ b/ReactAndroid/src/androidTest/js/JSResponderTestApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js b/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js index 18dd7c39f0cf..59cda24bdd22 100644 --- a/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js +++ b/ReactAndroid/src/androidTest/js/LayoutEventsTestApp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js b/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js index dfca8095e2ae..68289a53bee4 100644 --- a/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js +++ b/ReactAndroid/src/androidTest/js/MeasureLayoutTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,11 +9,11 @@ 'use strict'; -const React = require('react'); -const {StyleSheet, UIManager, View, findNodeHandle} = require('react-native'); -const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridge'); - -const assertEquals = require('./Asserts').assertEquals; +import * as React from 'react'; +import {useEffect, useRef} from 'react'; +import {StyleSheet, UIManager, View, findNodeHandle} from 'react-native'; +import BatchedBridge from 'react-native/Libraries/BatchedBridge/BatchedBridge'; +import {assertEquals} from './Asserts'; const styles = StyleSheet.create({ A: { @@ -45,24 +45,27 @@ const styles = StyleSheet.create({ let A, B, C, D; -class MeasureLayoutTestApp extends React.Component { - componentDidMount() { - A = findNodeHandle(this.refs.A); - B = findNodeHandle(this.refs.B); - C = findNodeHandle(this.refs.C); - D = findNodeHandle(this.refs.D); - } +function MeasureLayoutTestApp() { + const refA = useRef(null); + const refB = useRef(null); + const refC = useRef(null); + const refD = useRef(null); + + useEffect(() => { + A = findNodeHandle(refA.current); + B = findNodeHandle(refB.current); + C = findNodeHandle(refC.current); + D = findNodeHandle(refD.current); + }); - render() { - return ( - - - - - + return ( + + + - ); - } + + + ); } function shouldNotCallThisCallback() { @@ -70,67 +73,67 @@ function shouldNotCallThisCallback() { } const MeasureLayoutTestModule = { - MeasureLayoutTestApp: MeasureLayoutTestApp, - verifyMeasureOnViewA: function() { - UIManager.measure(A, function(a, b, width, height, x, y) { + MeasureLayoutTestApp, + verifyMeasureOnViewA: function () { + UIManager.measure(A, function (a, b, width, height, x, y) { assertEquals(500, width); assertEquals(500, height); assertEquals(0, x); assertEquals(0, y); }); }, - verifyMeasureOnViewC: function() { - UIManager.measure(C, function(a, b, width, height, x, y) { + verifyMeasureOnViewC: function () { + UIManager.measure(C, function (a, b, width, height, x, y) { assertEquals(50, width); assertEquals(150, height); assertEquals(150, x); assertEquals(150, y); }); }, - verifyMeasureLayoutCRelativeToA: function() { - UIManager.measureLayout(C, A, shouldNotCallThisCallback, function( - x, - y, - width, - height, - ) { - assertEquals(50, width); - assertEquals(150, height); - assertEquals(150, x); - assertEquals(150, y); - }); + verifyMeasureLayoutCRelativeToA: function () { + UIManager.measureLayout( + C, + A, + shouldNotCallThisCallback, + function (x, y, width, height) { + assertEquals(50, width); + assertEquals(150, height); + assertEquals(150, x); + assertEquals(150, y); + }, + ); }, - verifyMeasureLayoutCRelativeToB: function() { - UIManager.measureLayout(C, B, shouldNotCallThisCallback, function( - x, - y, - width, - height, - ) { - assertEquals(50, width); - assertEquals(150, height); - assertEquals(100, x); - assertEquals(70, y); - }); + verifyMeasureLayoutCRelativeToB: function () { + UIManager.measureLayout( + C, + B, + shouldNotCallThisCallback, + function (x, y, width, height) { + assertEquals(50, width); + assertEquals(150, height); + assertEquals(100, x); + assertEquals(70, y); + }, + ); }, - verifyMeasureLayoutCRelativeToSelf: function() { - UIManager.measureLayout(C, C, shouldNotCallThisCallback, function( - x, - y, - width, - height, - ) { - assertEquals(50, width); - assertEquals(150, height); - assertEquals(0, x); - assertEquals(0, y); - }); + verifyMeasureLayoutCRelativeToSelf: function () { + UIManager.measureLayout( + C, + C, + shouldNotCallThisCallback, + function (x, y, width, height) { + assertEquals(50, width); + assertEquals(150, height); + assertEquals(0, x); + assertEquals(0, y); + }, + ); }, - verifyMeasureLayoutRelativeToParentOnViewA: function() { + verifyMeasureLayoutRelativeToParentOnViewA: function () { UIManager.measureLayoutRelativeToParent( A, shouldNotCallThisCallback, - function(x, y, width, height) { + function (x, y, width, height) { assertEquals(500, width); assertEquals(500, height); assertEquals(0, x); @@ -138,11 +141,11 @@ const MeasureLayoutTestModule = { }, ); }, - verifyMeasureLayoutRelativeToParentOnViewB: function() { + verifyMeasureLayoutRelativeToParentOnViewB: function () { UIManager.measureLayoutRelativeToParent( B, shouldNotCallThisCallback, - function(x, y, width, height) { + function (x, y, width, height) { assertEquals(200, width); assertEquals(300, height); assertEquals(50, x); @@ -150,11 +153,11 @@ const MeasureLayoutTestModule = { }, ); }, - verifyMeasureLayoutRelativeToParentOnViewC: function() { + verifyMeasureLayoutRelativeToParentOnViewC: function () { UIManager.measureLayoutRelativeToParent( C, shouldNotCallThisCallback, - function(x, y, width, height) { + function (x, y, width, height) { assertEquals(50, width); assertEquals(150, height); assertEquals(100, x); @@ -162,40 +165,40 @@ const MeasureLayoutTestModule = { }, ); }, - verifyMeasureLayoutDRelativeToB: function() { + verifyMeasureLayoutDRelativeToB: function () { UIManager.measureLayout( D, B, - function() { + function () { assertEquals(true, true); }, shouldNotCallThisCallback, ); }, - verifyMeasureLayoutNonExistentTag: function() { + verifyMeasureLayoutNonExistentTag: function () { UIManager.measureLayout( 192, A, - function() { + function () { assertEquals(true, true); }, shouldNotCallThisCallback, ); }, - verifyMeasureLayoutNonExistentAncestor: function() { + verifyMeasureLayoutNonExistentAncestor: function () { UIManager.measureLayout( B, 192, - function() { + function () { assertEquals(true, true); }, shouldNotCallThisCallback, ); }, - verifyMeasureLayoutRelativeToParentNonExistentTag: function() { + verifyMeasureLayoutRelativeToParentNonExistentTag: function () { UIManager.measureLayoutRelativeToParent( 192, - function() { + function () { assertEquals(true, true); }, shouldNotCallThisCallback, diff --git a/ReactAndroid/src/androidTest/js/MultitouchHandlingTestAppModule.js b/ReactAndroid/src/androidTest/js/MultitouchHandlingTestAppModule.js index a90a58b42d20..73f023fd58c7 100644 --- a/ReactAndroid/src/androidTest/js/MultitouchHandlingTestAppModule.js +++ b/ReactAndroid/src/androidTest/js/MultitouchHandlingTestAppModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/NativeIdTestModule.js b/ReactAndroid/src/androidTest/js/NativeIdTestModule.js index e03ff5ea3388..583d7c71b169 100644 --- a/ReactAndroid/src/androidTest/js/NativeIdTestModule.js +++ b/ReactAndroid/src/androidTest/js/NativeIdTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js b/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js index 655c747ee7c3..21df4f6ec241 100644 --- a/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js +++ b/ReactAndroid/src/androidTest/js/ProgressBarTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -40,7 +40,7 @@ class ProgressBarSampleApp extends React.Component { } const ProgressBarTestModule = { - renderProgressBarApplication: function(rootTag) { + renderProgressBarApplication: function (rootTag) { renderApplication(ProgressBarSampleApp, {}, rootTag); }, }; diff --git a/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js b/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js index 11ee033dc849..c0c1969a7379 100644 --- a/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js +++ b/ReactAndroid/src/androidTest/js/ScrollViewTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -51,7 +51,7 @@ class Item extends React.Component { } } -const getInitialState = function() { +const getInitialState = function () { const data = []; for (let i = 0; i < NUM_ITEMS; i++) { data[i] = {text: 'Item ' + i + '!'}; @@ -61,28 +61,28 @@ const getInitialState = function() { }; }; -const onScroll = function(e) { +const onScroll = function (e) { ScrollListener.onScroll( e.nativeEvent.contentOffset.x, e.nativeEvent.contentOffset.y, ); }; -const onScrollBeginDrag = function(e) { +const onScrollBeginDrag = function (e) { ScrollListener.onScrollBeginDrag( e.nativeEvent.contentOffset.x, e.nativeEvent.contentOffset.y, ); }; -const onScrollEndDrag = function(e) { +const onScrollEndDrag = function (e) { ScrollListener.onScrollEndDrag( e.nativeEvent.contentOffset.x, e.nativeEvent.contentOffset.y, ); }; -const onItemPress = function(itemNumber) { +const onItemPress = function (itemNumber) { ScrollListener.onItemPress(itemNumber); }; @@ -105,7 +105,7 @@ class ScrollViewTestApp extends React.Component { } render(): React.Node { - scrollViewApp = this; + scrollViewApp = this; // eslint-disable-line consistent-this const children = this.state.data.map((item, index) => ( { } render(): React.Node { - scrollViewApp = this; + scrollViewApp = this; // eslint-disable-line consistent-this const children = this.state.data.map((item, index) => ( RecordingModule.recordOpened(), ({code, message}) => RecordingModule.recordError(), diff --git a/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js b/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js index ee2367f8b7cb..82599a67bc09 100644 --- a/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js +++ b/ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -327,7 +327,7 @@ class SubviewsClippingTestApp extends React.Component { state = {}; UNSAFE_componentWillMount() { - appInstance = this; + appInstance = this; // eslint-disable-line consistent-this } setComponent = component => { @@ -342,21 +342,21 @@ class SubviewsClippingTestApp extends React.Component { const SubviewsClippingTestModule = { App: SubviewsClippingTestApp, - renderClippingSample1: function() { + renderClippingSample1: function () { appInstance.setComponent(); }, - renderClippingSample2: function() { + renderClippingSample2: function () { appInstance.setComponent(); }, - renderUpdatingSample1: function(update1, update2) { + renderUpdatingSample1: function (update1, update2) { appInstance.setComponent( , ); }, - renderUpdatingSample2: function(update) { + renderUpdatingSample2: function (update) { appInstance.setComponent(); }, - renderScrollViewTest: function() { + renderScrollViewTest: function () { appInstance.setComponent(); }, }; diff --git a/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js b/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js index 2feb21e37e92..4859233ff0b3 100644 --- a/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js +++ b/ReactAndroid/src/androidTest/js/SwipeRefreshLayoutTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -51,7 +51,7 @@ class SwipeRefreshLayoutTestApp extends React.Component { }; componentDidMount() { - app = this; + app = this; // eslint-disable-line consistent-this } render() { @@ -77,7 +77,7 @@ class SwipeRefreshLayoutTestApp extends React.Component { const SwipeRefreshLayoutTestModule = { SwipeRefreshLayoutTestApp, - setRows: function(rows) { + setRows: function (rows) { if (app != null) { app.setState({rows}); } diff --git a/ReactAndroid/src/androidTest/js/TestBundle.js b/ReactAndroid/src/androidTest/js/TestBundle.js index b81937503589..8ce598b04eae 100644 --- a/ReactAndroid/src/androidTest/js/TestBundle.js +++ b/ReactAndroid/src/androidTest/js/TestBundle.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/TestIdTestModule.js b/ReactAndroid/src/androidTest/js/TestIdTestModule.js index 4398530ae4d8..6f59c2d23d32 100644 --- a/ReactAndroid/src/androidTest/js/TestIdTestModule.js +++ b/ReactAndroid/src/androidTest/js/TestIdTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js b/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js index 756846f97611..241a94c1f00e 100644 --- a/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js +++ b/ReactAndroid/src/androidTest/js/TestJSLocaleModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,10 +15,10 @@ const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridg const {Recording} = NativeModules; const TestJSLocaleModule = { - toUpper: function(s) { + toUpper: function (s) { Recording.record(s.toUpperCase()); }, - toLower: function(s) { + toLower: function (s) { Recording.record(s.toLowerCase()); }, }; diff --git a/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js b/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js index cf602236522b..aa8ca51f3429 100644 --- a/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js +++ b/ReactAndroid/src/androidTest/js/TestJSToJavaParametersModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,26 +15,26 @@ const BatchedBridge = require('react-native/Libraries/BatchedBridge/BatchedBridg const {Recording} = NativeModules; const TestJSToJavaParametersModule = { - returnBasicTypes: function() { + returnBasicTypes: function () { Recording.receiveBasicTypes('foo', 3.14, true, null); }, - returnBoxedTypes: function() { + returnBoxedTypes: function () { Recording.receiveBoxedTypes(42, 3.14, true); }, - returnDynamicTypes: function() { + returnDynamicTypes: function () { Recording.receiveDynamic('foo'); Recording.receiveDynamic(3.14); }, - returnArrayWithBasicTypes: function() { + returnArrayWithBasicTypes: function () { Recording.receiveArray(['foo', 3.14, -111, true, null]); }, - returnNestedArray: function() { + returnNestedArray: function () { Recording.receiveArray(['we', ['have', ['to', ['go', ['deeper']]]]]); }, - returnArrayWithMaps: function() { + returnArrayWithMaps: function () { Recording.receiveArray([{m1k1: 'm1v1', m1k2: 'm1v2'}, {m2k1: 'm2v1'}]); }, - returnMapWithBasicTypes: function() { + returnMapWithBasicTypes: function () { Recording.receiveMap({ stringKey: 'stringValue', doubleKey: 3.14, @@ -43,24 +43,24 @@ const TestJSToJavaParametersModule = { nullKey: null, }); }, - returnNestedMap: function() { + returnNestedMap: function () { Recording.receiveMap({ weHaveToGoDeeper: { inception: true, }, }); }, - returnMapWithArrays: function() { + returnMapWithArrays: function () { Recording.receiveMap({ empty: [], ints: [43, 44], mixed: [77, 'string', ['another', 'array']], }); }, - returnArrayWithStringDoubleIntMapArrayBooleanNull: function() { + returnArrayWithStringDoubleIntMapArrayBooleanNull: function () { Recording.receiveArray(['string', 3.14, 555, {}, [], true, null]); }, - returnMapWithStringDoubleIntMapArrayBooleanNull: function() { + returnMapWithStringDoubleIntMapArrayBooleanNull: function () { Recording.receiveMap({ string: 'string', double: 3, @@ -71,13 +71,13 @@ const TestJSToJavaParametersModule = { null: null, }); }, - returnArrayWithLargeInts: function() { + returnArrayWithLargeInts: function () { Recording.receiveArray([2147483648, -5555555555]); }, - returnMapWithLargeInts: function() { + returnMapWithLargeInts: function () { Recording.receiveMap({first: -2147483649, second: 5551231231}); }, - returnMapForMerge1: function() { + returnMapForMerge1: function () { Recording.receiveMap({ a: 1, b: 41, @@ -87,7 +87,7 @@ const TestJSToJavaParametersModule = { f: null, }); }, - returnMapForMerge2: function() { + returnMapForMerge2: function () { Recording.receiveMap({ a: 'overwrite', d: 77, @@ -96,7 +96,7 @@ const TestJSToJavaParametersModule = { newkey: 'newvalue', }); }, - returnMapWithMultibyteUTF8CharacterString: function() { + returnMapWithMultibyteUTF8CharacterString: function () { Recording.receiveMap({ 'one-byte': 'a', 'two-bytes': '\u00A2', @@ -106,7 +106,7 @@ const TestJSToJavaParametersModule = { '\u017C\u00F3\u0142\u0107 g\u0119\u015Bl\u0105 \u6211 \uD83D\uDE0E ja\u017A\u0107', }); }, - returnArrayWithMultibyteUTF8CharacterString: function() { + returnArrayWithMultibyteUTF8CharacterString: function () { Recording.receiveArray([ 'a', '\u00A2', diff --git a/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js b/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js index 9340844166a6..81d0f194154b 100644 --- a/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js +++ b/ReactAndroid/src/androidTest/js/TestJavaToJSArgumentsModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,20 +29,20 @@ function assertStrictStringEquals(a, b) { } const TestJavaToJSArgumentsModule = { - receiveBasicTypes: function(str, dbl, bool, null_arg) { + receiveBasicTypes: function (str, dbl, bool, null_arg) { assertEquals('foo', str); assertEquals(3.14, dbl); assertEquals(true, bool); assertEquals(null, null_arg); }, - receiveArrayWithBasicTypes: function(arr) { + receiveArrayWithBasicTypes: function (arr) { assertEquals(4, arr.length); assertEquals('red panda', arr[0]); assertEquals(1.19, arr[1]); assertEquals(true, arr[2]); assertEquals(null, arr[3]); }, - receiveNestedArray: function(arr) { + receiveNestedArray: function (arr) { assertEquals(2, arr.length); assertEquals('level1', arr[0]); const arr2 = arr[1]; @@ -50,7 +50,7 @@ const TestJavaToJSArgumentsModule = { const arr3 = arr2[1]; assertEquals('level3', arr3[0]); }, - receiveArrayWithMaps: function(arr) { + receiveArrayWithMaps: function (arr) { assertEquals(2, arr.length); const m1 = arr[0]; const m2 = arr[1]; @@ -58,17 +58,17 @@ const TestJavaToJSArgumentsModule = { assertEquals('m1v2', m1.m1k2); assertEquals('m2v1', m2.m2k1); }, - receiveMapWithBasicTypes: function(map) { + receiveMapWithBasicTypes: function (map) { assertEquals('stringValue', map.stringKey); assertEquals(3.14, map.doubleKey); assertEquals(true, map.booleanKey); assertEquals(null, map.nullKey); }, - receiveNestedMap: function(map) { + receiveNestedMap: function (map) { const nestedMap = map.nestedMap; assertEquals('foxes', nestedMap.animals); }, - receiveMapWithArrays: function(map) { + receiveMapWithArrays: function (map) { const a1 = map.array1; const a2 = map.array2; assertEquals(3, a1.length); @@ -76,7 +76,7 @@ const TestJavaToJSArgumentsModule = { assertEquals(3, a1[0]); assertEquals(9, a2[1]); }, - receiveMapAndArrayWithNullValues: function(map, array) { + receiveMapAndArrayWithNullValues: function (map, array) { assertEquals(null, map.string); assertEquals(null, map.array); assertEquals(null, map.map); @@ -85,7 +85,7 @@ const TestJavaToJSArgumentsModule = { assertEquals(null, array[1]); assertEquals(null, array[2]); }, - receiveMapWithMultibyteUTF8CharacterString: function(map) { + receiveMapWithMultibyteUTF8CharacterString: function (map) { assertStrictStringEquals('\u00A2', map['two-bytes']); assertStrictStringEquals('\u20AC', map['three-bytes']); assertStrictStringEquals('\uD83D\uDE1C', map['four-bytes']); @@ -94,7 +94,7 @@ const TestJavaToJSArgumentsModule = { map.mixed, ); }, - receiveArrayWithMultibyteUTF8CharacterString: function(array) { + receiveArrayWithMultibyteUTF8CharacterString: function (array) { assertTrue(true); assertStrictStringEquals('\u00A2', array[0]); assertStrictStringEquals('\u20AC', array[1]); diff --git a/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js b/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js index 7cfac525898b..9d81124ba867 100644 --- a/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js +++ b/ReactAndroid/src/androidTest/js/TestJavaToJSReturnValuesModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,13 +16,13 @@ const {assertEquals, assertTrue} = require('./Asserts'); const {TestModule} = NativeModules; const TestJavaToJSReturnValuesModule = { - callMethod: function(methodName, expectedType, expectedJSON) { + callMethod: function (methodName, expectedType, expectedJSON) { const result = TestModule[methodName](); assertEquals(expectedType, typeof result); assertEquals(expectedJSON, JSON.stringify(result)); }, - triggerException: function() { + triggerException: function () { try { TestModule.triggerException(); } catch (ex) { diff --git a/ReactAndroid/src/androidTest/js/TextInputTestModule.js b/ReactAndroid/src/androidTest/js/TextInputTestModule.js index 606d1ffd24f9..68155efa64de 100644 --- a/ReactAndroid/src/androidTest/js/TextInputTestModule.js +++ b/ReactAndroid/src/androidTest/js/TextInputTestModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -70,7 +70,6 @@ class TokenizedTextExample extends React.Component { return ( { @@ -118,30 +117,25 @@ class TextInputTestApp extends React.Component { testID="textInput2" /> mAttachedReactRoots = Collections.synchronizedSet(new HashSet()); @@ -173,8 +175,10 @@ public interface ReactInstanceEventListener { private final Context mApplicationContext; private @Nullable @ThreadConfined(UI) DefaultHardwareBackBtnHandler mDefaultBackButtonImpl; private @Nullable Activity mCurrentActivity; - private final Collection mReactInstanceEventListeners = - Collections.synchronizedList(new ArrayList()); + private final Collection + mReactInstanceEventListeners = + Collections.synchronizedList( + new ArrayList()); // Identifies whether the instance manager is or soon will be initialized (on background thread) private volatile boolean mHasStartedCreatingInitialContext = false; // Identifies whether the instance manager destroy function is in process, @@ -332,7 +336,7 @@ public JavaScriptExecutorFactory getJavaScriptExecutorFactory() { Activity currentActivity = getCurrentActivity(); if (currentActivity != null) { ReactRootView rootView = new ReactRootView(currentActivity); - rootView.setIsFabric(ReactFeatureFlags.enableFabricInLogBox); + rootView.setIsFabric(ReactFeatureFlags.enableFabricRenderer); rootView.startReactApplication(ReactInstanceManager.this, appKey, null); return rootView; } @@ -1001,12 +1005,14 @@ public List getOrCreateViewManagers( } /** Add a listener to be notified of react instance events. */ - public void addReactInstanceEventListener(ReactInstanceEventListener listener) { + public void addReactInstanceEventListener( + com.facebook.react.ReactInstanceEventListener listener) { mReactInstanceEventListeners.add(listener); } /** Remove a listener previously added with {@link #addReactInstanceEventListener}. */ - public void removeReactInstanceEventListener(ReactInstanceEventListener listener) { + public void removeReactInstanceEventListener( + com.facebook.react.ReactInstanceEventListener listener) { mReactInstanceEventListeners.remove(listener); } @@ -1097,14 +1103,22 @@ public void run() { // create mHasStartedCreatingInitialContext = true; + final ReactApplicationContext reactApplicationContext; try { Process.setThreadPriority(Process.THREAD_PRIORITY_DISPLAY); ReactMarker.logMarker(VM_INIT); - final ReactApplicationContext reactApplicationContext = + reactApplicationContext = createReactContext( initParams.getJsExecutorFactory().create(), initParams.getJsBundleLoader()); - + } catch (Exception e) { + // Reset state and bail out. This lets us try again later. + mHasStartedCreatingInitialContext = false; + mCreateReactContextThread = null; + mDevSupportManager.handleException(e); + return; + } + try { mCreateReactContextThread = null; ReactMarker.logMarker(PRE_SETUP_REACT_CONTEXT_START); final Runnable maybeRecreateReactContextRunnable = @@ -1177,16 +1191,16 @@ private void setupReactContext(final ReactApplicationContext reactContext) { // There is a race condition here - `finalListeners` can contain null entries // See usage below for more details. - ReactInstanceEventListener[] listeners = - new ReactInstanceEventListener[mReactInstanceEventListeners.size()]; - final ReactInstanceEventListener[] finalListeners = + com.facebook.react.ReactInstanceEventListener[] listeners = + new com.facebook.react.ReactInstanceEventListener[mReactInstanceEventListeners.size()]; + final com.facebook.react.ReactInstanceEventListener[] finalListeners = mReactInstanceEventListeners.toArray(listeners); UiThreadUtil.runOnUiThread( new Runnable() { @Override public void run() { - for (ReactInstanceEventListener listener : finalListeners) { + for (com.facebook.react.ReactInstanceEventListener listener : finalListeners) { // Sometimes this listener is null - probably due to race // condition between allocating listeners with a certain // size, and getting a `final` version of the array on @@ -1376,7 +1390,7 @@ private ReactApplicationContext createReactContext( mJSIModulePackage.getJSIModules( reactContext, catalystInstance.getJavaScriptContextHolder())); } - if (ReactFeatureFlags.eagerInitializeFabric) { + if (ReactFeatureFlags.enableFabricRenderer) { catalystInstance.getJSIModule(JSIModuleType.UIManager); } if (mBridgeIdleDebugListener != null) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java index ddfb5507ec4b..3d140cd36a99 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManagerBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,6 +14,7 @@ import android.app.Application; import android.content.Context; import androidx.annotation.Nullable; +import com.facebook.hermes.reactexecutor.HermesExecutor; import com.facebook.hermes.reactexecutor.HermesExecutorFactory; import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.JSBundleLoader; @@ -28,11 +29,11 @@ import com.facebook.react.devsupport.RedBoxHandler; import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener; import com.facebook.react.devsupport.interfaces.DevSupportManager; +import com.facebook.react.jscexecutor.JSCExecutor; import com.facebook.react.jscexecutor.JSCExecutorFactory; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; import com.facebook.react.packagerconnection.RequestHandler; import com.facebook.react.uimanager.UIImplementationProvider; -import com.facebook.soloader.SoLoader; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -65,6 +66,7 @@ public class ReactInstanceManagerBuilder { private @Nullable Map mCustomPackagerCommandHandlers; private @Nullable ReactPackageTurboModuleManagerDelegate.Builder mTMMDelegateBuilder; private @Nullable SurfaceDelegateFactory mSurfaceDelegateFactory; + private JSInterpreter jsInterpreter = JSInterpreter.OLD_LOGIC; /* package protected */ ReactInstanceManagerBuilder() {} @@ -124,6 +126,31 @@ public ReactInstanceManagerBuilder setJSBundleLoader(JSBundleLoader jsBundleLoad return this; } + /** + * Sets the jsEngine as JSC or HERMES as per the setJsEngineAsHermes call Uses the enum {@link + * JSInterpreter} + * + * @param jsInterpreter + */ + private void setJSEngine(JSInterpreter jsInterpreter) { + this.jsInterpreter = jsInterpreter; + } + + /** + * Utility setter to set the required JSEngine as HERMES or JSC Defaults to OLD_LOGIC if not + * called by the host app + * + * @param hermesEnabled hermesEnabled = true sets the JS Engine as HERMES and JSC otherwise + */ + public ReactInstanceManagerBuilder setJsEngineAsHermes(boolean hermesEnabled) { + if (hermesEnabled) { + setJSEngine(JSInterpreter.HERMES); + } else { + setJSEngine(JSInterpreter.JSC); + } + return this; + } + /** * Path to your app's main module on Metro. This is used when reloading JS during development. All * paths are relative to the root folder the packager is serving files from. Examples: {@code @@ -344,40 +371,35 @@ public ReactInstanceManager build() { private JavaScriptExecutorFactory getDefaultJSExecutorFactory( String appName, String deviceName, Context applicationContext) { - try { - // If JSC is included, use it as normal - initializeSoLoaderIfNecessary(applicationContext); - SoLoader.loadLibrary("jscexecutor"); - return new JSCExecutorFactory(appName, deviceName); - } catch (UnsatisfiedLinkError jscE) { - // https://github.com/facebook/hermes/issues/78 shows that - // people who aren't trying to use Hermes are having issues. - // https://github.com/facebook/react-native/issues/25923#issuecomment-554295179 - // includes the actual JSC error in at least one case. - // - // So, if "__cxa_bad_typeid" shows up in the jscE exception - // message, then we will assume that's the failure and just - // throw now. - - if (jscE.getMessage().contains("__cxa_bad_typeid")) { - throw jscE; - } - // Otherwise use Hermes + // Relying solely on try catch block and loading jsc even when + // project is using hermes can lead to launch-time crashes especially in + // monorepo architectures and hybrid apps using both native android + // and react native. + // So we can use the value of enableHermes received by the constructor + // to decide which library to load at launch + + // if nothing is specified, use old loading method + // else load the required engine + if (jsInterpreter == JSInterpreter.OLD_LOGIC) { try { + // If JSC is included, use it as normal + initializeSoLoaderIfNecessary(applicationContext); + JSCExecutor.loadLibrary(); + return new JSCExecutorFactory(appName, deviceName); + } catch (UnsatisfiedLinkError jscE) { + if (jscE.getMessage().contains("__cxa_bad_typeid")) { + throw jscE; + } + HermesExecutor.loadLibrary(); return new HermesExecutorFactory(); - } catch (UnsatisfiedLinkError hermesE) { - // If we get here, either this is a JSC build, and of course - // Hermes failed (since it's not in the APK), or it's a Hermes - // build, and Hermes had a problem. - - // We suspect this is a JSC issue (it's the default), so we - // will throw that exception, but we will print hermesE first, - // since it could be a Hermes issue and we don't want to - // swallow that. - hermesE.printStackTrace(); - throw jscE; } + } else if (jsInterpreter == JSInterpreter.HERMES) { + HermesExecutor.loadLibrary(); + return new HermesExecutorFactory(); + } else { + JSCExecutor.loadLibrary(); + return new JSCExecutorFactory(appName, deviceName); } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java index 9330013c947e..3d8634135c35 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstancePackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java b/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java index 5ee746a4f6cf..305af49539d3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java index f8c6608dc046..14c0b26b4c82 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java b/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java index 8f578c8bb145..f66f2171714f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactPackageHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactPackageLogger.java b/ReactAndroid/src/main/java/com/facebook/react/ReactPackageLogger.java index 2a5175b70caf..8c62165bfaa2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactPackageLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactPackageLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java index 2a9c99549bda..66a0628244a9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java index 5bfdf9aafd83..1cadadac30f8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,7 @@ import android.os.Build; import android.os.Bundle; import android.util.AttributeSet; +import android.util.DisplayMetrics; import android.view.DisplayCutout; import android.view.KeyEvent; import android.view.MotionEvent; @@ -26,6 +27,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; +import android.view.WindowInsets; import android.view.WindowManager; import android.widget.FrameLayout; import androidx.annotation.Nullable; @@ -44,6 +46,7 @@ import com.facebook.react.bridge.WritableMap; import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.common.annotations.VisibleForTesting; +import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.modules.appregistry.AppRegistry; import com.facebook.react.modules.core.DeviceEventManagerModule; import com.facebook.react.modules.deviceinfo.DeviceInfoModule; @@ -184,15 +187,27 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { } @Override - public void onChildStartedNativeGesture(MotionEvent androidEvent) { - if (mReactInstanceManager == null - || !mIsAttachedToInstance - || mReactInstanceManager.getCurrentReactContext() == null) { - FLog.w(TAG, "Unable to dispatch touch to JS as the catalyst instance has not been attached"); + public void onChildStartedNativeGesture(MotionEvent ev) { + if (!isDispatcherReady()) { return; } - if (mJSTouchDispatcher == null) { - FLog.w(TAG, "Unable to dispatch touch to JS before the dispatcher is available"); + ReactContext reactContext = mReactInstanceManager.getCurrentReactContext(); + UIManager uiManager = UIManagerHelper.getUIManager(reactContext, getUIManagerType()); + + if (uiManager != null) { + EventDispatcher eventDispatcher = uiManager.getEventDispatcher(); + mJSTouchDispatcher.onChildStartedNativeGesture(ev, eventDispatcher); + } + } + + @Override + public void onChildStartedNativeGesture(View childView, MotionEvent ev) { + onChildStartedNativeGesture(ev); + } + + @Override + public void onChildEndedNativeGesture(View childView, MotionEvent ev) { + if (!isDispatcherReady()) { return; } ReactContext reactContext = mReactInstanceManager.getCurrentReactContext(); @@ -200,8 +215,23 @@ public void onChildStartedNativeGesture(MotionEvent androidEvent) { if (uiManager != null) { EventDispatcher eventDispatcher = uiManager.getEventDispatcher(); - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, eventDispatcher); + mJSTouchDispatcher.onChildEndedNativeGesture(ev, eventDispatcher); + } + } + + private boolean isDispatcherReady() { + if (mReactInstanceManager == null + || !mIsAttachedToInstance + || mReactInstanceManager.getCurrentReactContext() == null) { + FLog.w(TAG, "Unable to dispatch touch to JS as the catalyst instance has not been attached"); + return false; } + if (mJSTouchDispatcher == null) { + FLog.w(TAG, "Unable to dispatch touch to JS before the dispatcher is available"); + return false; + } + + return true; } @Override @@ -306,11 +336,15 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto // No-op in non-Fabric since UIManagerModule handles actually laying out children. // In Fabric, update LayoutSpecs just so we update the offsetX and offsetY. - if (mWasMeasured && getUIManagerType() == FABRIC) { + if (mWasMeasured && isFabric()) { updateRootLayoutSpecs(false, mWidthMeasureSpec, mHeightMeasureSpec); } } + private boolean isFabric() { + return getUIManagerType() == FABRIC; + } + @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -412,12 +446,29 @@ public void startReactApplication( mInitialUITemplate = initialUITemplate; mReactInstanceManager.createReactContextInBackground(); - + // if in this experiment, we initialize the root earlier in startReactApplication + // instead of waiting for the initial measure + if (ReactFeatureFlags.enableEagerRootViewAttachment) { + if (!mWasMeasured) { + // Ideally, those values will be used by default, but we only update them here to scope + // this change to `enableEagerRootViewAttachment` experiment. + setSurfaceConstraintsToScreenSize(); + } + attachToReactInstanceManager(); + } } finally { Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE); } } + private void setSurfaceConstraintsToScreenSize() { + DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics(); + mWidthMeasureSpec = + MeasureSpec.makeMeasureSpec(displayMetrics.widthPixels, MeasureSpec.AT_MOST); + mHeightMeasureSpec = + MeasureSpec.makeMeasureSpec(displayMetrics.heightPixels, MeasureSpec.AT_MOST); + } + @Override public int getWidthMeasureSpec() { return mWidthMeasureSpec; @@ -463,7 +514,8 @@ private void updateRootLayoutSpecs( } // In Fabric we cannot call `updateRootLayoutSpecs` until a SurfaceId has been set. // Sometimes, - if (getUIManagerType() == FABRIC && !isRootViewTagSet()) { + boolean isFabricEnabled = isFabric(); + if (isFabricEnabled && !isRootViewTagSet()) { ReactMarker.logMarker(ReactMarkerConstants.ROOT_VIEW_UPDATE_LAYOUT_SPECS_END); FLog.e(TAG, "Unable to update root layout specs for ReactRootView: no rootViewTag set yet"); return; @@ -480,7 +532,7 @@ private void updateRootLayoutSpecs( // In Fabric only, get position of view within screen int offsetX = 0; int offsetY = 0; - if (getUIManagerType() == FABRIC) { + if (isFabricEnabled) { Point viewportOffset = RootViewUtil.getViewportOffset(this); offsetX = viewportOffset.x; offsetY = viewportOffset.y; @@ -515,7 +567,7 @@ public void unmountReactApplication() { // all the views in the hierarchy. if (mReactInstanceManager != null) { final ReactContext reactApplicationContext = mReactInstanceManager.getCurrentReactContext(); - if (reactApplicationContext != null && getUIManagerType() == FABRIC) { + if (reactApplicationContext != null && isFabric()) { @Nullable UIManager uiManager = UIManagerHelper.getUIManager(reactApplicationContext, getUIManagerType()); @@ -667,12 +719,22 @@ private void attachToReactInstanceManager() { // React Native requires that the RootView id be managed entirely by React Native, and will // crash in addRootView/startSurface if the native View id isn't set to NO_ID. + + // This behavior can not be guaranteed in hybrid apps that have a native android layer over + // which reactRootViews are added and the native views need to have ids on them in order to + // work. + // Hence this can cause unnecessary crashes at runtime for hybrid apps. + // So converting this to a soft exception such that pure react-native devs can still see the + // warning while hybrid apps continue to run without crashes + if (getId() != View.NO_ID) { - throw new IllegalViewOperationException( - "Trying to attach a ReactRootView with an explicit id already set to [" - + getId() - + "]. React Native uses the id field to track react tags and will overwrite this" - + " field. If that is fine, explicitly overwrite the id field to View.NO_ID."); + ReactSoftExceptionLogger.logSoftException( + TAG, + new IllegalViewOperationException( + "Trying to attach a ReactRootView with an explicit id already set to [" + + getId() + + "]. React Native uses the id field to track react tags and will overwrite this" + + " field. If that is fine, explicitly overwrite the id field to View.NO_ID.")); } try { @@ -775,9 +837,12 @@ private void checkForKeyboardEvents() { getRootView().getWindowVisibleDisplayFrame(mVisibleViewArea); int notchHeight = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - DisplayCutout displayCutout = getRootView().getRootWindowInsets().getDisplayCutout(); - if (displayCutout != null) { - notchHeight = displayCutout.getSafeInsetTop(); + WindowInsets insets = getRootView().getRootWindowInsets(); + if (insets != null) { + DisplayCutout displayCutout = insets.getDisplayCutout(); + if (displayCutout != null) { + notchHeight = displayCutout.getSafeInsetTop(); + } } } final int heightDiff = diff --git a/ReactAndroid/src/main/java/com/facebook/react/TurboReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/TurboReactPackage.java index de2b6347ec34..0efffb9cff54 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/TurboReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/TurboReactPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/ViewManagerOnDemandReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/ViewManagerOnDemandReactPackage.java index 780ee0fbabd4..7f3c192740f1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ViewManagerOnDemandReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ViewManagerOnDemandReactPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java index 8dfa44b3eee5..6b72b32e5161 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/AdditionAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -39,7 +39,7 @@ public void update() { mValue += ((ValueAnimatedNode) animatedNode).getValue(); } else { throw new JSApplicationCausedNativeException( - "Illegal node ID set as an input for " + "Animated.Add node"); + "Illegal node ID set as an input for Animated.Add node"); } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java index cf0535253178..358296ebf55d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNodeValueListener.java b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNodeValueListener.java index 95bf25cce5b5..24ee0e662ddb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNodeValueListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimatedNodeValueListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.java b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.java index a333cd7752fc..cd627d2809a4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/AnimationDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/DecayAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/animated/DecayAnimation.java index 0400dfce7967..b3bbab4378cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/DecayAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/DecayAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java index 3c53a920a470..de356762c801 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/DiffClampAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -41,7 +41,7 @@ private double getInputNodeValue() { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNodeTag); if (animatedNode == null || !(animatedNode instanceof ValueAnimatedNode)) { throw new JSApplicationCausedNativeException( - "Illegal node ID set as an input for " + "Animated.DiffClamp node"); + "Illegal node ID set as an input for Animated.DiffClamp node"); } return ((ValueAnimatedNode) animatedNode).getValue(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java index 51274fffeee6..505062194510 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/DivisionAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/EventAnimationDriver.java b/ReactAndroid/src/main/java/com/facebook/react/animated/EventAnimationDriver.java index 9062a77d4f78..fce99e38ba41 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/EventAnimationDriver.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/EventAnimationDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,10 @@ package com.facebook.react.animated; import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.ReadableType; +import com.facebook.react.bridge.UnexpectedNativeTypeException; import com.facebook.react.bridge.WritableArray; import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.RCTEventEmitter; @@ -31,12 +34,45 @@ public void receiveEvent(int targetTag, String eventName, @Nullable WritableMap } // Get the new value for the node by looking into the event map using the provided event path. - ReadableMap curMap = event; + ReadableMap currMap = event; + ReadableArray currArray = null; for (int i = 0; i < mEventPath.size() - 1; i++) { - curMap = curMap.getMap(mEventPath.get(i)); + if (currMap != null) { + String key = mEventPath.get(i); + ReadableType keyType = currMap.getType(key); + if (keyType == ReadableType.Map) { + currMap = currMap.getMap(key); + currArray = null; + } else if (keyType == ReadableType.Array) { + currArray = currMap.getArray(key); + currMap = null; + } else { + throw new UnexpectedNativeTypeException( + "Unexpected type " + keyType + " for key '" + key + "'"); + } + } else { + int index = Integer.parseInt(mEventPath.get(i)); + ReadableType keyType = currArray.getType(index); + if (keyType == ReadableType.Map) { + currMap = currArray.getMap(index); + currArray = null; + } else if (keyType == ReadableType.Array) { + currArray = currArray.getArray(index); + currMap = null; + } else { + throw new UnexpectedNativeTypeException( + "Unexpected type " + keyType + " for index '" + index + "'"); + } + } } - mValueNode.mValue = curMap.getDouble(mEventPath.get(mEventPath.size() - 1)); + String lastKey = mEventPath.get(mEventPath.size() - 1); + if (currMap != null) { + mValueNode.mValue = currMap.getDouble(lastKey); + } else { + int lastIndex = Integer.parseInt(lastKey); + mValueNode.mValue = currArray.getDouble(lastIndex); + } } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java b/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java index 6ccdb85d9997..798fcffd7442 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/FrameBasedAnimationDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java index 89962bb683ad..5a738ae7fbe0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/InterpolationAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java index 45c9848925bb..f5ec5b7bb3c9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/ModulusAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,11 +27,11 @@ public ModulusAnimatedNode( public void update() { AnimatedNode animatedNode = mNativeAnimatedNodesManager.getNodeById(mInputNode); if (animatedNode != null && animatedNode instanceof ValueAnimatedNode) { - final double value = ((ValueAnimatedNode) animatedNode).getValue(); + double value = ((ValueAnimatedNode) animatedNode).getValue(); mValue = (value % mModulus + mModulus) % mModulus; } else { throw new JSApplicationCausedNativeException( - "Illegal node ID set as an input for " + "Animated.modulus node"); + "Illegal node ID set as an input for Animated.modulus node"); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java index f325105244d7..1053457a7bd8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/MultiplicationAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -39,7 +39,7 @@ public void update() { mValue *= ((ValueAnimatedNode) animatedNode).getValue(); } else { throw new JSApplicationCausedNativeException( - "Illegal node ID set as an input for " + "Animated.multiply node"); + "Illegal node ID set as an input for Animated.multiply node"); } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java index 0c4badcd481d..9c370f68a91d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java index a2707f5842ed..8321acffb825 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/NativeAnimatedNodesManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java index 1faa05856e8b..9ee330d7dd0f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/PropsAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/SpringAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/animated/SpringAnimation.java index 3bae6de293ec..c507a6d51532 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/SpringAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/SpringAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java index c6f0affb9bd8..65b65a10edad 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/StyleAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java index 9ac939d5043d..8b13969f422b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/SubtractionAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -38,12 +38,12 @@ public void update() { double value = ((ValueAnimatedNode) animatedNode).getValue(); if (i == 0) { mValue = value; - continue; + } else { + mValue -= value; } - mValue -= ((ValueAnimatedNode) animatedNode).getValue(); } else { throw new JSApplicationCausedNativeException( - "Illegal node ID set as an input for " + "Animated.subtract node"); + "Illegal node ID set as an input for Animated.subtract node"); } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java index dd204088042f..88bce0136903 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/TrackingAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java index 0f5317a1e957..8b3ec593d4ec 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/TransformAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java b/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java index 15acef1aa25c..ddc3df607509 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/animated/ValueAnimatedNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java index 70301b75871a..a591f118c2f2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ActivityEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.java index c5e8a5ccbcfa..c34776b7d807 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/Arguments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/AssertionException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/AssertionException.java index b4a8d1714e96..1675e6d07fd4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/AssertionException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/AssertionException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java index 7ed0b3526f6e..0c56d2227f13 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/BackgroundExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseActivityEventListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseActivityEventListener.java index d3702ed33ea1..9f6914e0e85b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseActivityEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseActivityEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java index a8bf93676f44..10c60a3e16f9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/BaseJavaModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/Callback.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/Callback.java index 4954708f86fe..da1df73fa7fe 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/Callback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/Callback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.java index 31f5d76515d3..88f217e22661 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CallbackImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java index ddd1bee4f022..06ffc04af6ba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java index 74992ad17ab8..96fd8aa2592f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.java index 5ac8ddceb690..07b491dcb86a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ContextBaseJavaModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ContextBaseJavaModule.java index 81c86d24e1f9..2379a7c17c03 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ContextBaseJavaModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ContextBaseJavaModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java index 1abb508c54b3..2d706ef0122a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxCallbackImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapper.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapper.java index a6809522f22b..a50ced0771ea 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.java index 1d2814a1d545..ff7d2d6369f3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/CxxModuleWrapperBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/DefaultNativeModuleCallExceptionHandler.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/DefaultNativeModuleCallExceptionHandler.java index 7d37b325184c..aca3a886e5c0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/DefaultNativeModuleCallExceptionHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/DefaultNativeModuleCallExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/Dynamic.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/Dynamic.java index 585ec4349c79..1fb137716b70 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/Dynamic.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/Dynamic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromArray.java index 63c907834c92..ce8fc4aa8f83 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromMap.java index 5d9c5fc44191..62d8d509f253 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromObject.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromObject.java index a892df8553b6..b0bc88e14c72 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromObject.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicFromObject.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/FallbackJSBundleLoader.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/FallbackJSBundleLoader.java index af80d53240b9..e2c669cb4623 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/FallbackJSBundleLoader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/FallbackJSBundleLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedAsyncTask.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedAsyncTask.java index 5052b6ecabe9..a4131e519fca 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedAsyncTask.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedAsyncTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedResultAsyncTask.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedResultAsyncTask.java index def9f755c5b6..28e8fc4f8982 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedResultAsyncTask.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedResultAsyncTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedRunnable.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedRunnable.java index c918641cdd9a..14bcddf44cf3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedRunnable.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/GuardedRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/Inspector.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/Inspector.java index 9e4fd5daada4..c8b340f7691a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/Inspector.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/Inspector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/InvalidIteratorException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/InvalidIteratorException.java index c101b2502d76..310c3862d60f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/InvalidIteratorException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/InvalidIteratorException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java index cb982ba802a2..4805dc855cb1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationCausedNativeException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationIllegalArgumentException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationIllegalArgumentException.java index 2d621dfc498b..47d4a94129f1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationIllegalArgumentException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSApplicationIllegalArgumentException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java index 5ff5d4a30511..6c3844205c21 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoaderDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoaderDelegate.java index f03cd14ae185..830f77224ab7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoaderDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSBundleLoaderDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutor.java index fec4e3ce5a34..8b6497b6ff3c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutorFactory.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutorFactory.java index d75ba9002079..5cfc327feaba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutorFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSCJavaScriptExecutorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModule.java index d4b81b7bb41c..2c0b6301817a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleHolder.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleHolder.java index ad40dfdc5fdc..b5bd5902b235 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModulePackage.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModulePackage.java index db8ea752c146..7095a9f40052 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModulePackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModulePackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleProvider.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleProvider.java index 0df9f6dfa62e..c3716774b8d1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java index 52e9f43f64b2..3853232e6db4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,6 @@ package com.facebook.react.bridge; import com.facebook.infer.annotation.Assertions; -import com.facebook.react.config.ReactFeatureFlags; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,8 +44,5 @@ public void notifyJSInstanceDestroy() { JSIModuleHolder moduleHolder = entry.getValue(); moduleHolder.notifyJSInstanceDestroy(); } - if (ReactFeatureFlags.enableReactContextCleanupFix) { - mModules.clear(); - } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleSpec.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleSpec.java index 94ed82891f27..20cd88d5fdd4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleSpec.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleType.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleType.java index b3202e58f017..854f2de38175 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSInstance.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSInstance.java index 429f95abc04a..3b5a5abf14a7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JSInstance.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JSInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java index db9f29b130e7..0bf0f7a43b8b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaJSExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.java index 5fe415dc19d9..8a2ef7bb9fb6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaMethodWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java index c113c6b056b0..b9ea9bb79e4d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaModuleWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyArray.java index 5312bba92e5a..f81766a4c024 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.java index 1267d84abc6d..aa3cb0f6fe21 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaOnlyMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptContextHolder.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptContextHolder.java index 608df3341fb3..25b9accc99e9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptContextHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptContextHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutor.java index 88188532f7b7..2f01c027f753 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutorFactory.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutorFactory.java index a7bbf4ef7b7b..8031ee9638df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutorFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptExecutorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModule.java index eccabefee29c..869c584e0813 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.java index 4998395a21f8..15a0219ff0d0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JavaScriptModuleRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/JsonWriterHelper.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/JsonWriterHelper.java index 5e9a756b6ef8..175d4e171684 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/JsonWriterHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/JsonWriterHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java index b17ed18b1289..5356ebd6fcf1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/LifecycleEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressure.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressure.java index 8554ea7e18b1..35810f65979e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressure.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressure.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressureListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressureListener.java index d9a5c30016dc..8d036958b065 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressureListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/MemoryPressureListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java index ad5709a07e03..3fef9e8f2847 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleSpec.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleSpec.java index 78ce3c3f843b..927060ca6bb0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleSpec.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArgumentsParseException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArgumentsParseException.java index 4ddcbc269762..47e31156bd15 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArgumentsParseException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArgumentsParseException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java index 2204c4bf60a6..c46dbcc6dad5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java index 1f05016813e6..6791df05e6d5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeMap.java index 5a44a7051015..fdf9504f37de 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java index 11f7117f2e97..618f02017579 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleCallExceptionHandler.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleCallExceptionHandler.java index 2dbe4ecd70fa..786057f7a485 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleCallExceptionHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleCallExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.java index 809d915c0149..254e8d56117d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModuleRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -107,9 +107,6 @@ private ReactApplicationContext getReactApplicationContext() { for (ModuleHolder module : mModules.values()) { module.destroy(); } - if (ReactFeatureFlags.enableReactContextCleanupFix) { - mModules.clear(); - } } finally { Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NoSuchKeyException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NoSuchKeyException.java index ec0900fcec3e..7e8c2cae409d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NoSuchKeyException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NoSuchKeyException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener.java index 136a558cf201..9dd9972fe52c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/NotThreadSafeBridgeIdleDebugListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ObjectAlreadyConsumedException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ObjectAlreadyConsumedException.java index 974cb1701e33..ef8cc7830338 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ObjectAlreadyConsumedException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ObjectAlreadyConsumedException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/OnBatchCompleteListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/OnBatchCompleteListener.java index a0f012d9f99b..7808c7828007 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/OnBatchCompleteListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/OnBatchCompleteListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/PerformanceCounter.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/PerformanceCounter.java index 6208d5113c43..43f53119b459 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/PerformanceCounter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/PerformanceCounter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/Promise.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/Promise.java index 9dd971a691d2..1d7a8da303e0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/Promise.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/Promise.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java index 341fcfca610c..79aa22859256 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/PromiseImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ProxyJavaScriptExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ProxyJavaScriptExecutor.java index d60de166ce91..e341a1d0ccbc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ProxyJavaScriptExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ProxyJavaScriptExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactApplicationContext.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactApplicationContext.java index 9fa01ba5f89b..0b8520bf95d3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactApplicationContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.java index f5309de3d619..73a4e1fc7a24 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactBridge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCallback.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCallback.java index d455b67a6cca..36dca68a23e4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java index dbc51207af22..e45f93b4ba1e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,7 +23,6 @@ import com.facebook.react.bridge.queue.ReactQueueConfiguration; import com.facebook.react.common.LifecycleState; import com.facebook.react.common.ReactConstants; -import com.facebook.react.config.ReactFeatureFlags; import java.lang.ref.WeakReference; import java.util.concurrent.CopyOnWriteArraySet; @@ -320,11 +319,6 @@ public void destroy() { if (mCatalystInstance != null) { mCatalystInstance.destroy(); } - if (ReactFeatureFlags.enableReactContextCleanupFix) { - mLifecycleEventListeners.clear(); - mActivityEventListeners.clear(); - mWindowFocusEventListeners.clear(); - } } /** Should be called by the hosting Fragment in {@link Fragment#onActivityResult} */ @@ -396,8 +390,8 @@ public boolean isOnJSQueueThread() { return Assertions.assertNotNull(mJSMessageQueueThread).isOnThread(); } - public void runOnJSQueueThread(Runnable runnable) { - Assertions.assertNotNull(mJSMessageQueueThread).runOnQueue(runnable); + public boolean runOnJSQueueThread(Runnable runnable) { + return Assertions.assertNotNull(mJSMessageQueueThread).runOnQueue(runnable); } /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java index 132520c386b2..2cb9fe9177af 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactContextBaseJavaModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.java index f5efbf1fadf9..a2646ebf74c4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactCxxErrorHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactIgnorableMountingException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactIgnorableMountingException.java index 4dbf939817c4..b77c7eed46fc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactIgnorableMountingException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactIgnorableMountingException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarker.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarker.java index 683d36aaddf9..b6c43571766d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarker.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java index 4c19185c7252..b90a03600bd1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMarkerConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMethod.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMethod.java index f45ea53365e0..ee3d19c746c8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMethod.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactModuleWithSpec.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactModuleWithSpec.java index 949ad2046f10..523c36a92130 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactModuleWithSpec.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactModuleWithSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactNoCrashSoftException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactNoCrashSoftException.java index b3234996e190..960eefb3033b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactNoCrashSoftException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactNoCrashSoftException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactSoftExceptionLogger.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactSoftExceptionLogger.java index a33590a83d09..ff515cc53185 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactSoftExceptionLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReactSoftExceptionLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableArray.java index 82ffb0e8ab3a..26a88911b30c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMap.java index 66a9eefd300e..a3bae65f7224 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMapKeySetIterator.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMapKeySetIterator.java index 40c4416faeda..ca600f41db3a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMapKeySetIterator.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableMapKeySetIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeArray.java index cc80051b4954..1a117a6b4692 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java index a2e4319224ab..0b787014524b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableNativeMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableType.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableType.java index 50241d9f7f5d..17fd9e35d066 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ReadableType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/RetryableMountingLayerException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/RetryableMountingLayerException.java index a9c8fb325f75..fbb9856ddeba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/RetryableMountingLayerException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/RetryableMountingLayerException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeExecutor.java index 2e001202e431..a70669e04cc3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeScheduler.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeScheduler.java index 7270c65c6bfa..a8a7b156e4c5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeScheduler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/RuntimeScheduler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/SoftAssertions.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/SoftAssertions.java index 4bccdfd1dd07..cd420267a09c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/SoftAssertions.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/SoftAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/Systrace.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/Systrace.java index 58d36e936e73..91652c3283bd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/Systrace.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/Systrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java index 50ab07a1b3b6..caee586add25 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java index c190e0a8c02d..984bcf15848e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/UIManagerListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/UiThreadUtil.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/UiThreadUtil.java index 7396345a3b36..14b430430884 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/UiThreadUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/UiThreadUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/UnexpectedNativeTypeException.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/UnexpectedNativeTypeException.java index 290fdc5c70a4..fe394ab94945 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/UnexpectedNativeTypeException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/UnexpectedNativeTypeException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/WindowFocusChangeListener.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/WindowFocusChangeListener.java index 7083e39ebc80..56226b717656 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/WindowFocusChangeListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/WindowFocusChangeListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableArray.java index 8149427feaf6..8ec699c3970e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableMap.java index 54a047419628..1f6ec6500970 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeArray.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeArray.java index 298a0eff5078..46a2c8d9e67e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -45,21 +45,21 @@ public WritableNativeArray() { @Override public void pushArray(@Nullable ReadableArray array) { Assertions.assertCondition( - array == null || array instanceof WritableNativeArray, "Illegal type provided"); - pushNativeArray((WritableNativeArray) array); + array == null || array instanceof ReadableNativeArray, "Illegal type provided"); + pushNativeArray((ReadableNativeArray) array); } // Note: this consumes the map so do not reuse it. @Override public void pushMap(@Nullable ReadableMap map) { Assertions.assertCondition( - map == null || map instanceof WritableNativeMap, "Illegal type provided"); - pushNativeMap((WritableNativeMap) map); + map == null || map instanceof ReadableNativeMap, "Illegal type provided"); + pushNativeMap((ReadableNativeMap) map); } private static native HybridData initHybrid(); - private native void pushNativeArray(WritableNativeArray array); + private native void pushNativeArray(ReadableNativeArray array); - private native void pushNativeMap(WritableNativeMap map); + private native void pushNativeMap(ReadableNativeMap map); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeMap.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeMap.java index d8b58b7f8d1b..809cc9127f55 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/WritableNativeMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -41,16 +41,16 @@ public class WritableNativeMap extends ReadableNativeMap implements WritableMap @Override public void putMap(@NonNull String key, @Nullable ReadableMap value) { Assertions.assertCondition( - value == null || value instanceof WritableNativeMap, "Illegal type provided"); - putNativeMap(key, (WritableNativeMap) value); + value == null || value instanceof ReadableNativeMap, "Illegal type provided"); + putNativeMap(key, (ReadableNativeMap) value); } // Note: this consumes the map so do not reuse it. @Override public void putArray(@NonNull String key, @Nullable ReadableArray value) { Assertions.assertCondition( - value == null || value instanceof WritableNativeArray, "Illegal type provided"); - putNativeArray(key, (WritableNativeArray) value); + value == null || value instanceof ReadableNativeArray, "Illegal type provided"); + putNativeArray(key, (ReadableNativeArray) value); } // Note: this **DOES NOT** consume the source map @@ -73,9 +73,9 @@ public WritableNativeMap() { private static native HybridData initHybrid(); - private native void putNativeMap(String key, WritableNativeMap value); + private native void putNativeMap(String key, ReadableNativeMap value); - private native void putNativeArray(String key, WritableNativeArray value); + private native void putNativeArray(String key, ReadableNativeArray value); private native void mergeNativeMap(ReadableNativeMap source); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/bridge.pro b/ReactAndroid/src/main/java/com/facebook/react/bridge/bridge.pro index 028d56d07828..ce18d10156d6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/bridge.pro +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/bridge.pro @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java index f40885e8ac91..678af19b2ed5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThread.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,7 @@ public interface MessageQueueThread { * if it is being submitted from the same queue Thread. */ @DoNotStrip - void runOnQueue(Runnable runnable); + boolean runOnQueue(Runnable runnable); /** * Runs the given Callable on this Thread. It will be submitted to the end of the event queue even diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java index d1e6ac7d1891..010b6871593e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java index 00beffd3a558..ba03bbe3049c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -55,15 +55,17 @@ private MessageQueueThreadImpl( */ @DoNotStrip @Override - public void runOnQueue(Runnable runnable) { + public boolean runOnQueue(Runnable runnable) { if (mIsFinished) { FLog.w( ReactConstants.TAG, "Tried to enqueue runnable on already finished thread: '" + getName() + "... dropping Runnable."); + return false; } mHandler.post(runnable); + return true; } @DoNotStrip diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadPerfStats.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadPerfStats.java index 50ffae079f4e..bd41b36e093e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadPerfStats.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadPerfStats.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java index 31cf58b74433..ed9ab389cd09 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/NativeRunnable.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/NativeRunnable.java index 31fb34d68b24..3573938d3d95 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/NativeRunnable.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/NativeRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/QueueThreadExceptionHandler.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/QueueThreadExceptionHandler.java index 4c32bfa516d9..31ab3a2587ae 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/QueueThreadExceptionHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/QueueThreadExceptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java index 3b0f2000b408..f696b6ae7ed2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java index 5e2cdfea1c30..169eb4e3ff54 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java index ebe2e1404fdb..4b8bf51958cb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/ReactQueueConfigurationSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/reactnative.pro b/ReactAndroid/src/main/java/com/facebook/react/bridge/reactnative.pro index 4031578963f7..72f1131c6773 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/reactnative.pro +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/reactnative.pro @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/ArrayUtils.java b/ReactAndroid/src/main/java/com/facebook/react/common/ArrayUtils.java index 0f2672432c5b..4ff50c54a9da 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/ArrayUtils.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/ArrayUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/ClearableSynchronizedPool.java b/ReactAndroid/src/main/java/com/facebook/react/common/ClearableSynchronizedPool.java index f42aedcc914a..5dd0943dfe5c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/ClearableSynchronizedPool.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/ClearableSynchronizedPool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/DebugServerException.java b/ReactAndroid/src/main/java/com/facebook/react/common/DebugServerException.java index 1fbd8380b479..33898324d69f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/DebugServerException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/DebugServerException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/HasJavascriptExceptionMetadata.java b/ReactAndroid/src/main/java/com/facebook/react/common/HasJavascriptExceptionMetadata.java index fdd8364d7183..15c065deb3b8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/HasJavascriptExceptionMetadata.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/HasJavascriptExceptionMetadata.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java b/ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java index b234dd1cb111..d1aaca03123e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/JavascriptException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java b/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java index cc3238a21030..ebbd384b8a56 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/LifecycleState.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/LongArray.java b/ReactAndroid/src/main/java/com/facebook/react/common/LongArray.java index dea6b9a43b4e..3ef68f0b2842 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/LongArray.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/LongArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/MapBuilder.java b/ReactAndroid/src/main/java/com/facebook/react/common/MapBuilder.java index 5a633757ca34..42492ce7bce2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/MapBuilder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/MapBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/ReactConstants.java b/ReactAndroid/src/main/java/com/facebook/react/common/ReactConstants.java index 35c4aa4ccb32..3f438506daa3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/ReactConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/ReactConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/ShakeDetector.java b/ReactAndroid/src/main/java/com/facebook/react/common/ShakeDetector.java index 5cf388a0ea09..9ebcea248e6e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/ShakeDetector.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/ShakeDetector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/SingleThreadAsserter.java b/ReactAndroid/src/main/java/com/facebook/react/common/SingleThreadAsserter.java index f160a30af0bb..6335961e22e0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/SingleThreadAsserter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/SingleThreadAsserter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/StandardCharsets.java b/ReactAndroid/src/main/java/com/facebook/react/common/StandardCharsets.java index 0a834c6a726c..9399888a16c5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/StandardCharsets.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/StandardCharsets.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegate.java index 91e24105e1f3..821de3f3a3f9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegateFactory.java b/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegateFactory.java index 938f4b1e3e30..feed32596250 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegateFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/SurfaceDelegateFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/SystemClock.java b/ReactAndroid/src/main/java/com/facebook/react/common/SystemClock.java index 16fd7e768de2..e331962addbb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/SystemClock.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/SystemClock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/annotations/VisibleForTesting.java b/ReactAndroid/src/main/java/com/facebook/react/common/annotations/VisibleForTesting.java index c781c4f9f6a0..2b9e919775d4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/annotations/VisibleForTesting.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/annotations/VisibleForTesting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java b/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java index 093bd88c580a..70273030bbe8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/futures/SimpleSettableFuture.java b/ReactAndroid/src/main/java/com/facebook/react/common/futures/SimpleSettableFuture.java index 3f4bc073afd1..faab9a04efbe 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/futures/SimpleSettableFuture.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/futures/SimpleSettableFuture.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.java b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.java index f38ae42b07ad..cbcaf8169a4c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,36 +25,41 @@ public class ReadableMapBuffer implements Iterable>> SHORT_ONE); - final short midVal = readKey(getKeyOffsetForBucketIndex(mid)); + final int mid = (lo + hi) >>> 1; + final int midVal = readUnsignedShort(getKeyOffsetForBucketIndex(mid)); if (midVal < key) { - lo = (short) (mid + SHORT_ONE); + lo = mid + 1; } else if (midVal > key) { - hi = (short) (mid - SHORT_ONE); + hi = mid - 1; } else { return mid; } @@ -124,8 +109,34 @@ private int getBucketIndexForKey(short key) { return -1; } - private short readKey(int position) { - return mBuffer.getShort(position); + private DataType readDataType(int bucketIndex) { + int value = readUnsignedShort(getKeyOffsetForBucketIndex(bucketIndex) + TYPE_OFFSET); + return DataType.values()[value]; + } + + private int getTypedValueOffsetForKey(int key, DataType expected) { + int bucketIndex = getBucketIndexForKey(key); + DataType dataType = readDataType(bucketIndex); + if (bucketIndex == -1) { + throw new IllegalArgumentException("Key not found: " + key); + } + + if (dataType != expected) { + throw new IllegalStateException( + "Expected " + + expected + + " for key: " + + key + + " found " + + dataType.toString() + + " instead."); + } + + return getKeyOffsetForBucketIndex(bucketIndex) + VALUE_OFFSET; + } + + private int readUnsignedShort(int bufferPosition) { + return mBuffer.getShort(bufferPosition) & 0xFFFF; } private double readDoubleValue(int bufferPosition) { @@ -175,9 +186,7 @@ private void readHeader() { mBuffer.order(ByteOrder.LITTLE_ENDIAN); } // count - mCount = mBuffer.getShort(); - // size - mSizeOfData = mBuffer.getInt(); + mCount = readUnsignedShort(mBuffer.position()); } /** @@ -186,13 +195,24 @@ private void readHeader() { * @param key Key to search for * @return true if and only if the Key received as a parameter is stored in the MapBuffer. */ - public boolean hasKey(short key) { + public boolean hasKey(int key) { // TODO T83483191: Add tests return getBucketIndexForKey(key) != -1; } + @Nullable + public DataType getType(int key) { + int bucketIndex = getBucketIndexForKey(key); + + if (bucketIndex == -1) { + throw new IllegalArgumentException("Key not found: " + key); + } + + return readDataType(bucketIndex); + } + /** @return amount of elements stored into the MapBuffer */ - public short getCount() { + public int getCount() { importByteBufferAndReadHeader(); return mCount; } @@ -201,37 +221,36 @@ public short getCount() { * @param key {@link int} representing the key * @return return the int associated to the Key received as a parameter. */ - public int getInt(short key) { - // TODO T83483191: extract common code of "get methods" - return readIntValue(getValueOffsetForKey(key)); + public int getInt(int key) { + return readIntValue(getTypedValueOffsetForKey(key, DataType.INT)); } /** * @param key {@link int} representing the key * @return return the double associated to the Key received as a parameter. */ - public double getDouble(short key) { - return readDoubleValue(getValueOffsetForKey(key)); + public double getDouble(int key) { + return readDoubleValue(getTypedValueOffsetForKey(key, DataType.DOUBLE)); } /** * @param key {@link int} representing the key * @return return the int associated to the Key received as a parameter. */ - public String getString(short key) { - return readStringValue(getValueOffsetForKey(key)); + public String getString(int key) { + return readStringValue(getTypedValueOffsetForKey(key, DataType.STRING)); } - public boolean getBoolean(short key) { - return readBooleanValue(getValueOffsetForKey(key)); + public boolean getBoolean(int key) { + return readBooleanValue(getTypedValueOffsetForKey(key, DataType.BOOL)); } /** * @param key {@link int} representing the key * @return return the int associated to the Key received as a parameter. */ - public ReadableMapBuffer getMapBuffer(short key) { - return readMapBufferValue(getValueOffsetForKey(key)); + public ReadableMapBuffer getMapBuffer(int key) { + return readMapBufferValue(getTypedValueOffsetForKey(key, DataType.MAP)); } /** @@ -250,8 +269,8 @@ private ByteBuffer importByteBufferAndReadHeader() { return mBuffer; } - private void assertKeyExists(short key, int bucketIndex) { - short storedKey = mBuffer.getShort(getKeyOffsetForBucketIndex(bucketIndex)); + private void assertKeyExists(int key, int bucketIndex) { + int storedKey = readUnsignedShort(getKeyOffsetForBucketIndex(bucketIndex)); if (storedKey != key) { throw new IllegalStateException( "Stored key doesn't match parameter - expected: " + key + " - found: " + storedKey); @@ -286,8 +305,8 @@ public boolean equals(@Nullable Object obj) { @Override public Iterator iterator() { return new Iterator() { - short current = 0; - short last = (short) (getCount() - SHORT_ONE); + int current = 0; + final int last = getCount() - 1; @Override public boolean hasNext() { @@ -309,39 +328,61 @@ private MapBufferEntry(int position) { mBucketOffset = position; } + private void assertType(DataType expected) { + DataType dataType = getType(); + if (expected != dataType) { + throw new IllegalStateException( + "Expected " + + expected + + " for key: " + + getKey() + + " found " + + dataType.toString() + + " instead."); + } + } + /** @return a {@link short} that represents the key of this {@link MapBufferEntry}. */ - public short getKey() { - return readKey(mBucketOffset); + public int getKey() { + return readUnsignedShort(mBucketOffset); + } + + public DataType getType() { + return DataType.values()[readUnsignedShort(mBucketOffset + TYPE_OFFSET)]; } /** @return the double value that is stored in this {@link MapBufferEntry}. */ - public double getDouble(double defaultValue) { - // TODO T83483191 Extend serialization of MapBuffer to add type checking + public double getDouble() { // TODO T83483191 Extend serialization of MapBuffer to return null if there's no value // stored in this MapBufferEntry. - return readDoubleValue(mBucketOffset + KEY_SIZE); + assertType(DataType.DOUBLE); + return readDoubleValue(mBucketOffset + VALUE_OFFSET); } /** @return the int value that is stored in this {@link MapBufferEntry}. */ - public int getInt(int defaultValue) { - return readIntValue(mBucketOffset + KEY_SIZE); + public int getInt() { + assertType(DataType.INT); + return readIntValue(mBucketOffset + VALUE_OFFSET); } /** @return the boolean value that is stored in this {@link MapBufferEntry}. */ - public boolean getBoolean(boolean defaultValue) { - return readBooleanValue(mBucketOffset + KEY_SIZE); + public boolean getBoolean() { + assertType(DataType.BOOL); + return readBooleanValue(mBucketOffset + VALUE_OFFSET); } /** @return the String value that is stored in this {@link MapBufferEntry}. */ public @Nullable String getString() { - return readStringValue(mBucketOffset + KEY_SIZE); + assertType(DataType.STRING); + return readStringValue(mBucketOffset + VALUE_OFFSET); } /** * @return the {@link ReadableMapBuffer} value that is stored in this {@link MapBufferEntry}. */ public @Nullable ReadableMapBuffer getReadableMapBuffer() { - return readMapBufferValue(mBucketOffset + KEY_SIZE); + assertType(DataType.MAP); + return readMapBufferValue(mBucketOffset + VALUE_OFFSET); } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBufferSoLoader.java b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBufferSoLoader.java index d38c3a11ea3a..b03ef0f8b06a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBufferSoLoader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/ReadableMapBufferSoLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/Android.mk index f29eb0137c00..b9f147cb7e6e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,8 +10,20 @@ include $(CLEAR_VARS) LOCAL_MODULE := mapbufferjni LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/react/common/mapbuffer/*.cpp) - -LOCAL_SHARED_LIBRARIES := libreactconfig libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures libreact_utils libreact_render_mapbuffer libreact_debug +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) + +LOCAL_SHARED_LIBRARIES := \ + libfb \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog \ + libglog_init \ + libreact_debug \ + libreact_render_mapbuffer \ + libreact_utils \ + libreact_config \ + libyoga LOCAL_STATIC_LIBRARIES := diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/OnLoad.cpp index 76e0aa1a2c87..070ab4358520 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.cpp b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.cpp index 83d856abd0a9..2a6d305e91f4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,36 +13,10 @@ namespace react { void ReadableMapBuffer::registerNatives() { registerHybrid({ makeNativeMethod("importByteBuffer", ReadableMapBuffer::importByteBuffer), - makeNativeMethod( - "importByteBufferAllocateDirect", - ReadableMapBuffer::importByteBufferAllocateDirect), }); } -jni::local_ref -ReadableMapBuffer::importByteBufferAllocateDirect() { - // TODO T83483191: Using this method is safer than "importByteBuffer" because - // ByteBuffer memory will be deallocated once the "Java ByteBuffer" is - // deallocated. Next steps: - // - Validate perf of this method vs importByteBuffer - // - Validate that there's no leaking of memory - react_native_assert( - (serializedData_ != nullptr && serializedDataSize_ != 0) && - "Error serializedData_ is not initialized"); - auto ret = jni::JByteBuffer::allocateDirect(serializedDataSize_); - // TODO T83483191: avoid allocating serializedData_ when using - // JByteBuffer::allocateDirect - std::memcpy( - ret->getDirectBytes(), (void *)serializedData_, serializedDataSize_); - - // Deallocate serializedData_ since it's not necessary anymore - delete[] serializedData_; - serializedData_ = nullptr; - serializedDataSize_ = 0; - return ret; -} - -jni::JByteBuffer::javaobject ReadableMapBuffer::importByteBuffer() { +jni::local_ref ReadableMapBuffer::importByteBuffer() { // TODO T83483191: Reevaluate what's the best approach here (allocateDirect vs // DirectByteBuffer). // @@ -55,9 +29,8 @@ jni::JByteBuffer::javaobject ReadableMapBuffer::importByteBuffer() { // - Add flags to describe if the data was already 'imported' // - Long-term: Consider creating a big ByteBuffer that can be re-used to // transfer data of multitple Maps - return static_cast( - jni::Environment::current()->NewDirectByteBuffer( - (void *)serializedData_, serializedDataSize_)); + return jni::JByteBuffer::wrapBytes( + serializedData_.data(), serializedData_.size()); } jni::local_ref @@ -65,11 +38,10 @@ ReadableMapBuffer::createWithContents(MapBuffer &&map) { return newObjectCxxArgs(std::move(map)); } -ReadableMapBuffer::~ReadableMapBuffer() { - if (serializedData_ != nullptr) { - delete[] serializedData_; - serializedData_ = nullptr; - } +ReadableMapBuffer::ReadableMapBuffer(MapBuffer &&map) + : serializedData_(std::move(map.bytes_)) { + react_native_assert( + (serializedData_.size() != 0) && "Error no content in map"); } } // namespace react diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.h b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.h index b3f753a67b17..24452a71a2fc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.h +++ b/ReactAndroid/src/main/java/com/facebook/react/common/mapbuffer/jni/react/common/mapbuffer/ReadableMapBuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,28 +23,15 @@ class ReadableMapBuffer : public jni::HybridClass { static void registerNatives(); - static jni::local_ref createWithContents(MapBuffer &&map); + static jni::local_ref createWithContents( + MapBuffer &&map); - jni::local_ref importByteBufferAllocateDirect(); + explicit ReadableMapBuffer(MapBuffer &&map); - jni::JByteBuffer::javaobject importByteBuffer(); - - ~ReadableMapBuffer(); + jni::local_ref importByteBuffer(); private: - uint8_t *serializedData_ = nullptr; - - int32_t serializedDataSize_ = 0; - - friend HybridBase; - - explicit ReadableMapBuffer(MapBuffer &&map) { - serializedDataSize_ = map.getBufferSize(); - react_native_assert( - (serializedDataSize_ != 0) && "Error no content in map"); - serializedData_ = new Byte[serializedDataSize_]; - map.copy(serializedData_); - } + std::vector serializedData_; }; } // namespace react diff --git a/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java b/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java index baddd3ae2fe0..b581f14c7a66 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/common/network/OkHttpCallUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 446ea326ac96..bed0f4905422 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -64,9 +64,6 @@ public class ReactFeatureFlags { /** This feature flag enables logs for Fabric */ public static boolean enableFabricLogs = false; - /** Feature flag to configure eager initialization of Fabric */ - public static boolean eagerInitializeFabric = false; - /** Enables Static ViewConfig in RN Android native code. */ public static boolean enableExperimentalStaticViewConfigs = false; @@ -74,11 +71,8 @@ public class ReactFeatureFlags { public static boolean enableRuntimeSchedulerInTurboModule = false; - /** Enables a more aggressive cleanup during destruction of ReactContext */ - public static boolean enableReactContextCleanupFix = false; - - /** Feature flag to configure eager initialization of MapBuffer So file */ - public static boolean enableEagerInitializeMapBufferSoFile = false; + /** Feature flag to configure eager attachment of the root view/initialisation of the JS code */ + public static boolean enableEagerRootViewAttachment = false; private static boolean mapBufferSerializationEnabled = false; @@ -91,8 +85,16 @@ public static boolean isMapBufferSerializationEnabled() { return mapBufferSerializationEnabled; } - /** Enables Fabric for LogBox */ - public static boolean enableFabricInLogBox = false; + /** Feature Flag to use overflowInset values provided by Yoga */ + private static boolean useOverflowInset = false; + + public static void setUseOverflowInset(boolean enabled) { + useOverflowInset = enabled; + } + + public static boolean doesUseOverflowInset() { + return useOverflowInset; + } public static boolean enableLockFreeEventDispatcher = false; @@ -100,9 +102,6 @@ public static boolean isMapBufferSerializationEnabled() { public static boolean insertZReorderBarriersOnViewGroupChildren = true; - public static boolean enableScrollViewSnapToAlignmentProp = true; - - public static boolean useDispatchUniqueForCoalescableEvents = false; - - public static boolean useUpdatedTouchPreprocessing = false; + /** TODO: T107492383 Delete this flag. Enables postprocessor for rounded corners for Image */ + public static boolean enableRoundedCornerPostprocessing = false; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java index 30c0840f90df..159bf3198955 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BridgeDevSupportManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -58,7 +58,7 @@ * * IMPORTANT: In order for developer support to work correctly it is required that the * manifest of your application contain the following entries: - * {@code } + * {@code } * {@code } */ public final class BridgeDevSupportManager extends DevSupportManagerBase { @@ -99,11 +99,7 @@ public BridgeDevSupportManager( } addCustomDevOption( - mIsSamplingProfilerEnabled - ? applicationContext.getString( - com.facebook.react.R.string.catalyst_sample_profiler_disable) - : applicationContext.getString( - com.facebook.react.R.string.catalyst_sample_profiler_enable), + mIsSamplingProfilerEnabled ? "Disable Sampling Profiler" : "Enable Sampling Profiler", new DevOptionHandler() { @Override public void onOptionSelected() { diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java index ec4aa94fa370..6a4b50e04ade 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java index 8db1cd33eb8d..a70d44a9b70e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DebugOverlayController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.java index 0ef0ca065557..6459c219ad45 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DefaultDevSupportManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java index b63b37cdc9ce..a6e67bf56ed1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevInternalSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java index 9b9b32e01d8c..db8ef299fc67 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevLoadingViewController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java index 121a4bd7b474..e16de601218a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevServerHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSettingsActivity.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSettingsActivity.java index 49298e73c181..caa555f76b0d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSettingsActivity.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSettingsActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java index 3fed94df3f3e..f4d0e82dddc8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java index 8bdfe8dd1a6a..131f4462fb04 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java index 3d54a3db40f8..c198ac1610b0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DisabledDevSupportManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DoubleTapReloadRecognizer.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DoubleTapReloadRecognizer.java index cd8d9dc6b137..b178267dd0b9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/DoubleTapReloadRecognizer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/DoubleTapReloadRecognizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/FpsView.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/FpsView.java index 62a1fa1df2fd..6377c7978ee5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/FpsView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/FpsView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/HMRClient.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/HMRClient.java index e10cdb81fd15..7807ef449018 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/HMRClient.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/HMRClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java index 6e101fc3844d..b3cf5afcf098 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/InspectorPackagerConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapCapture.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapCapture.java index 2880da778455..7e50b6546f12 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapCapture.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSCHeapCapture.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java index 83772aecf5ea..a18fa47802f4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDebuggerWebSocketClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDevSupport.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDevSupport.java index 1b3c60f98508..4ea6a82c7c98 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDevSupport.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSDevSupport.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSException.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSException.java index 0109893a91df..7acb46d22fb0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/JSException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialog.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialog.java index c6a5b80e8dde..40a3ba47fd21 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialog.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.java index 1a40476c8411..c9668d29f806 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxDialogSurfaceDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxModule.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxModule.java index 1fc7b8b56d6a..609f7ad267b1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/LogBoxModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/MultipartStreamReader.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/MultipartStreamReader.java index 874508a928bf..e93216a4ffde 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/MultipartStreamReader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/MultipartStreamReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.java index b83ca3ece7f5..0814a12dea93 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/PackagerStatusCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReactInstanceDevHelper.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReactInstanceDevHelper.java index 242b0a62fce7..7f6ef278be4a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReactInstanceDevHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/ReactInstanceDevHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java index f23aa04cab5d..ca214e4cace2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java index 9791b7fde474..597caf2f8602 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/RedBoxHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java index 053a6e8dd927..a40b0c120954 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/ViewHierarchyUtil.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/ViewHierarchyUtil.java index 3aa3d618c349..1897e2ec83bb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/ViewHierarchyUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/ViewHierarchyUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java index e993205ee7f9..070df696e9b2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/WebsocketJavaScriptExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/WindowOverlayCompat.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/WindowOverlayCompat.java index 0520350b1064..cda48b06c25f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/WindowOverlayCompat.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/WindowOverlayCompat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java index 40495dfdbf93..4fd1cbf5054a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/BundleLoadCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevBundleDownloadListener.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevBundleDownloadListener.java index 8ee566238df8..0cd5ff8391b0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevBundleDownloadListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevBundleDownloadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java index 3801bb1c6b07..e66c867687ef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevOptionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSplitBundleCallback.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSplitBundleCallback.java index f9672ccf13ef..c2761d3fc813 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSplitBundleCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSplitBundleCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java index 183f58868b6f..f830561f6775 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/DevSupportManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorCustomizer.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorCustomizer.java index 715cee57f378..416869025472 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorCustomizer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorCustomizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorType.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorType.java index 2b5a1884b54a..6569931ed9ca 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/ErrorType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java index e0cd1743baa9..92af512e948a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/PackagerStatusCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java index 89b233c13c66..1f5207c6564f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java +++ b/ReactAndroid/src/main/java/com/facebook/react/devsupport/interfaces/StackFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java index 6ad92742b864..a46b65c27ce4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/Binding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java index de377f4af0e1..1c9974ef7659 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/ComponentFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/CoreComponentsRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/CoreComponentsRegistry.java index 6c6e9c04ce6c..2fa95f0a89b6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/CoreComponentsRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/CoreComponentsRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/EmptyReactNativeConfig.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/EmptyReactNativeConfig.java new file mode 100644 index 000000000000..ce34e5b3c51a --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/EmptyReactNativeConfig.java @@ -0,0 +1,35 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.fabric; + +/** + * An empty {@link ReactNativeConfig} that is returning empty responses and false for all the + * requested keys. + */ +public class EmptyReactNativeConfig implements ReactNativeConfig { + + @Override + public boolean getBool(final String s) { + return false; + } + + @Override + public int getInt64(final String s) { + return 0; + } + + @Override + public String getString(final String s) { + return ""; + } + + @Override + public double getDouble(final String s) { + return 0; + } +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java index 73d2c6f59bf2..315a7da787eb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricComponents.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java index 811514772d3c..1dfe46d75f40 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricJSIModuleProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -45,7 +45,7 @@ public UIManager get() { Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.registerBinding"); final Binding binding = new Binding(); - if (ReactFeatureFlags.enableEagerInitializeMapBufferSoFile) { + if (ReactFeatureFlags.isMapBufferSerializationEnabled()) { ReadableMapBufferSoLoader.staticInit(); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricSoLoader.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricSoLoader.java index 0e4529c85758..26526701c51e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricSoLoader.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricSoLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 270b9466b0d3..8e2b4402de58 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -213,7 +213,7 @@ public int addRootView( ThemedReactContext reactContext = new ThemedReactContext( mReactApplicationContext, rootView.getContext(), reactRootView.getSurfaceID(), rootTag); - mMountingManager.startSurface(rootTag, rootView, reactContext); + mMountingManager.startSurface(rootTag, reactContext, rootView); String moduleName = reactRootView.getJSModuleName(); if (ENABLE_FABRIC_LOGS) { FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag); @@ -271,7 +271,7 @@ public int startSurface( if (ENABLE_FABRIC_LOGS) { FLog.d(TAG, "Starting surface for module: %s and reactTag: %d", moduleName, rootTag); } - mMountingManager.startSurface(rootTag, rootView, reactContext); + mMountingManager.startSurface(rootTag, reactContext, rootView); // If startSurface is executed in the UIThread then, it uses the ViewportOffset from the View, // Otherwise Fabric relies on calling {@link Binding#setConstraints} method to update the @@ -295,18 +295,14 @@ public int startSurface( return rootTag; } - public void startSurface(final SurfaceHandler surfaceHandler, final @Nullable View rootView) { + public void startSurface( + final SurfaceHandler surfaceHandler, final Context context, final @Nullable View rootView) { final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag(); - if (rootView == null) { - mMountingManager.startSurface(rootTag); - } else { - Context context = rootView.getContext(); - ThemedReactContext reactContext = - new ThemedReactContext( - mReactApplicationContext, context, surfaceHandler.getModuleName(), rootTag); - mMountingManager.startSurface(rootTag, rootView, reactContext); - } + ThemedReactContext reactContext = + new ThemedReactContext( + mReactApplicationContext, context, surfaceHandler.getModuleName(), rootTag); + mMountingManager.startSurface(rootTag, reactContext, rootView); surfaceHandler.setSurfaceId(rootTag); if (surfaceHandler instanceof SurfaceHandlerBinding) { @@ -559,6 +555,11 @@ public boolean getThemeData(int surfaceId, float[] defaultTextInputPadding) { SurfaceMountingManager surfaceMountingManager = mMountingManager.getSurfaceManagerEnforced(surfaceId, "getThemeData"); ThemedReactContext themedReactContext = surfaceMountingManager.getContext(); + + if (themedReactContext == null) { + FLog.w(TAG, "\"themedReactContext\" is null when call \"getThemeData\""); + return false; + } float[] defaultTextInputPaddingForTheme = UIManagerHelper.getDefaultTextInputPadding(themedReactContext); defaultTextInputPadding[0] = defaultTextInputPaddingForTheme[PADDING_START_INDEX]; @@ -715,6 +716,7 @@ private void scheduleMountItem( // When Binding.cpp calls scheduleMountItems during a commit phase, it always calls with // a BatchMountItem. No other sites call into this with a BatchMountItem, and Binding.cpp only // calls scheduleMountItems with a BatchMountItem. + long scheduleMountItemStartTime = SystemClock.uptimeMillis(); boolean isBatchMountItem = mountItem instanceof IntBufferBatchMountItem; boolean shouldSchedule = (isBatchMountItem && ((IntBufferBatchMountItem) mountItem).shouldSchedule()) @@ -730,7 +732,7 @@ private void scheduleMountItem( mCommitStartTime = commitStartTime; mLayoutTime = layoutEndTime - layoutStartTime; mFinishTransactionCPPTime = finishTransactionEndTime - finishTransactionStartTime; - mFinishTransactionTime = SystemClock.uptimeMillis() - finishTransactionStartTime; + mFinishTransactionTime = scheduleMountItemStartTime - finishTransactionStartTime; mDispatchViewUpdatesTime = SystemClock.uptimeMillis(); } @@ -765,6 +767,23 @@ private void scheduleMountItem( ReactMarker.logFabricMarker( ReactMarkerConstants.FABRIC_LAYOUT_END, null, commitNumber, layoutEndTime); ReactMarker.logFabricMarker(ReactMarkerConstants.FABRIC_COMMIT_END, null, commitNumber); + + if (ENABLE_FABRIC_LOGS) { + FLog.i( + TAG, + "Statistic of Fabric commit #: " + + commitNumber + + "\n - Total commit time: " + + (finishTransactionEndTime - commitStartTime) + + " ms.\n - Layout: " + + mLayoutTime + + " ms.\n - Diffing: " + + (diffEndTime - diffStartTime) + + " ms.\n" + + " - FinishTransaction (Diffing + Processing + Serialization of MountingInstructions): " + + mFinishTransactionCPPTime + + " ms."); + } } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/GuardedFrameCallback.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/GuardedFrameCallback.java index 0b426c293988..1ab29715c9f0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/GuardedFrameCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/GuardedFrameCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/ReactNativeConfig.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/ReactNativeConfig.java index a211cec1f3fb..b4938fb572ec 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/ReactNativeConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/ReactNativeConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,7 +10,16 @@ import androidx.annotation.NonNull; import com.facebook.proguard.annotations.DoNotStrip; -// This is a wrapper for the ReactNativeConfig object in C++ +/** + * ReactNative Configuration that allows to customize the behavior of key/value pairs used by the + * framework to enable/disable capabilities. + * + *

The hosting app should provide an implementation of this interface to allow specific + * customization of single keys. An empty implementation is available as {@link + * EmptyReactNativeConfig}. + * + *

This is a wrapper for the ReactNativeConfig object in C++ + */ @DoNotStrip public interface ReactNativeConfig { /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/StateWrapperImpl.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/StateWrapperImpl.java index 821dff8a5fdf..c42e13ce407b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/StateWrapperImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/StateWrapperImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandler.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandler.java index 8a2a482c379a..19b3ff7739fe 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandlerBinding.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandlerBinding.java index 2683c5746db3..0cefe448a2d4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandlerBinding.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/SurfaceHandlerBinding.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java index b582be2c0202..f67dd8716715 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventBeatManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java index 24d33be42f32..ecb984b54b5f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/events/EventEmitterWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java index 983466ab3823..d02d7c96533b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/events/FabricEventEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,27 +7,16 @@ package com.facebook.react.fabric.events; -import static com.facebook.react.uimanager.events.TouchesHelper.CHANGED_TOUCHES_KEY; -import static com.facebook.react.uimanager.events.TouchesHelper.TARGET_KEY; -import static com.facebook.react.uimanager.events.TouchesHelper.TARGET_SURFACE_KEY; -import static com.facebook.react.uimanager.events.TouchesHelper.TOUCHES_KEY; - -import android.util.Pair; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.facebook.common.logging.FLog; -import com.facebook.react.bridge.ReadableMap; import com.facebook.react.bridge.WritableArray; import com.facebook.react.bridge.WritableMap; -import com.facebook.react.bridge.WritableNativeArray; -import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.fabric.FabricUIManager; import com.facebook.react.uimanager.events.EventCategoryDef; import com.facebook.react.uimanager.events.RCTModernEventEmitter; -import com.facebook.react.uimanager.events.TouchEventType; +import com.facebook.react.uimanager.events.TouchEvent; +import com.facebook.react.uimanager.events.TouchesHelper; import com.facebook.systrace.Systrace; -import java.util.HashSet; -import java.util.Set; public class FabricEventEmitter implements RCTModernEventEmitter { @@ -67,145 +56,17 @@ public void receiveEvent( Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } - /** - * Processes touches in a JS compatible way and send it to Fabric core - * - * @param eventName the event name (see {@link TouchEventType}) - * @param touches all the touch data extracted from MotionEvent - * @param changedIndices the indices of the pointers that changed (MOVE/CANCEL includes all - * touches, START/END only the one that was added/removed) - */ + /** Touches are dispatched by {@link #receiveTouches(TouchEvent)} */ @Override public void receiveTouches( @NonNull String eventName, @NonNull WritableArray touches, @NonNull WritableArray changedIndices) { - Systrace.beginSection( - Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, - "FabricEventEmitter.receiveTouches('" + eventName + "')"); - - boolean isFinalEvent = - TouchEventType.END.getJsName().equalsIgnoreCase(eventName) - || TouchEventType.CANCEL.getJsName().equalsIgnoreCase(eventName); - - Pair result = - isFinalEvent - ? removeTouchesAtIndices(touches, changedIndices) - : touchSubsequence(touches, changedIndices); - - WritableArray changedTouches = result.first; - touches = result.second; - - int eventCategory = getTouchCategory(eventName); - for (int jj = 0; jj < changedTouches.size(); jj++) { - WritableMap touch = getWritableMap(changedTouches.getMap(jj)); - // Touch objects can fulfill the role of `DOM` `Event` objects if we set - // the `changedTouches`/`touches`. This saves allocations. - - touch.putArray(CHANGED_TOUCHES_KEY, copyWritableArray(changedTouches)); - touch.putArray(TOUCHES_KEY, copyWritableArray(touches)); - WritableMap nativeEvent = touch; - int rootNodeID = 0; - int targetSurfaceId = nativeEvent.getInt(TARGET_SURFACE_KEY); - int targetReactTag = nativeEvent.getInt(TARGET_KEY); - if (targetReactTag < 1) { - FLog.e(TAG, "A view is reporting that a touch occurred on tag zero."); - } else { - rootNodeID = targetReactTag; - } - - receiveEvent(targetSurfaceId, rootNodeID, eventName, false, 0, touch, eventCategory); - } - - Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); + throw new IllegalStateException("EventEmitter#receiveTouches is not supported by Fabric"); } - /** TODO T31905686 optimize this to avoid copying arrays */ - private WritableArray copyWritableArray(@NonNull WritableArray array) { - WritableNativeArray ret = new WritableNativeArray(); - for (int i = 0; i < array.size(); i++) { - ret.pushMap(getWritableMap(array.getMap(i))); - } - return ret; - } - - /** - * Destroys `touches` by removing touch objects at indices `indices`. This is to maintain - * compatibility with W3C touch "end" events, where the active touches don't include the set that - * has just been "ended". - * - *

This method was originally in ReactNativeRenderer.js - * - *

TODO: this method is a copy from ReactNativeRenderer.removeTouchesAtIndices and it needs to - * be rewritten in a more efficient way, - * - * @param touches {@link WritableArray} Deserialized touch objects. - * @param indices {WritableArray} Indices to remove from `touches`. - * @return {Array} Subsequence of removed touch objects. - */ - private @NonNull Pair removeTouchesAtIndices( - @NonNull WritableArray touches, @NonNull WritableArray indices) { - WritableArray rippedOut = new WritableNativeArray(); - // use an unsafe downcast to alias to nullable elements, - // so we can delete and then compact. - WritableArray tempTouches = new WritableNativeArray(); - Set rippedOutIndices = new HashSet<>(); - for (int i = 0; i < indices.size(); i++) { - int index = indices.getInt(i); - rippedOut.pushMap(getWritableMap(touches.getMap(index))); - rippedOutIndices.add(index); - } - for (int j = 0; j < touches.size(); j++) { - if (!rippedOutIndices.contains(j)) { - tempTouches.pushMap(getWritableMap(touches.getMap(j))); - } - } - - return new Pair<>(rippedOut, tempTouches); - } - - /** - * Selects a subsequence of `Touch`es, without destroying `touches`. - * - *

This method was originally in ReactNativeRenderer.js - * - * @param touches {@link WritableArray} Deserialized touch objects. - * @param changedIndices {@link WritableArray} Indices by which to pull subsequence. - * @return {Array} Subsequence of touch objects. - */ - private @NonNull Pair touchSubsequence( - @NonNull WritableArray touches, @NonNull WritableArray changedIndices) { - WritableArray result = new WritableNativeArray(); - for (int i = 0; i < changedIndices.size(); i++) { - result.pushMap(getWritableMap(touches.getMap(changedIndices.getInt(i)))); - } - return new Pair<>(result, touches); - } - - /** - * TODO: this is required because the WritableNativeArray.getMap() returns a ReadableMap instead - * of the original writableMap. this will change in the near future. - * - * @param readableMap {@link ReadableMap} source map - */ - private @NonNull WritableMap getWritableMap(@NonNull ReadableMap readableMap) { - WritableNativeMap map = new WritableNativeMap(); - map.merge(readableMap); - return map; - } - - @EventCategoryDef - private static int getTouchCategory(String touchEventType) { - int category = EventCategoryDef.UNSPECIFIED; - if (TouchEventType.MOVE.getJsName().equals(touchEventType)) { - category = EventCategoryDef.CONTINUOUS; - } else if (TouchEventType.START.getJsName().equals(touchEventType)) { - category = EventCategoryDef.CONTINUOUS_START; - } else if (TouchEventType.END.getJsName().equals(touchEventType) - || TouchEventType.CANCEL.getJsName().equals(touchEventType)) { - category = EventCategoryDef.CONTINUOUS_END; - } - - return category; + @Override + public void receiveTouches(TouchEvent event) { + TouchesHelper.sendTouchEvent(this, event); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk index 1c2bde705d6f..8ccb5c2a0d60 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,10 +10,52 @@ include $(CLEAR_VARS) LOCAL_MODULE := fabricjni LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) -LOCAL_SHARED_LIBRARIES := libjsi libreactconfig librrc_slider librrc_progressbar librrc_switch librrc_modal libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures libreact_render_mounting libreactnativeutilsjni libreact_utils libreact_render_debug libreact_render_graphics libreact_render_core react_render_componentregistry librrc_view librrc_unimplementedview librrc_root librrc_scrollview libbetter libreact_render_attributedstring libreact_render_uimanager libreact_render_templateprocessor libreact_render_scheduler libreact_render_animations libreact_render_imagemanager libreact_render_textlayoutmanager libreact_codegen_rncore rrc_text librrc_image librrc_textinput libreact_debug libreact_render_mapbuffer libmapbufferjni libreact_render_telemetry libreact_render_runtimescheduler +LOCAL_SHARED_LIBRARIES := \ + libbutter \ + libfb \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog \ + libglog_init \ + libjsi \ + libmapbufferjni \ + libreact_codegen_rncore \ + libreact_debug \ + libreact_render_animations \ + libreact_render_attributedstring \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_imagemanager \ + libreact_render_mapbuffer \ + libreact_render_mounting \ + libreact_render_runtimescheduler \ + libreact_render_scheduler \ + libreact_render_telemetry \ + libreact_render_templateprocessor \ + libreact_render_textlayoutmanager \ + libreact_render_uimanager \ + libreact_utils \ + libreact_config \ + libreactnativejni \ + librrc_image \ + librrc_root \ + librrc_unimplementedview \ + librrc_view \ + libyoga \ + react_render_componentregistry \ + rrc_text -LOCAL_STATIC_LIBRARIES := +LOCAL_STATIC_LIBRARIES := \ + librrc_slider \ + librrc_progressbar \ + librrc_switch \ + librrc_modal \ + librrc_scrollview \ + librrc_textinput LOCAL_C_INCLUDES := $(LOCAL_PATH)/ diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h index ee02ffc31d85..072de4e255a8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,8 +25,8 @@ class AsyncEventBeat final : public EventBeat, public EventBeatManagerObserver { jni::global_ref javaUIManager) : EventBeat(ownerBox), eventBeatManager_(eventBeatManager), - runtimeExecutor_(runtimeExecutor), - javaUIManager_(javaUIManager) { + runtimeExecutor_(std::move(runtimeExecutor)), + javaUIManager_(std::move(javaUIManager)) { eventBeatManager->addObserver(*this); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.cpp index 1d9b2dd27f2f..3bf94580a2f4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,8 +20,8 @@ AsyncEventBeatV2::AsyncEventBeatV2( jni::global_ref javaUIManager) : EventBeat(ownerBox), eventBeatManager_(eventBeatManager), - runtimeExecutor_(runtimeExecutor), - javaUIManager_(javaUIManager) { + runtimeExecutor_(std::move(runtimeExecutor)), + javaUIManager_(std::move(javaUIManager)) { eventBeatManager->addObserver(*this); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.h index acd682f4cd85..569af7c96cd7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK index 7ea630148b4c..2957f8fbe94c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/BUCK @@ -11,8 +11,8 @@ rn_xplat_cxx_library( ], prefix = "react/fabric", ), - compiler_flags_enable_exceptions = True, - compiler_flags_enable_rtti = True, # dynamic_cast used within Binding.cpp + compiler_flags_enable_exceptions = False, + compiler_flags_enable_rtti = False, # for YogaLayoutableShadowNode? fbandroid_allow_jni_merging = True, labels = ["supermodule:xplat/default/public.react_native.infra"], platforms = ANDROID, @@ -28,6 +28,7 @@ rn_xplat_cxx_library( react_native_xplat_target("react/renderer/animations:animations"), react_native_xplat_target("react/renderer/uimanager:uimanager"), react_native_xplat_target("react/renderer/scheduler:scheduler"), + react_native_xplat_target("react/renderer/mounting:mounting"), react_native_xplat_target("react/renderer/componentregistry:componentregistry"), react_native_xplat_target("react/renderer/components/scrollview:scrollview"), react_native_xplat_target("runtimeexecutor:runtimeexecutor"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp index 79b6c1ccf3a8..c8dde14b5287 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -39,197 +39,14 @@ using namespace facebook::jsi; namespace facebook { namespace react { -namespace { - -struct JMountItem : public JavaClass { - static constexpr auto kJavaDescriptor = - "Lcom/facebook/react/fabric/mounting/mountitems/MountItem;"; -}; - -} // namespace - -CppMountItem CppMountItem::CreateMountItem(ShadowView shadowView) { - return {CppMountItem::Type::Create, {}, {}, shadowView, -1}; -} -CppMountItem CppMountItem::DeleteMountItem(ShadowView shadowView) { - return {CppMountItem::Type::Delete, {}, shadowView, {}, -1}; -} -CppMountItem CppMountItem::InsertMountItem( - ShadowView parentView, - ShadowView shadowView, - int index) { - return {CppMountItem::Type::Insert, parentView, {}, shadowView, index}; -} -CppMountItem CppMountItem::RemoveMountItem( - ShadowView parentView, - ShadowView shadowView, - int index) { - return {CppMountItem::Type::Remove, parentView, shadowView, {}, index}; -} -CppMountItem CppMountItem::UpdatePropsMountItem(ShadowView shadowView) { - return {CppMountItem::Type::UpdateProps, {}, {}, shadowView, -1}; -} -CppMountItem CppMountItem::UpdateStateMountItem(ShadowView shadowView) { - return {CppMountItem::Type::UpdateState, {}, {}, shadowView, -1}; -} -CppMountItem CppMountItem::UpdateLayoutMountItem(ShadowView shadowView) { - return {CppMountItem::Type::UpdateLayout, {}, {}, shadowView, -1}; -} -CppMountItem CppMountItem::UpdateEventEmitterMountItem(ShadowView shadowView) { - return {CppMountItem::Type::UpdateEventEmitter, {}, {}, shadowView, -1}; -} -CppMountItem CppMountItem::UpdatePaddingMountItem(ShadowView shadowView) { - return {CppMountItem::Type::UpdatePadding, {}, {}, shadowView, -1}; -} - -static inline int getIntBufferSizeForType(CppMountItem::Type mountItemType) { - if (mountItemType == CppMountItem::Type::Create) { - return 2; // tag, isLayoutable - } else if (mountItemType == CppMountItem::Type::Insert) { - return 3; // tag, parentTag, index - } else if (mountItemType == CppMountItem::Type::Remove) { - return 3; // tag, parentTag, index - } else if (mountItemType == CppMountItem::Type::Delete) { - return 1; // tag - } else if (mountItemType == CppMountItem::Type::UpdateProps) { - return 1; // tag - } else if (mountItemType == CppMountItem::Type::UpdateState) { - return 1; // tag - } else if (mountItemType == CppMountItem::Type::UpdatePadding) { - return 5; // tag, top, left, bottom, right - } else if (mountItemType == CppMountItem::Type::UpdateLayout) { - return 6; // tag, x, y, w, h, DisplayType - } else if (mountItemType == CppMountItem::Type::UpdateEventEmitter) { - return 1; // tag - } else { - return -1; - } -} - -static inline void updateBufferSizes( - CppMountItem::Type mountItemType, - int numInstructions, - int &batchMountItemIntsSize, - int &batchMountItemObjectsSize) { - if (numInstructions == 0) { - return; - } - - batchMountItemIntsSize += - numInstructions == 1 ? 1 : 2; // instructionType[, numInstructions] - batchMountItemIntsSize += - numInstructions * getIntBufferSizeForType(mountItemType); - - if (mountItemType == CppMountItem::Type::UpdateProps) { - batchMountItemObjectsSize += - numInstructions; // props object * numInstructions - } else if (mountItemType == CppMountItem::Type::UpdateState) { - batchMountItemObjectsSize += - numInstructions; // state object * numInstructions - } else if (mountItemType == CppMountItem::Type::UpdateEventEmitter) { - batchMountItemObjectsSize += - numInstructions; // EventEmitter object * numInstructions - } -} - -static inline void computeBufferSizes( - int &batchMountItemIntsSize, - int &batchMountItemObjectsSize, - std::vector &cppCommonMountItems, - std::vector &cppDeleteMountItems, - std::vector &cppUpdatePropsMountItems, - std::vector &cppUpdateStateMountItems, - std::vector &cppUpdatePaddingMountItems, - std::vector &cppUpdateLayoutMountItems, - std::vector &cppUpdateEventEmitterMountItems) { - CppMountItem::Type lastType = CppMountItem::Type::Undefined; - int numSameType = 0; - for (const auto &mountItem : cppCommonMountItems) { - const auto &mountItemType = mountItem.type; - - if (lastType == mountItemType) { - numSameType++; - if (numSameType == 2) { - batchMountItemIntsSize += 1; // numInstructions - } - } else { - numSameType = 1; - lastType = mountItemType; - batchMountItemIntsSize += 1; // instructionType - } - - batchMountItemIntsSize += getIntBufferSizeForType(mountItemType); - if (mountItemType == CppMountItem::Type::Create) { - batchMountItemObjectsSize += - 4; // component name, props, state, event emitter - } - } - - updateBufferSizes( - CppMountItem::Type::UpdateProps, - cppUpdatePropsMountItems.size(), - batchMountItemIntsSize, - batchMountItemObjectsSize); - updateBufferSizes( - CppMountItem::Type::UpdateState, - cppUpdateStateMountItems.size(), - batchMountItemIntsSize, - batchMountItemObjectsSize); - updateBufferSizes( - CppMountItem::Type::UpdatePadding, - cppUpdatePaddingMountItems.size(), - batchMountItemIntsSize, - batchMountItemObjectsSize); - updateBufferSizes( - CppMountItem::Type::UpdateLayout, - cppUpdateLayoutMountItems.size(), - batchMountItemIntsSize, - batchMountItemObjectsSize); - updateBufferSizes( - CppMountItem::Type::UpdateEventEmitter, - cppUpdateEventEmitterMountItems.size(), - batchMountItemIntsSize, - batchMountItemObjectsSize); - updateBufferSizes( - CppMountItem::Type::Delete, - cppDeleteMountItems.size(), - batchMountItemIntsSize, - batchMountItemObjectsSize); -} - -static inline void writeIntBufferTypePreamble( - int mountItemType, - int numItems, - _JNIEnv *env, - jintArray &intBufferArray, - int &intBufferPosition) { - jint temp[2]; - if (numItems == 1) { - temp[0] = mountItemType; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); - intBufferPosition += 1; - } else { - temp[0] = mountItemType | CppMountItem::Type::Multiple; - temp[1] = numItems; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp); - intBufferPosition += 2; - } -} - jni::local_ref Binding::initHybrid( jni::alias_ref) { return makeCxxInstance(); } -// Thread-safe getter -jni::global_ref Binding::getJavaUIManager() { - std::lock_guard uiManagerLock(javaUIManagerMutex_); - return javaUIManager_; -} - // Thread-safe getter std::shared_ptr Binding::getScheduler() { - std::lock_guard lock(schedulerMutex_); + std::shared_lock lock(installMutex_); return scheduler_; } @@ -254,13 +71,34 @@ Binding::getInspectorDataForInstance( result["selectedIndex"] = data.selectedIndex; result["props"] = data.props; auto hierarchy = folly::dynamic::array(); - for (auto hierarchyItem : data.hierarchy) { + for (const auto &hierarchyItem : data.hierarchy) { hierarchy.push_back(hierarchyItem); } result["hierarchy"] = hierarchy; return ReadableNativeMap::newObjectCxxArgs(result); } +bool isMapBufferSerializationEnabled() { + static const auto reactFeatureFlagsJavaDescriptor = + jni::findClassStatic(Binding::ReactFeatureFlagsJavaDescriptor); + static const auto isMapBufferSerializationEnabledMethod = + reactFeatureFlagsJavaDescriptor->getStaticMethod( + "isMapBufferSerializationEnabled"); + bool value = + isMapBufferSerializationEnabledMethod(reactFeatureFlagsJavaDescriptor); + return value; +} + +void Binding::setPixelDensity(float pointScaleFactor) { + pointScaleFactor_ = pointScaleFactor; +} + +void Binding::driveCxxAnimations() { + scheduler_->animationTick(); +} + +#pragma mark - Surface management + void Binding::startSurface( jint surfaceId, jni::alias_ref moduleName, @@ -290,10 +128,17 @@ void Binding::startSurface( { SystraceSection s2("FabricUIManagerBinding::startSurface::surfaceId::lock"); - std::unique_lock lock(surfaceHandlerRegistryMutex_); + std::unique_lock lock(surfaceHandlerRegistryMutex_); SystraceSection s3("FabricUIManagerBinding::startSurface::surfaceId"); surfaceHandlerRegistry_.emplace(surfaceId, std::move(surfaceHandler)); } + + auto mountingManager = + verifyMountingManager("FabricUIManagerBinding::startSurface"); + if (!mountingManager) { + return; + } + mountingManager->onSurfaceStart(surfaceId); } void Binding::startSurfaceWithConstraints( @@ -353,11 +198,18 @@ void Binding::startSurfaceWithConstraints( { SystraceSection s2( "FabricUIManagerBinding::startSurfaceWithConstraints::surfaceId::lock"); - std::unique_lock lock(surfaceHandlerRegistryMutex_); + std::unique_lock lock(surfaceHandlerRegistryMutex_); SystraceSection s3( "FabricUIManagerBinding::startSurfaceWithConstraints::surfaceId"); surfaceHandlerRegistry_.emplace(surfaceId, std::move(surfaceHandler)); } + + auto mountingManager = verifyMountingManager( + "FabricUIManagerBinding::startSurfaceWithConstraints"); + if (!mountingManager) { + return; + } + mountingManager->onSurfaceStart(surfaceId); } void Binding::renderTemplateToSurface(jint surfaceId, jstring uiTemplate) { @@ -390,7 +242,7 @@ void Binding::stopSurface(jint surfaceId) { } { - std::unique_lock lock(surfaceHandlerRegistryMutex_); + std::unique_lock lock(surfaceHandlerRegistryMutex_); auto iterator = surfaceHandlerRegistry_.find(surfaceId); @@ -404,6 +256,13 @@ void Binding::stopSurface(jint surfaceId) { surfaceHandler.stop(); scheduler->unregisterSurface(surfaceHandler); } + + auto mountingManager = + verifyMountingManager("FabricUIManagerBinding::stopSurface"); + if (!mountingManager) { + return; + } + mountingManager->onSurfaceStop(surfaceId); } void Binding::registerSurface(SurfaceHandlerBinding *surfaceHandlerBinding) { @@ -416,22 +275,6 @@ void Binding::unregisterSurface(SurfaceHandlerBinding *surfaceHandlerBinding) { scheduler->unregisterSurface(surfaceHandlerBinding->getSurfaceHandler()); } -static inline float scale(Float value, Float pointScaleFactor) { - std::feclearexcept(FE_ALL_EXCEPT); - float result = value * pointScaleFactor; - if (std::fetestexcept(FE_OVERFLOW)) { - LOG(ERROR) << "Binding::scale - FE_OVERFLOW - value: " << value - << " pointScaleFactor: " << pointScaleFactor - << " result: " << result; - } - if (std::fetestexcept(FE_UNDERFLOW)) { - LOG(ERROR) << "Binding::scale - FE_UNDERFLOW - value: " << value - << " pointScaleFactor: " << pointScaleFactor - << " result: " << result; - } - return result; -} - void Binding::setConstraints( jint surfaceId, jfloat minWidth, @@ -467,7 +310,7 @@ void Binding::setConstraints( isRTL ? LayoutDirection::RightToLeft : LayoutDirection::LeftToRight; { - std::shared_lock lock(surfaceHandlerRegistryMutex_); + std::shared_lock lock(surfaceHandlerRegistryMutex_); auto iterator = surfaceHandlerRegistry_.find(surfaceId); @@ -482,16 +325,7 @@ void Binding::setConstraints( } } -bool isMapBufferSerializationEnabled() { - static const auto reactFeatureFlagsJavaDescriptor = - jni::findClassStatic(Binding::ReactFeatureFlagsJavaDescriptor); - static const auto isMapBufferSerializationEnabledMethod = - reactFeatureFlagsJavaDescriptor->getStaticMethod( - "isMapBufferSerializationEnabled"); - bool value = - isMapBufferSerializationEnabledMethod(reactFeatureFlagsJavaDescriptor); - return value; -} +#pragma mark - Install/uninstall java binding void Binding::installFabricUIManager( jni::alias_ref runtimeExecutorHolder, @@ -521,12 +355,11 @@ void Binding::installFabricUIManager( // Use std::lock and std::adopt_lock to prevent deadlocks by locking mutexes // at the same time - std::lock(schedulerMutex_, javaUIManagerMutex_); - std::lock_guard schedulerLock(schedulerMutex_, std::adopt_lock); - std::lock_guard uiManagerLock( - javaUIManagerMutex_, std::adopt_lock); + std::unique_lock lock(installMutex_); - javaUIManager_ = make_global(javaUIManager); + auto globalJavaUiManager = make_global(javaUIManager); + mountingManager_ = + std::make_shared(config, globalJavaUiManager); ContextContainer::Shared contextContainer = std::make_shared(); @@ -536,8 +369,6 @@ void Binding::installFabricUIManager( if (runtimeSchedulerHolder) { auto runtimeScheduler = runtimeSchedulerHolder->cthis()->get().lock(); if (runtimeScheduler) { - runtimeScheduler->setEnableYielding(config->getBool( - "react_native_new_architecture:runtimescheduler_enable_yielding_android")); runtimeExecutor = [runtimeScheduler]( std::function &&callback) { @@ -550,39 +381,38 @@ void Binding::installFabricUIManager( config->getBool("react_fabric:enable_asynchronous_event_beat_v2_android"); // TODO: T31905686 Create synchronous Event Beat - jni::global_ref localJavaUIManager = javaUIManager_; EventBeat::Factory synchronousBeatFactory = [eventBeatManager, runtimeExecutor, - localJavaUIManager, + globalJavaUiManager, enableV2AsynchronousEventBeat](EventBeat::SharedOwnerBox const &ownerBox) -> std::unique_ptr { if (enableV2AsynchronousEventBeat) { return std::make_unique( - ownerBox, eventBeatManager, runtimeExecutor, localJavaUIManager); + ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager); } else { return std::make_unique( - ownerBox, eventBeatManager, runtimeExecutor, localJavaUIManager); + ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager); } }; EventBeat::Factory asynchronousBeatFactory = [eventBeatManager, runtimeExecutor, - localJavaUIManager, + globalJavaUiManager, enableV2AsynchronousEventBeat](EventBeat::SharedOwnerBox const &ownerBox) -> std::unique_ptr { if (enableV2AsynchronousEventBeat) { return std::make_unique( - ownerBox, eventBeatManager, runtimeExecutor, localJavaUIManager); + ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager); } else { return std::make_unique( - ownerBox, eventBeatManager, runtimeExecutor, localJavaUIManager); + ownerBox, eventBeatManager, runtimeExecutor, globalJavaUiManager); } }; contextContainer->insert("ReactNativeConfig", config); - contextContainer->insert("FabricUIManager", javaUIManager_); + contextContainer->insert("FabricUIManager", globalJavaUiManager); // Keep reference to config object and cache some feature flags here reactNativeConfig_ = config; @@ -593,8 +423,13 @@ void Binding::installFabricUIManager( disablePreallocateViews_ = reactNativeConfig_->getBool( "react_fabric:disabled_view_preallocation_android"); - enableEarlyEventEmitterUpdate_ = reactNativeConfig_->getBool( - "react_fabric:enable_early_event_emitter_update"); + dispatchPreallocationInBackground_ = reactNativeConfig_->getBool( + "react_native_new_architecture:dispatch_preallocation_in_bg"); + + contextContainer->insert( + "EnableLargeTextMeasureCache", + reactNativeConfig_->getBool( + "react_fabric:enable_large_text_measure_cache_android")); auto toolbox = SchedulerToolbox{}; toolbox.contextContainer = contextContainer; @@ -603,16 +438,13 @@ void Binding::installFabricUIManager( toolbox.synchronousEventBeatFactory = synchronousBeatFactory; toolbox.asynchronousEventBeatFactory = asynchronousBeatFactory; - if (reactNativeConfig_->getBool( - "react_fabric:enable_background_executor_android")) { - backgroundExecutor_ = std::make_unique(); - toolbox.backgroundExecutor = backgroundExecutor_->get(); - } + backgroundExecutor_ = std::make_unique(); + toolbox.backgroundExecutor = backgroundExecutor_->get(); animationDriver_ = std::make_shared( runtimeExecutor, contextContainer, this); - scheduler_ = std::make_shared( - toolbox, (animationDriver_ ? animationDriver_.get() : nullptr), this); + scheduler_ = + std::make_shared(toolbox, animationDriver_.get(), this); } void Binding::uninstallFabricUIManager() { @@ -620,616 +452,32 @@ void Binding::uninstallFabricUIManager() { LOG(WARNING) << "Binding::uninstallFabricUIManager() was called (address: " << this << ")."; } - // Use std::lock and std::adopt_lock to prevent deadlocks by locking mutexes - // at the same time - std::lock(schedulerMutex_, javaUIManagerMutex_); - std::lock_guard schedulerLock(schedulerMutex_, std::adopt_lock); - std::lock_guard uiManagerLock( - javaUIManagerMutex_, std::adopt_lock); + std::unique_lock lock(installMutex_); animationDriver_ = nullptr; scheduler_ = nullptr; - javaUIManager_ = nullptr; + mountingManager_ = nullptr; reactNativeConfig_ = nullptr; } -inline local_ref castReadableMap( - local_ref nativeMap) { - return make_local(reinterpret_cast(nativeMap.get())); -} - -inline local_ref castReadableArray( - local_ref nativeArray) { - return make_local( - reinterpret_cast(nativeArray.get())); -} - -// TODO: this method will be removed when binding for components are code-gen -local_ref getPlatformComponentName(const ShadowView &shadowView) { - static std::string scrollViewComponentName = std::string("ScrollView"); - - local_ref componentName; - if (scrollViewComponentName.compare(shadowView.componentName) == 0) { - auto newViewProps = - std::static_pointer_cast(shadowView.props); - if (newViewProps->getProbablyMoreHorizontalThanVertical_DEPRECATED()) { - componentName = make_jstring("AndroidHorizontalScrollView"); - return componentName; - } +std::shared_ptr Binding::verifyMountingManager( + std::string const &hint) { + std::shared_lock lock(installMutex_); + if (!mountingManager_) { + LOG(ERROR) << hint << " mounting manager disappeared."; } - - componentName = make_jstring(shadowView.componentName); - return componentName; + return mountingManager_; } void Binding::schedulerDidFinishTransaction( MountingCoordinator::Shared const &mountingCoordinator) { - std::lock_guard lock(commitMutex_); - - SystraceSection s( - "FabricUIManagerBinding::schedulerDidFinishTransactionIntBuffer"); - auto finishTransactionStartTime = telemetryTimePointNow(); - - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) - << "Binding::schedulerDidFinishTransaction: JavaUIManager disappeared"; - return; - } - - auto mountingTransaction = mountingCoordinator->pullTransaction(); - - if (!mountingTransaction.has_value()) { - return; - } - - auto env = Environment::current(); - - auto telemetry = mountingTransaction->getTelemetry(); - auto surfaceId = mountingTransaction->getSurfaceId(); - auto &mutations = mountingTransaction->getMutations(); - - auto revisionNumber = telemetry.getRevisionNumber(); - - std::vector cppCommonMountItems; - std::vector cppDeleteMountItems; - std::vector cppUpdatePropsMountItems; - std::vector cppUpdateStateMountItems; - std::vector cppUpdatePaddingMountItems; - std::vector cppUpdateLayoutMountItems; - std::vector cppUpdateEventEmitterMountItems; - - for (const auto &mutation : mutations) { - const auto &parentShadowView = mutation.parentShadowView; - const auto &oldChildShadowView = mutation.oldChildShadowView; - const auto &newChildShadowView = mutation.newChildShadowView; - auto &mutationType = mutation.type; - auto &index = mutation.index; - - bool isVirtual = mutation.mutatedViewIsVirtual(); - - switch (mutationType) { - case ShadowViewMutation::Create: { - if (disablePreallocateViews_ || - newChildShadowView.props->revision > 1) { - cppCommonMountItems.push_back( - CppMountItem::CreateMountItem(newChildShadowView)); - } - break; - } - case ShadowViewMutation::Remove: { - if (!isVirtual) { - cppCommonMountItems.push_back(CppMountItem::RemoveMountItem( - parentShadowView, oldChildShadowView, index)); - } - break; - } - case ShadowViewMutation::Delete: { - cppDeleteMountItems.push_back( - CppMountItem::DeleteMountItem(oldChildShadowView)); - break; - } - case ShadowViewMutation::Update: { - if (!isVirtual) { - if (oldChildShadowView.props != newChildShadowView.props) { - cppUpdatePropsMountItems.push_back( - CppMountItem::UpdatePropsMountItem(newChildShadowView)); - } - if (oldChildShadowView.state != newChildShadowView.state) { - cppUpdateStateMountItems.push_back( - CppMountItem::UpdateStateMountItem(newChildShadowView)); - } - - // Padding: padding mountItems must be executed before layout props - // are updated in the view. This is necessary to ensure that events - // (resulting from layout changes) are dispatched with the correct - // padding information. - if (oldChildShadowView.layoutMetrics.contentInsets != - newChildShadowView.layoutMetrics.contentInsets) { - cppUpdatePaddingMountItems.push_back( - CppMountItem::UpdatePaddingMountItem(newChildShadowView)); - } - - if (oldChildShadowView.layoutMetrics != - newChildShadowView.layoutMetrics) { - cppUpdateLayoutMountItems.push_back( - CppMountItem::UpdateLayoutMountItem( - mutation.newChildShadowView)); - } - } - - if (oldChildShadowView.eventEmitter != - newChildShadowView.eventEmitter) { - cppUpdateEventEmitterMountItems.push_back( - CppMountItem::UpdateEventEmitterMountItem( - mutation.newChildShadowView)); - } - break; - } - case ShadowViewMutation::Insert: { - if (!isVirtual) { - // Insert item - cppCommonMountItems.push_back(CppMountItem::InsertMountItem( - parentShadowView, newChildShadowView, index)); - - if (disablePreallocateViews_ || - newChildShadowView.props->revision > 1) { - cppUpdatePropsMountItems.push_back( - CppMountItem::UpdatePropsMountItem(newChildShadowView)); - } - - // State - if (newChildShadowView.state) { - cppUpdateStateMountItems.push_back( - CppMountItem::UpdateStateMountItem(newChildShadowView)); - } - - // Padding: padding mountItems must be executed before layout props - // are updated in the view. This is necessary to ensure that events - // (resulting from layout changes) are dispatched with the correct - // padding information. - cppUpdatePaddingMountItems.push_back( - CppMountItem::UpdatePaddingMountItem( - mutation.newChildShadowView)); - - // Layout - cppUpdateLayoutMountItems.push_back( - CppMountItem::UpdateLayoutMountItem(mutation.newChildShadowView)); - } - - // EventEmitter - cppUpdateEventEmitterMountItems.push_back( - CppMountItem::UpdateEventEmitterMountItem( - mutation.newChildShadowView)); - - break; - } - default: { - break; - } - } - } - - // We now have all the information we need, including ordering of mount items, - // to know exactly how much space must be allocated - int batchMountItemIntsSize = 0; - int batchMountItemObjectsSize = 0; - computeBufferSizes( - batchMountItemIntsSize, - batchMountItemObjectsSize, - cppCommonMountItems, - cppDeleteMountItems, - cppUpdatePropsMountItems, - cppUpdateStateMountItems, - cppUpdatePaddingMountItems, - cppUpdateLayoutMountItems, - cppUpdateEventEmitterMountItems); - - static auto createMountItemsIntBufferBatchContainer = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod( - jint, jintArray, jtypeArray, jint)>( - "createIntBufferBatchMountItem"); - - static auto scheduleMountItem = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod("scheduleMountItem"); - - if (batchMountItemIntsSize == 0) { - auto finishTransactionEndTime = telemetryTimePointNow(); - - scheduleMountItem( - localJavaUIManager, - nullptr, - telemetry.getRevisionNumber(), - telemetryTimePointToMilliseconds(telemetry.getCommitStartTime()), - telemetryTimePointToMilliseconds(telemetry.getDiffStartTime()), - telemetryTimePointToMilliseconds(telemetry.getDiffEndTime()), - telemetryTimePointToMilliseconds(telemetry.getLayoutStartTime()), - telemetryTimePointToMilliseconds(telemetry.getLayoutEndTime()), - telemetryTimePointToMilliseconds(finishTransactionStartTime), - telemetryTimePointToMilliseconds(finishTransactionEndTime)); + auto mountingManager = + verifyMountingManager("Binding::schedulerDidFinishTransaction"); + if (!mountingManager) { return; } - // Allocate the intBuffer and object array, now that we know exact sizes - // necessary - // TODO: don't allocate at all if size is zero - jintArray intBufferArray = env->NewIntArray(batchMountItemIntsSize); - local_ref> objBufferArray = - JArrayClass::newArray(batchMountItemObjectsSize); - - // Fill in arrays - int intBufferPosition = 0; - int objBufferPosition = 0; - int prevMountItemType = -1; - jint temp[7]; - for (int i = 0; i < cppCommonMountItems.size(); i++) { - const auto &mountItem = cppCommonMountItems[i]; - const auto &mountItemType = mountItem.type; - - // Get type here, and count forward how many items of this type are in a - // row. Write preamble to any common type here. - if (prevMountItemType != mountItemType) { - int numSameItemTypes = 1; - for (int j = i + 1; j < cppCommonMountItems.size() && - cppCommonMountItems[j].type == mountItemType; - j++) { - numSameItemTypes++; - } - - writeIntBufferTypePreamble( - mountItemType, - numSameItemTypes, - env, - intBufferArray, - intBufferPosition); - } - prevMountItemType = mountItemType; - - // TODO: multi-create, multi-insert, etc - if (mountItemType == CppMountItem::Type::Create) { - local_ref componentName = - getPlatformComponentName(mountItem.newChildShadowView); - - int isLayoutable = - mountItem.newChildShadowView.layoutMetrics != EmptyLayoutMetrics ? 1 - : 0; - - local_ref props = - castReadableMap(ReadableNativeMap::newObjectCxxArgs( - mountItem.newChildShadowView.props->rawProps)); - - // Do not hold onto Java object from C - // We DO want to hold onto C object from Java, since we don't know the - // lifetime of the Java object - local_ref javaStateWrapper = nullptr; - if (mountItem.newChildShadowView.state != nullptr) { - javaStateWrapper = StateWrapperImpl::newObjectJavaArgs(); - StateWrapperImpl *cStateWrapper = cthis(javaStateWrapper); - cStateWrapper->state_ = mountItem.newChildShadowView.state; - } - - // Do not hold a reference to javaEventEmitter from the C++ side. - SharedEventEmitter eventEmitter = - mountItem.newChildShadowView.eventEmitter; - auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); - EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - if (enableEventEmitterRawPointer_) { - cEventEmitter->eventEmitterPointer = eventEmitter.get(); - } else { - cEventEmitter->eventEmitter = eventEmitter; - } - temp[0] = mountItem.newChildShadowView.tag; - temp[1] = isLayoutable; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp); - intBufferPosition += 2; - - (*objBufferArray)[objBufferPosition++] = componentName.get(); - (*objBufferArray)[objBufferPosition++] = props.get(); - (*objBufferArray)[objBufferPosition++] = - javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr; - (*objBufferArray)[objBufferPosition++] = javaEventEmitter.get(); - } else if (mountItemType == CppMountItem::Type::Insert) { - temp[0] = mountItem.newChildShadowView.tag; - temp[1] = mountItem.parentShadowView.tag; - temp[2] = mountItem.index; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp); - intBufferPosition += 3; - } else if (mountItemType == CppMountItem::Remove) { - temp[0] = mountItem.oldChildShadowView.tag; - temp[1] = mountItem.parentShadowView.tag; - temp[2] = mountItem.index; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp); - intBufferPosition += 3; - } else { - LOG(ERROR) << "Unexpected CppMountItem type"; - } - } - if (cppUpdatePropsMountItems.size() > 0) { - writeIntBufferTypePreamble( - CppMountItem::Type::UpdateProps, - cppUpdatePropsMountItems.size(), - env, - intBufferArray, - intBufferPosition); - - for (const auto &mountItem : cppUpdatePropsMountItems) { - temp[0] = mountItem.newChildShadowView.tag; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); - intBufferPosition += 1; - - auto newProps = mountItem.newChildShadowView.props->rawProps; - local_ref newPropsReadableMap = - castReadableMap(ReadableNativeMap::newObjectCxxArgs(newProps)); - (*objBufferArray)[objBufferPosition++] = newPropsReadableMap.get(); - } - } - if (cppUpdateStateMountItems.size() > 0) { - writeIntBufferTypePreamble( - CppMountItem::Type::UpdateState, - cppUpdateStateMountItems.size(), - env, - intBufferArray, - intBufferPosition); - - for (const auto &mountItem : cppUpdateStateMountItems) { - temp[0] = mountItem.newChildShadowView.tag; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); - intBufferPosition += 1; - - auto state = mountItem.newChildShadowView.state; - // Do not hold onto Java object from C - // We DO want to hold onto C object from Java, since we don't know the - // lifetime of the Java object - local_ref javaStateWrapper = nullptr; - if (state != nullptr) { - javaStateWrapper = StateWrapperImpl::newObjectJavaArgs(); - StateWrapperImpl *cStateWrapper = cthis(javaStateWrapper); - cStateWrapper->state_ = state; - } - - (*objBufferArray)[objBufferPosition++] = - (javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr); - } - } - if (cppUpdatePaddingMountItems.size() > 0) { - writeIntBufferTypePreamble( - CppMountItem::Type::UpdatePadding, - cppUpdatePaddingMountItems.size(), - env, - intBufferArray, - intBufferPosition); - - for (const auto &mountItem : cppUpdatePaddingMountItems) { - auto layoutMetrics = mountItem.newChildShadowView.layoutMetrics; - auto pointScaleFactor = layoutMetrics.pointScaleFactor; - auto contentInsets = layoutMetrics.contentInsets; - - int left = floor(scale(contentInsets.left, pointScaleFactor)); - int top = floor(scale(contentInsets.top, pointScaleFactor)); - int right = floor(scale(contentInsets.right, pointScaleFactor)); - int bottom = floor(scale(contentInsets.bottom, pointScaleFactor)); - - temp[0] = mountItem.newChildShadowView.tag; - temp[1] = left; - temp[2] = top; - temp[3] = right; - temp[4] = bottom; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 5, temp); - intBufferPosition += 5; - } - } - if (cppUpdateLayoutMountItems.size() > 0) { - writeIntBufferTypePreamble( - CppMountItem::Type::UpdateLayout, - cppUpdateLayoutMountItems.size(), - env, - intBufferArray, - intBufferPosition); - - for (const auto &mountItem : cppUpdateLayoutMountItems) { - auto layoutMetrics = mountItem.newChildShadowView.layoutMetrics; - auto pointScaleFactor = layoutMetrics.pointScaleFactor; - auto frame = layoutMetrics.frame; - - int x = round(scale(frame.origin.x, pointScaleFactor)); - int y = round(scale(frame.origin.y, pointScaleFactor)); - int w = round(scale(frame.size.width, pointScaleFactor)); - int h = round(scale(frame.size.height, pointScaleFactor)); - int displayType = - toInt(mountItem.newChildShadowView.layoutMetrics.displayType); - - temp[0] = mountItem.newChildShadowView.tag; - temp[1] = x; - temp[2] = y; - temp[3] = w; - temp[4] = h; - temp[5] = displayType; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 6, temp); - intBufferPosition += 6; - } - } - if (cppUpdateEventEmitterMountItems.size() > 0) { - writeIntBufferTypePreamble( - CppMountItem::Type::UpdateEventEmitter, - cppUpdateEventEmitterMountItems.size(), - env, - intBufferArray, - intBufferPosition); - - for (const auto &mountItem : cppUpdateEventEmitterMountItems) { - temp[0] = mountItem.newChildShadowView.tag; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); - intBufferPosition += 1; - - SharedEventEmitter eventEmitter = - mountItem.newChildShadowView.eventEmitter; - - // Do not hold a reference to javaEventEmitter from the C++ side. - auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); - EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - if (enableEventEmitterRawPointer_) { - cEventEmitter->eventEmitterPointer = eventEmitter.get(); - } else { - cEventEmitter->eventEmitter = eventEmitter; - } - - (*objBufferArray)[objBufferPosition++] = javaEventEmitter.get(); - } - } - - // Write deletes last - so that all prop updates, etc, for the tag in the same - // batch don't fail. Without additional machinery, moving deletes here - // requires that the differ never produces "DELETE...CREATE" in that order for - // the same tag. It's nice to be able to batch all similar operations together - // for space efficiency. - if (cppDeleteMountItems.size() > 0) { - writeIntBufferTypePreamble( - CppMountItem::Type::Delete, - cppDeleteMountItems.size(), - env, - intBufferArray, - intBufferPosition); - - for (const auto &mountItem : cppDeleteMountItems) { - temp[0] = mountItem.oldChildShadowView.tag; - env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); - intBufferPosition += 1; - } - } - - // If there are no items, we pass a nullptr instead of passing the object - // through the JNI - auto batch = createMountItemsIntBufferBatchContainer( - localJavaUIManager, - surfaceId, - batchMountItemIntsSize == 0 ? nullptr : intBufferArray, - batchMountItemObjectsSize == 0 ? nullptr : objBufferArray.get(), - revisionNumber); - - auto finishTransactionEndTime = telemetryTimePointNow(); - - scheduleMountItem( - localJavaUIManager, - batch.get(), - telemetry.getRevisionNumber(), - telemetryTimePointToMilliseconds(telemetry.getCommitStartTime()), - telemetryTimePointToMilliseconds(telemetry.getDiffStartTime()), - telemetryTimePointToMilliseconds(telemetry.getDiffEndTime()), - telemetryTimePointToMilliseconds(telemetry.getLayoutStartTime()), - telemetryTimePointToMilliseconds(telemetry.getLayoutEndTime()), - telemetryTimePointToMilliseconds(finishTransactionStartTime), - telemetryTimePointToMilliseconds(finishTransactionEndTime)); - - env->DeleteLocalRef(intBufferArray); -} - -void Binding::setPixelDensity(float pointScaleFactor) { - pointScaleFactor_ = pointScaleFactor; -} - -void Binding::onAnimationStarted() { - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) << "Binding::animationsStarted: JavaUIManager disappeared"; - return; - } - - static auto layoutAnimationsStartedJNI = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod("onAnimationStarted"); - - layoutAnimationsStartedJNI(localJavaUIManager); -} -void Binding::onAllAnimationsComplete() { - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) << "Binding::allAnimationsComplete: JavaUIManager disappeared"; - return; - } - - static auto allAnimationsCompleteJNI = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod("onAllAnimationsComplete"); - - allAnimationsCompleteJNI(localJavaUIManager); -} - -void Binding::driveCxxAnimations() { - scheduler_->animationTick(); -} - -void Binding::preallocateShadowView( - const SurfaceId surfaceId, - const ShadowView &shadowView) { - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) - << "Binding::schedulerDidRequestPreliminaryViewAllocation: JavaUIManager disappeared"; - return; - } - - bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics; - - static auto preallocateView = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod("preallocateView"); - - // Do not hold onto Java object from C - // We DO want to hold onto C object from Java, since we don't know the - // lifetime of the Java object - local_ref javaStateWrapper = nullptr; - if (shadowView.state != nullptr) { - javaStateWrapper = StateWrapperImpl::newObjectJavaArgs(); - StateWrapperImpl *cStateWrapper = cthis(javaStateWrapper); - cStateWrapper->state_ = shadowView.state; - } - - // Do not hold a reference to javaEventEmitter from the C++ side. - local_ref javaEventEmitter = nullptr; - if (enableEarlyEventEmitterUpdate_) { - SharedEventEmitter eventEmitter = shadowView.eventEmitter; - if (eventEmitter != nullptr) { - javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); - EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); - if (enableEventEmitterRawPointer_) { - cEventEmitter->eventEmitterPointer = eventEmitter.get(); - } else { - cEventEmitter->eventEmitter = eventEmitter; - } - } - } - - local_ref props = castReadableMap( - ReadableNativeMap::newObjectCxxArgs(shadowView.props->rawProps)); - auto component = getPlatformComponentName(shadowView); - - preallocateView( - localJavaUIManager, - surfaceId, - shadowView.tag, - component.get(), - props.get(), - (javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr), - (javaEventEmitter != nullptr ? javaEventEmitter.get() : nullptr), - isLayoutableShadowNode); + mountingManager->executeMount(mountingCoordinator); } void Binding::schedulerDidRequestPreliminaryViewAllocation( @@ -1239,19 +487,17 @@ void Binding::schedulerDidRequestPreliminaryViewAllocation( return; } - auto shadowView = ShadowView(shadowNode); - - if (!shadowView.traits.check(ShadowNodeTraits::Trait::FormsView)) { + if (!shadowNode.getTraits().check(ShadowNodeTraits::Trait::FormsView)) { return; } - preallocateShadowView(surfaceId, shadowView); + preallocateView(surfaceId, shadowNode); } void Binding::schedulerDidCloneShadowNode( SurfaceId surfaceId, - const ShadowNode &oldShadowNode, - const ShadowNode &newShadowNode) { + ShadowNode const &oldShadowNode, + ShadowNode const &newShadowNode) { // This is only necessary if view preallocation was skipped during // createShadowNode @@ -1272,96 +518,88 @@ void Binding::schedulerDidCloneShadowNode( // If the new node is concrete and the old wasn't, we can preallocate if (!oldShadowNode.getTraits().check(ShadowNodeTraits::Trait::FormsView) && newShadowNode.getTraits().check(ShadowNodeTraits::Trait::FormsView)) { - auto shadowView = ShadowView(newShadowNode); - preallocateShadowView(surfaceId, shadowView); + preallocateView(surfaceId, newShadowNode); + } +} + +void Binding::preallocateView( + SurfaceId surfaceId, + ShadowNode const &shadowNode) { + auto shadowView = ShadowView(shadowNode); + auto preallocationFunction = [this, + surfaceId, + shadowView = std::move(shadowView)] { + auto mountingManager = verifyMountingManager("Binding::preallocateView"); + if (!mountingManager) { + return; + } + + mountingManager->preallocateShadowView(surfaceId, shadowView); + }; + + if (dispatchPreallocationInBackground_) { + auto backgroundExecutor = backgroundExecutor_->get(); + backgroundExecutor(preallocationFunction); + } else { + preallocationFunction(); } } void Binding::schedulerDidDispatchCommand( const ShadowView &shadowView, std::string const &commandName, - folly::dynamic const args) { - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) - << "Binding::schedulerDidDispatchCommand: JavaUIManager disappeared"; + folly::dynamic const &args) { + auto mountingManager = + verifyMountingManager("Binding::schedulerDidDispatchCommand"); + if (!mountingManager) { return; } - static auto dispatchCommand = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod( - "dispatchCommand"); - - local_ref command = make_jstring(commandName); - - local_ref argsArray = - castReadableArray(ReadableNativeArray::newObjectCxxArgs(args)); - - dispatchCommand( - localJavaUIManager, - shadowView.surfaceId, - shadowView.tag, - command.get(), - argsArray.get()); + mountingManager->dispatchCommand(shadowView, commandName, args); } void Binding::schedulerDidSendAccessibilityEvent( const ShadowView &shadowView, std::string const &eventType) { - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) - << "Binding::schedulerDidDispatchCommand: JavaUIManager disappeared"; + auto mountingManager = + verifyMountingManager("Binding::schedulerDidSendAccessibilityEvent"); + if (!mountingManager) { return; } - local_ref eventTypeStr = make_jstring(eventType); - - static auto sendAccessibilityEventFromJS = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod( - "sendAccessibilityEventFromJS"); - - sendAccessibilityEventFromJS( - localJavaUIManager, - shadowView.surfaceId, - shadowView.tag, - eventTypeStr.get()); + mountingManager->sendAccessibilityEvent(shadowView, eventType); } void Binding::schedulerDidSetIsJSResponder( ShadowView const &shadowView, bool isJSResponder, bool blockNativeResponder) { - jni::global_ref localJavaUIManager = getJavaUIManager(); - if (!localJavaUIManager) { - LOG(ERROR) << "Binding::schedulerSetJSResponder: JavaUIManager disappeared"; + auto mountingManager = + verifyMountingManager("Binding::schedulerDidSetIsJSResponder"); + if (!mountingManager) { return; } - static auto setJSResponder = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod("setJSResponder"); - - static auto clearJSResponder = - jni::findClassStatic(Binding::UIManagerJavaDescriptor) - ->getMethod("clearJSResponder"); - - if (isJSResponder) { - setJSResponder( - localJavaUIManager, - shadowView.surfaceId, - shadowView.tag, - // The closest non-flattened ancestor of the same value if the node is - // not flattened. For now, we don't support the case when the node can - // be flattened because the only component that uses this feature - - // ScrollView - cannot be flattened. - shadowView.tag, - (jboolean)blockNativeResponder); - } else { - clearJSResponder(localJavaUIManager); + mountingManager->setIsJSResponder( + shadowView, isJSResponder, blockNativeResponder); +} + +void Binding::onAnimationStarted() { + auto mountingManager = verifyMountingManager("Binding::onAnimationStarted"); + if (!mountingManager) { + return; } + + mountingManager->onAnimationStarted(); +} + +void Binding::onAllAnimationsComplete() { + auto mountingManager = verifyMountingManager("Binding::onAnimationComplete"); + if (!mountingManager) { + return; + } + + mountingManager->onAllAnimationsComplete(); } void Binding::registerNatives() { diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h index 5f261f345347..db537efddbc6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,8 @@ #pragma once +#include "FabricMountingManager.h" + #include #include #include @@ -29,45 +31,6 @@ namespace react { class Instance; -struct CppMountItem final { -#pragma mark - Designated Initializers - static CppMountItem CreateMountItem(ShadowView shadowView); - static CppMountItem DeleteMountItem(ShadowView shadowView); - static CppMountItem - InsertMountItem(ShadowView parentView, ShadowView shadowView, int index); - static CppMountItem - RemoveMountItem(ShadowView parentView, ShadowView shadowView, int index); - static CppMountItem UpdatePropsMountItem(ShadowView shadowView); - static CppMountItem UpdateStateMountItem(ShadowView shadowView); - static CppMountItem UpdateLayoutMountItem(ShadowView shadowView); - static CppMountItem UpdateEventEmitterMountItem(ShadowView shadowView); - static CppMountItem UpdatePaddingMountItem(ShadowView shadowView); - -#pragma mark - Type - - enum Type { - Undefined = -1, - Multiple = 1, - Create = 2, - Delete = 4, - Insert = 8, - Remove = 16, - UpdateProps = 32, - UpdateState = 64, - UpdateLayout = 128, - UpdateEventEmitter = 256, - UpdatePadding = 512 - }; - -#pragma mark - Fields - - Type type = {Create}; - ShadowView parentShadowView = {}; - ShadowView oldChildShadowView = {}; - ShadowView newChildShadowView = {}; - int index = {}; -}; - class Binding : public jni::HybridClass, public SchedulerDelegate, public LayoutAnimationStatusDelegate { @@ -75,18 +38,12 @@ class Binding : public jni::HybridClass, constexpr static const char *const kJavaDescriptor = "Lcom/facebook/react/fabric/Binding;"; - constexpr static auto UIManagerJavaDescriptor = - "com/facebook/react/fabric/FabricUIManager"; - constexpr static auto ReactFeatureFlagsJavaDescriptor = "com/facebook/react/config/ReactFeatureFlags"; static void registerNatives(); private: - jni::global_ref getJavaUIManager(); - std::shared_ptr getScheduler(); - void setConstraints( jint surfaceId, jfloat minWidth, @@ -140,10 +97,6 @@ class Binding : public jni::HybridClass, void schedulerDidFinishTransaction( MountingCoordinator::Shared const &mountingCoordinator) override; - void preallocateShadowView( - const SurfaceId surfaceId, - const ShadowView &shadowView); - void schedulerDidRequestPreliminaryViewAllocation( const SurfaceId surfaceId, const ShadowNode &shadowNode) override; @@ -156,7 +109,7 @@ class Binding : public jni::HybridClass, void schedulerDidDispatchCommand( const ShadowView &shadowView, std::string const &commandName, - folly::dynamic const args) override; + folly::dynamic const &args) override; void schedulerDidSendAccessibilityEvent( const ShadowView &shadowView, @@ -167,6 +120,8 @@ class Binding : public jni::HybridClass, bool isJSResponder, bool blockNativeResponder) override; + void preallocateView(SurfaceId surfaceId, ShadowNode const &shadowNode); + void setPixelDensity(float pointScaleFactor); void driveCxxAnimations(); @@ -174,33 +129,34 @@ class Binding : public jni::HybridClass, void uninstallFabricUIManager(); // Private member variables - jni::global_ref javaUIManager_; - std::mutex javaUIManagerMutex_; + butter::shared_mutex installMutex_; + std::shared_ptr mountingManager_; + std::shared_ptr scheduler_; + + std::shared_ptr getScheduler(); + std::shared_ptr verifyMountingManager( + std::string const &locationHint); // LayoutAnimations - virtual void onAnimationStarted() override; - virtual void onAllAnimationsComplete() override; - LayoutAnimationDriver *getAnimationDriver(); + void onAnimationStarted() override; + void onAllAnimationsComplete() override; + std::shared_ptr animationDriver_; - std::unique_ptr backgroundExecutor_; - std::shared_ptr scheduler_; - std::mutex schedulerMutex_; + std::unique_ptr backgroundExecutor_; - better::map surfaceHandlerRegistry_{}; - better::shared_mutex + butter::map surfaceHandlerRegistry_{}; + butter::shared_mutex surfaceHandlerRegistryMutex_; // Protects `surfaceHandlerRegistry_`. - std::recursive_mutex commitMutex_; - float pointScaleFactor_ = 1; std::shared_ptr reactNativeConfig_{nullptr}; bool disablePreallocateViews_{false}; bool enableFabricLogs_{false}; - bool enableEarlyEventEmitterUpdate_{false}; bool disableRevisionCheckForPreallocation_{false}; bool enableEventEmitterRawPointer_{false}; + bool dispatchPreallocationInBackground_{false}; }; } // namespace react diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.cpp index d6f1b236e34a..77425a03549f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.h index f3f14b0f9961..e28fb1966d68 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp index f92c84d625c8..22f1ddeb439d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.h index 255a51a12f9f..4821ee29f733 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/CoreComponentsRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,14 +23,14 @@ class CoreComponentsRegistry static void registerNatives(); - CoreComponentsRegistry(ComponentFactory *delegate); - - private: - friend HybridBase; + explicit CoreComponentsRegistry(ComponentFactory *delegate); static std::shared_ptr sharedProviderRegistry(); + private: + friend HybridBase; + const ComponentFactory *delegate_; static jni::local_ref initHybrid( diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.cpp index fc613c01290e..9e9e383792e8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h index 094424ec2601..39b260777088 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventBeatManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,7 +35,8 @@ class EventBeatManager : public jni::HybridClass { static void registerNatives(); - EventBeatManager(jni::alias_ref jhybridobject); + explicit EventBeatManager( + jni::alias_ref jhybridobject); /* * Adds (or removes) observers. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp index b535c2ca7500..262ac0d23d25 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,12 +19,12 @@ EventEmitterWrapper::initHybrid(jni::alias_ref) { } void EventEmitterWrapper::invokeEvent( - std::string eventName, + std::string const &eventName, NativeMap *payload, int category) { if (eventEmitterPointer) { eventEmitterPointer->dispatchEvent( - std::move(eventName), + eventName, payload->consume(), EventPriority::AsynchronousBatched, static_cast(category)); @@ -44,12 +44,11 @@ void EventEmitterWrapper::invokeEvent( } void EventEmitterWrapper::invokeUniqueEvent( - std::string eventName, + std::string const &eventName, NativeMap *payload, int customCoalesceKey) { if (eventEmitterPointer) { - eventEmitterPointer->dispatchUniqueEvent( - std::move(eventName), payload->consume()); + eventEmitterPointer->dispatchUniqueEvent(eventName, payload->consume()); return; } // TODO: customCoalesceKey currently unused diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h index b36911da928c..f7a6d6e11fbd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/EventEmitterWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,9 +26,10 @@ class EventEmitterWrapper : public jni::HybridClass { SharedEventEmitter eventEmitter; EventEmitter const *eventEmitterPointer; - void invokeEvent(std::string eventName, NativeMap *params, int category); + void + invokeEvent(std::string const &eventName, NativeMap *params, int category); void invokeUniqueEvent( - std::string eventName, + std::string const &eventName, NativeMap *params, int customCoalesceKey); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountItem.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountItem.cpp new file mode 100644 index 000000000000..2849c112145b --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountItem.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "FabricMountItem.h" + +namespace facebook { +namespace react { + +CppMountItem CppMountItem::CreateMountItem(ShadowView const &shadowView) { + return {CppMountItem::Type::Create, {}, {}, shadowView, -1}; +} +CppMountItem CppMountItem::DeleteMountItem(ShadowView const &shadowView) { + return {CppMountItem::Type::Delete, {}, shadowView, {}, -1}; +} +CppMountItem CppMountItem::InsertMountItem( + ShadowView const &parentView, + ShadowView const &shadowView, + int index) { + return {CppMountItem::Type::Insert, parentView, {}, shadowView, index}; +} +CppMountItem CppMountItem::RemoveMountItem( + ShadowView const &parentView, + ShadowView const &shadowView, + int index) { + return {CppMountItem::Type::Remove, parentView, shadowView, {}, index}; +} +CppMountItem CppMountItem::UpdatePropsMountItem(ShadowView const &shadowView) { + return {CppMountItem::Type::UpdateProps, {}, {}, shadowView, -1}; +} +CppMountItem CppMountItem::UpdateStateMountItem(ShadowView const &shadowView) { + return {CppMountItem::Type::UpdateState, {}, {}, shadowView, -1}; +} +CppMountItem CppMountItem::UpdateLayoutMountItem(ShadowView const &shadowView) { + return {CppMountItem::Type::UpdateLayout, {}, {}, shadowView, -1}; +} +CppMountItem CppMountItem::UpdateEventEmitterMountItem( + ShadowView const &shadowView) { + return {CppMountItem::Type::UpdateEventEmitter, {}, {}, shadowView, -1}; +} +CppMountItem CppMountItem::UpdatePaddingMountItem( + ShadowView const &shadowView) { + return {CppMountItem::Type::UpdatePadding, {}, {}, shadowView, -1}; +} +CppMountItem CppMountItem::UpdateOverflowInsetMountItem( + ShadowView const &shadowView) { + return {CppMountItem::Type::UpdateOverflowInset, {}, {}, shadowView, -1}; +} + +} // namespace react +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountItem.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountItem.h new file mode 100644 index 000000000000..4764fafa1ca5 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountItem.h @@ -0,0 +1,78 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +struct JMountItem : public jni::JavaClass { + static constexpr auto kJavaDescriptor = + "Lcom/facebook/react/fabric/mounting/mountitems/MountItem;"; +}; + +struct CppMountItem final { +#pragma mark - Designated Initializers + + static CppMountItem CreateMountItem(ShadowView const &shadowView); + + static CppMountItem DeleteMountItem(ShadowView const &shadowView); + + static CppMountItem InsertMountItem( + ShadowView const &parentView, + ShadowView const &shadowView, + int index); + + static CppMountItem RemoveMountItem( + ShadowView const &parentView, + ShadowView const &shadowView, + int index); + + static CppMountItem UpdatePropsMountItem(ShadowView const &shadowView); + + static CppMountItem UpdateStateMountItem(ShadowView const &shadowView); + + static CppMountItem UpdateLayoutMountItem(ShadowView const &shadowView); + + static CppMountItem UpdateEventEmitterMountItem(ShadowView const &shadowView); + + static CppMountItem UpdatePaddingMountItem(ShadowView const &shadowView); + + static CppMountItem UpdateOverflowInsetMountItem( + ShadowView const &shadowView); + +#pragma mark - Type + + enum Type { + Undefined = -1, + Multiple = 1, + Create = 2, + Delete = 4, + Insert = 8, + Remove = 16, + UpdateProps = 32, + UpdateState = 64, + UpdateLayout = 128, + UpdateEventEmitter = 256, + UpdatePadding = 512, + UpdateOverflowInset = 1024 + }; + +#pragma mark - Fields + + Type type = {Create}; + ShadowView parentShadowView = {}; + ShadowView oldChildShadowView = {}; + ShadowView newChildShadowView = {}; + int index = {}; +}; + +} // namespace react +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp new file mode 100644 index 000000000000..e88af4c22991 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.cpp @@ -0,0 +1,962 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "FabricMountingManager.h" +#include "EventEmitterWrapper.h" +#include "StateWrapperImpl.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +using namespace facebook::jni; + +namespace facebook { +namespace react { + +void FabricMountingManager::onSurfaceStart(SurfaceId surfaceId) { + std::lock_guard lock(allocatedViewsMutex_); + allocatedViewRegistry_.emplace(surfaceId, butter::set{}); +} + +void FabricMountingManager::onSurfaceStop(SurfaceId surfaceId) { + std::lock_guard lock(allocatedViewsMutex_); + allocatedViewRegistry_.erase(surfaceId); +} + +static inline int getIntBufferSizeForType(CppMountItem::Type mountItemType) { + switch (mountItemType) { + case CppMountItem::Type::Create: + return 2; // tag, isLayoutable + case CppMountItem::Type::Insert: + case CppMountItem::Type::Remove: + return 3; // tag, parentTag, index + case CppMountItem::Type::Delete: + case CppMountItem::Type::UpdateProps: + case CppMountItem::Type::UpdateState: + case CppMountItem::Type::UpdateEventEmitter: + return 1; // tag + case CppMountItem::Type::UpdatePadding: + return 5; // tag, top, left, bottom, right + case CppMountItem::Type::UpdateLayout: + return 6; // tag, x, y, w, h, DisplayType + case CppMountItem::Type::UpdateOverflowInset: + return 5; // tag, left, top, right, bottom + case CppMountItem::Undefined: + case CppMountItem::Multiple: + return -1; + } +} + +static inline void updateBufferSizes( + CppMountItem::Type mountItemType, + int numInstructions, + int &batchMountItemIntsSize, + int &batchMountItemObjectsSize) { + if (numInstructions == 0) { + return; + } + + batchMountItemIntsSize += + numInstructions == 1 ? 1 : 2; // instructionType[, numInstructions] + batchMountItemIntsSize += + numInstructions * getIntBufferSizeForType(mountItemType); + + if (mountItemType == CppMountItem::Type::UpdateProps) { + batchMountItemObjectsSize += + numInstructions; // props object * numInstructions + } else if (mountItemType == CppMountItem::Type::UpdateState) { + batchMountItemObjectsSize += + numInstructions; // state object * numInstructions + } else if (mountItemType == CppMountItem::Type::UpdateEventEmitter) { + batchMountItemObjectsSize += + numInstructions; // EventEmitter object * numInstructions + } +} + +static inline void computeBufferSizes( + int &batchMountItemIntsSize, + int &batchMountItemObjectsSize, + std::vector &cppCommonMountItems, + std::vector &cppDeleteMountItems, + std::vector &cppUpdatePropsMountItems, + std::vector &cppUpdateStateMountItems, + std::vector &cppUpdatePaddingMountItems, + std::vector &cppUpdateLayoutMountItems, + std::vector &cppUpdateOverflowInsetMountItems, + std::vector &cppUpdateEventEmitterMountItems) { + CppMountItem::Type lastType = CppMountItem::Type::Undefined; + int numSameType = 0; + for (auto const &mountItem : cppCommonMountItems) { + const auto &mountItemType = mountItem.type; + + if (lastType == mountItemType) { + numSameType++; + if (numSameType == 2) { + batchMountItemIntsSize += 1; // numInstructions + } + } else { + numSameType = 1; + lastType = mountItemType; + batchMountItemIntsSize += 1; // instructionType + } + + batchMountItemIntsSize += getIntBufferSizeForType(mountItemType); + if (mountItemType == CppMountItem::Type::Create) { + batchMountItemObjectsSize += + 4; // component name, props, state, event emitter + } + } + + updateBufferSizes( + CppMountItem::Type::UpdateProps, + cppUpdatePropsMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); + updateBufferSizes( + CppMountItem::Type::UpdateState, + cppUpdateStateMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); + updateBufferSizes( + CppMountItem::Type::UpdatePadding, + cppUpdatePaddingMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); + updateBufferSizes( + CppMountItem::Type::UpdateLayout, + cppUpdateLayoutMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); + updateBufferSizes( + CppMountItem::Type::UpdateOverflowInset, + cppUpdateOverflowInsetMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); + updateBufferSizes( + CppMountItem::Type::UpdateEventEmitter, + cppUpdateEventEmitterMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); + updateBufferSizes( + CppMountItem::Type::Delete, + cppDeleteMountItems.size(), + batchMountItemIntsSize, + batchMountItemObjectsSize); +} + +static inline void writeIntBufferTypePreamble( + int mountItemType, + int numItems, + _JNIEnv *env, + jintArray &intBufferArray, + int &intBufferPosition) { + jint temp[2]; + if (numItems == 1) { + temp[0] = mountItemType; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); + intBufferPosition += 1; + } else { + temp[0] = mountItemType | CppMountItem::Type::Multiple; + temp[1] = numItems; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp); + intBufferPosition += 2; + } +} + +inline local_ref castReadableMap( + local_ref const &nativeMap) { + return make_local(reinterpret_cast(nativeMap.get())); +} + +inline local_ref castReadableArray( + local_ref const &nativeArray) { + return make_local( + reinterpret_cast(nativeArray.get())); +} + +// TODO: this method will be removed when binding for components are code-gen +local_ref getPlatformComponentName(ShadowView const &shadowView) { + static std::string scrollViewComponentName = std::string("ScrollView"); + + local_ref componentName; + if (scrollViewComponentName == shadowView.componentName) { + auto newViewProps = + std::static_pointer_cast(shadowView.props); + if (newViewProps->getProbablyMoreHorizontalThanVertical_DEPRECATED()) { + componentName = make_jstring("AndroidHorizontalScrollView"); + return componentName; + } + } + + componentName = make_jstring(shadowView.componentName); + return componentName; +} + +static inline float scale(Float value, Float pointScaleFactor) { + std::feclearexcept(FE_ALL_EXCEPT); + float result = value * pointScaleFactor; + if (std::fetestexcept(FE_OVERFLOW)) { + LOG(ERROR) << "Binding::scale - FE_OVERFLOW - value: " << value + << " pointScaleFactor: " << pointScaleFactor + << " result: " << result; + } + if (std::fetestexcept(FE_UNDERFLOW)) { + LOG(ERROR) << "Binding::scale - FE_UNDERFLOW - value: " << value + << " pointScaleFactor: " << pointScaleFactor + << " result: " << result; + } + return result; +} + +void FabricMountingManager::executeMount( + MountingCoordinator::Shared const &mountingCoordinator) { + std::lock_guard lock(commitMutex_); + + SystraceSection s( + "FabricUIManagerBinding::schedulerDidFinishTransactionIntBuffer"); + auto finishTransactionStartTime = telemetryTimePointNow(); + + auto mountingTransaction = mountingCoordinator->pullTransaction(); + + if (!mountingTransaction.has_value()) { + return; + } + + auto env = Environment::current(); + + auto telemetry = mountingTransaction->getTelemetry(); + auto surfaceId = mountingTransaction->getSurfaceId(); + auto &mutations = mountingTransaction->getMutations(); + + auto revisionNumber = telemetry.getRevisionNumber(); + + std::vector cppCommonMountItems; + std::vector cppDeleteMountItems; + std::vector cppUpdatePropsMountItems; + std::vector cppUpdateStateMountItems; + std::vector cppUpdatePaddingMountItems; + std::vector cppUpdateLayoutMountItems; + std::vector cppUpdateOverflowInsetMountItems; + std::vector cppUpdateEventEmitterMountItems; + + { + std::lock_guard allocatedViewsLock(allocatedViewsMutex_); + + auto allocatedViewsIterator = allocatedViewRegistry_.find(surfaceId); + auto const &allocatedViewTags = + allocatedViewsIterator != allocatedViewRegistry_.end() + ? allocatedViewsIterator->second + : butter::set{}; + if (allocatedViewsIterator == allocatedViewRegistry_.end()) { + LOG(ERROR) << "Executing commit after surface was stopped!"; + } + + bool noRevisionCheck = + disablePreallocateViews_ || disableRevisionCheckForPreallocation_; + + for (const auto &mutation : mutations) { + const auto &parentShadowView = mutation.parentShadowView; + const auto &oldChildShadowView = mutation.oldChildShadowView; + const auto &newChildShadowView = mutation.newChildShadowView; + auto &mutationType = mutation.type; + auto &index = mutation.index; + + bool isVirtual = mutation.mutatedViewIsVirtual(); + + switch (mutationType) { + case ShadowViewMutation::Create: { + bool revisionCheck = + noRevisionCheck || newChildShadowView.props->revision > 1; + bool allocationCheck = + !allocatedViewTags.contains(newChildShadowView.tag); + bool shouldCreateView = + shouldRememberAllocatedViews_ ? allocationCheck : revisionCheck; + + if (shouldCreateView) { + cppCommonMountItems.push_back( + CppMountItem::CreateMountItem(newChildShadowView)); + } + break; + } + case ShadowViewMutation::Remove: { + if (!isVirtual) { + cppCommonMountItems.push_back(CppMountItem::RemoveMountItem( + parentShadowView, oldChildShadowView, index)); + } + break; + } + case ShadowViewMutation::Delete: { + cppDeleteMountItems.push_back( + CppMountItem::DeleteMountItem(oldChildShadowView)); + break; + } + case ShadowViewMutation::Update: { + if (!isVirtual) { + if (oldChildShadowView.props != newChildShadowView.props) { + cppUpdatePropsMountItems.push_back( + CppMountItem::UpdatePropsMountItem(newChildShadowView)); + } + if (oldChildShadowView.state != newChildShadowView.state) { + cppUpdateStateMountItems.push_back( + CppMountItem::UpdateStateMountItem(newChildShadowView)); + } + + // Padding: padding mountItems must be executed before layout props + // are updated in the view. This is necessary to ensure that events + // (resulting from layout changes) are dispatched with the correct + // padding information. + if (oldChildShadowView.layoutMetrics.contentInsets != + newChildShadowView.layoutMetrics.contentInsets) { + cppUpdatePaddingMountItems.push_back( + CppMountItem::UpdatePaddingMountItem(newChildShadowView)); + } + + if (oldChildShadowView.layoutMetrics != + newChildShadowView.layoutMetrics) { + cppUpdateLayoutMountItems.push_back( + CppMountItem::UpdateLayoutMountItem( + mutation.newChildShadowView)); + } + + // OverflowInset: This is the values indicating boundaries including + // children of the current view. The layout of current view may not + // change, and we separate this part from layout mount items to not + // pack too much data there. + if (useOverflowInset_ && + (oldChildShadowView.layoutMetrics.overflowInset != + newChildShadowView.layoutMetrics.overflowInset)) { + cppUpdateOverflowInsetMountItems.push_back( + CppMountItem::UpdateOverflowInsetMountItem( + newChildShadowView)); + } + } + + if (oldChildShadowView.eventEmitter != + newChildShadowView.eventEmitter) { + cppUpdateEventEmitterMountItems.push_back( + CppMountItem::UpdateEventEmitterMountItem( + mutation.newChildShadowView)); + } + break; + } + case ShadowViewMutation::Insert: { + if (!isVirtual) { + // Insert item + cppCommonMountItems.push_back(CppMountItem::InsertMountItem( + parentShadowView, newChildShadowView, index)); + + bool revisionCheck = + noRevisionCheck || newChildShadowView.props->revision > 1; + bool allocationCheck = + !allocatedViewTags.contains(newChildShadowView.tag); + bool shouldCreateView = + shouldRememberAllocatedViews_ ? allocationCheck : revisionCheck; + if (shouldCreateView) { + cppUpdatePropsMountItems.push_back( + CppMountItem::UpdatePropsMountItem(newChildShadowView)); + } + + // State + if (newChildShadowView.state) { + cppUpdateStateMountItems.push_back( + CppMountItem::UpdateStateMountItem(newChildShadowView)); + } + + // Padding: padding mountItems must be executed before layout props + // are updated in the view. This is necessary to ensure that events + // (resulting from layout changes) are dispatched with the correct + // padding information. + cppUpdatePaddingMountItems.push_back( + CppMountItem::UpdatePaddingMountItem( + mutation.newChildShadowView)); + + // Layout + cppUpdateLayoutMountItems.push_back( + CppMountItem::UpdateLayoutMountItem( + mutation.newChildShadowView)); + + // OverflowInset: This is the values indicating boundaries including + // children of the current view. The layout of current view may not + // change, and we separate this part from layout mount items to not + // pack too much data there. + if (useOverflowInset_) { + cppUpdateOverflowInsetMountItems.push_back( + CppMountItem::UpdateOverflowInsetMountItem( + newChildShadowView)); + } + } + + // EventEmitter + cppUpdateEventEmitterMountItems.push_back( + CppMountItem::UpdateEventEmitterMountItem( + mutation.newChildShadowView)); + + break; + } + default: { + break; + } + } + } + + if (shouldRememberAllocatedViews_ && + allocatedViewsIterator != allocatedViewRegistry_.end()) { + auto &views = allocatedViewsIterator->second; + for (auto const &mutation : mutations) { + switch (mutation.type) { + case ShadowViewMutation::Create: + views.insert(mutation.newChildShadowView.tag); + break; + case ShadowViewMutation::Delete: + views.erase(mutation.oldChildShadowView.tag); + break; + default: + break; + } + } + } + } + + // We now have all the information we need, including ordering of mount items, + // to know exactly how much space must be allocated + int batchMountItemIntsSize = 0; + int batchMountItemObjectsSize = 0; + computeBufferSizes( + batchMountItemIntsSize, + batchMountItemObjectsSize, + cppCommonMountItems, + cppDeleteMountItems, + cppUpdatePropsMountItems, + cppUpdateStateMountItems, + cppUpdatePaddingMountItems, + cppUpdateLayoutMountItems, + cppUpdateOverflowInsetMountItems, + cppUpdateEventEmitterMountItems); + + static auto createMountItemsIntBufferBatchContainer = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod( + jint, jintArray, jtypeArray, jint)>( + "createIntBufferBatchMountItem"); + + static auto scheduleMountItem = jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("scheduleMountItem"); + + if (batchMountItemIntsSize == 0) { + auto finishTransactionEndTime = telemetryTimePointNow(); + + scheduleMountItem( + javaUIManager_, + nullptr, + telemetry.getRevisionNumber(), + telemetryTimePointToMilliseconds(telemetry.getCommitStartTime()), + telemetryTimePointToMilliseconds(telemetry.getDiffStartTime()), + telemetryTimePointToMilliseconds(telemetry.getDiffEndTime()), + telemetryTimePointToMilliseconds(telemetry.getLayoutStartTime()), + telemetryTimePointToMilliseconds(telemetry.getLayoutEndTime()), + telemetryTimePointToMilliseconds(finishTransactionStartTime), + telemetryTimePointToMilliseconds(finishTransactionEndTime)); + return; + } + + // Allocate the intBuffer and object array, now that we know exact sizes + // necessary + // TODO: don't allocate at all if size is zero + jintArray intBufferArray = env->NewIntArray(batchMountItemIntsSize); + local_ref> objBufferArray = + JArrayClass::newArray(batchMountItemObjectsSize); + + // Fill in arrays + int intBufferPosition = 0; + int objBufferPosition = 0; + int prevMountItemType = -1; + jint temp[6]; + for (int i = 0; i < cppCommonMountItems.size(); i++) { + const auto &mountItem = cppCommonMountItems[i]; + const auto &mountItemType = mountItem.type; + + // Get type here, and count forward how many items of this type are in a + // row. Write preamble to any common type here. + if (prevMountItemType != mountItemType) { + int numSameItemTypes = 1; + for (int j = i + 1; j < cppCommonMountItems.size() && + cppCommonMountItems[j].type == mountItemType; + j++) { + numSameItemTypes++; + } + + writeIntBufferTypePreamble( + mountItemType, + numSameItemTypes, + env, + intBufferArray, + intBufferPosition); + } + prevMountItemType = mountItemType; + + // TODO: multi-create, multi-insert, etc + if (mountItemType == CppMountItem::Type::Create) { + local_ref componentName = + getPlatformComponentName(mountItem.newChildShadowView); + + int isLayoutable = + mountItem.newChildShadowView.layoutMetrics != EmptyLayoutMetrics ? 1 + : 0; + + local_ref props = + castReadableMap(ReadableNativeMap::newObjectCxxArgs( + mountItem.newChildShadowView.props->rawProps)); + + // Do not hold onto Java object from C + // We DO want to hold onto C object from Java, since we don't know the + // lifetime of the Java object + local_ref javaStateWrapper = nullptr; + if (mountItem.newChildShadowView.state != nullptr) { + javaStateWrapper = StateWrapperImpl::newObjectJavaArgs(); + StateWrapperImpl *cStateWrapper = cthis(javaStateWrapper); + cStateWrapper->state_ = mountItem.newChildShadowView.state; + } + + // Do not hold a reference to javaEventEmitter from the C++ side. + SharedEventEmitter eventEmitter = + mountItem.newChildShadowView.eventEmitter; + auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); + EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); + if (enableEventEmitterRawPointer_) { + cEventEmitter->eventEmitterPointer = eventEmitter.get(); + } else { + cEventEmitter->eventEmitter = eventEmitter; + } + temp[0] = mountItem.newChildShadowView.tag; + temp[1] = isLayoutable; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 2, temp); + intBufferPosition += 2; + + (*objBufferArray)[objBufferPosition++] = componentName.get(); + (*objBufferArray)[objBufferPosition++] = props.get(); + (*objBufferArray)[objBufferPosition++] = + javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr; + (*objBufferArray)[objBufferPosition++] = javaEventEmitter.get(); + } else if (mountItemType == CppMountItem::Type::Insert) { + temp[0] = mountItem.newChildShadowView.tag; + temp[1] = mountItem.parentShadowView.tag; + temp[2] = mountItem.index; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp); + intBufferPosition += 3; + } else if (mountItemType == CppMountItem::Remove) { + temp[0] = mountItem.oldChildShadowView.tag; + temp[1] = mountItem.parentShadowView.tag; + temp[2] = mountItem.index; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 3, temp); + intBufferPosition += 3; + } else { + LOG(ERROR) << "Unexpected CppMountItem type"; + } + } + if (!cppUpdatePropsMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::UpdateProps, + cppUpdatePropsMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppUpdatePropsMountItems) { + temp[0] = mountItem.newChildShadowView.tag; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); + intBufferPosition += 1; + + auto newProps = mountItem.newChildShadowView.props->rawProps; + local_ref newPropsReadableMap = + castReadableMap(ReadableNativeMap::newObjectCxxArgs(newProps)); + (*objBufferArray)[objBufferPosition++] = newPropsReadableMap.get(); + } + } + if (!cppUpdateStateMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::UpdateState, + cppUpdateStateMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppUpdateStateMountItems) { + temp[0] = mountItem.newChildShadowView.tag; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); + intBufferPosition += 1; + + auto state = mountItem.newChildShadowView.state; + // Do not hold onto Java object from C + // We DO want to hold onto C object from Java, since we don't know the + // lifetime of the Java object + local_ref javaStateWrapper = nullptr; + if (state != nullptr) { + javaStateWrapper = StateWrapperImpl::newObjectJavaArgs(); + StateWrapperImpl *cStateWrapper = cthis(javaStateWrapper); + cStateWrapper->state_ = state; + } + + (*objBufferArray)[objBufferPosition++] = + (javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr); + } + } + if (!cppUpdatePaddingMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::UpdatePadding, + cppUpdatePaddingMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppUpdatePaddingMountItems) { + auto layoutMetrics = mountItem.newChildShadowView.layoutMetrics; + auto pointScaleFactor = layoutMetrics.pointScaleFactor; + auto contentInsets = layoutMetrics.contentInsets; + + int left = floor(scale(contentInsets.left, pointScaleFactor)); + int top = floor(scale(contentInsets.top, pointScaleFactor)); + int right = floor(scale(contentInsets.right, pointScaleFactor)); + int bottom = floor(scale(contentInsets.bottom, pointScaleFactor)); + + temp[0] = mountItem.newChildShadowView.tag; + temp[1] = left; + temp[2] = top; + temp[3] = right; + temp[4] = bottom; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 5, temp); + intBufferPosition += 5; + } + } + if (!cppUpdateLayoutMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::UpdateLayout, + cppUpdateLayoutMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppUpdateLayoutMountItems) { + auto layoutMetrics = mountItem.newChildShadowView.layoutMetrics; + auto pointScaleFactor = layoutMetrics.pointScaleFactor; + auto frame = layoutMetrics.frame; + + int x = round(scale(frame.origin.x, pointScaleFactor)); + int y = round(scale(frame.origin.y, pointScaleFactor)); + int w = round(scale(frame.size.width, pointScaleFactor)); + int h = round(scale(frame.size.height, pointScaleFactor)); + int displayType = + toInt(mountItem.newChildShadowView.layoutMetrics.displayType); + + temp[0] = mountItem.newChildShadowView.tag; + temp[1] = x; + temp[2] = y; + temp[3] = w; + temp[4] = h; + temp[5] = displayType; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 6, temp); + intBufferPosition += 6; + } + } + if (!cppUpdateOverflowInsetMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::UpdateOverflowInset, + cppUpdateOverflowInsetMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppUpdateOverflowInsetMountItems) { + auto layoutMetrics = mountItem.newChildShadowView.layoutMetrics; + auto pointScaleFactor = layoutMetrics.pointScaleFactor; + auto overflowInset = layoutMetrics.overflowInset; + + int overflowInsetLeft = + round(scale(overflowInset.left, pointScaleFactor)); + int overflowInsetTop = round(scale(overflowInset.top, pointScaleFactor)); + int overflowInsetRight = + round(scale(overflowInset.right, pointScaleFactor)); + int overflowInsetBottom = + round(scale(overflowInset.bottom, pointScaleFactor)); + + temp[0] = mountItem.newChildShadowView.tag; + temp[1] = overflowInsetLeft; + temp[2] = overflowInsetTop; + temp[3] = overflowInsetRight; + temp[4] = overflowInsetBottom; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 5, temp); + intBufferPosition += 5; + } + } + if (!cppUpdateEventEmitterMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::UpdateEventEmitter, + cppUpdateEventEmitterMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppUpdateEventEmitterMountItems) { + temp[0] = mountItem.newChildShadowView.tag; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); + intBufferPosition += 1; + + SharedEventEmitter eventEmitter = + mountItem.newChildShadowView.eventEmitter; + + // Do not hold a reference to javaEventEmitter from the C++ side. + auto javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); + EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); + if (enableEventEmitterRawPointer_) { + cEventEmitter->eventEmitterPointer = eventEmitter.get(); + } else { + cEventEmitter->eventEmitter = eventEmitter; + } + + (*objBufferArray)[objBufferPosition++] = javaEventEmitter.get(); + } + } + + // Write deletes last - so that all prop updates, etc, for the tag in the same + // batch don't fail. Without additional machinery, moving deletes here + // requires that the differ never produces "DELETE...CREATE" in that order for + // the same tag. It's nice to be able to batch all similar operations together + // for space efficiency. + if (!cppDeleteMountItems.empty()) { + writeIntBufferTypePreamble( + CppMountItem::Type::Delete, + cppDeleteMountItems.size(), + env, + intBufferArray, + intBufferPosition); + + for (const auto &mountItem : cppDeleteMountItems) { + temp[0] = mountItem.oldChildShadowView.tag; + env->SetIntArrayRegion(intBufferArray, intBufferPosition, 1, temp); + intBufferPosition += 1; + } + } + + // If there are no items, we pass a nullptr instead of passing the object + // through the JNI + auto batch = createMountItemsIntBufferBatchContainer( + javaUIManager_, + surfaceId, + batchMountItemIntsSize == 0 ? nullptr : intBufferArray, + batchMountItemObjectsSize == 0 ? nullptr : objBufferArray.get(), + revisionNumber); + + auto finishTransactionEndTime = telemetryTimePointNow(); + + scheduleMountItem( + javaUIManager_, + batch.get(), + telemetry.getRevisionNumber(), + telemetryTimePointToMilliseconds(telemetry.getCommitStartTime()), + telemetryTimePointToMilliseconds(telemetry.getDiffStartTime()), + telemetryTimePointToMilliseconds(telemetry.getDiffEndTime()), + telemetryTimePointToMilliseconds(telemetry.getLayoutStartTime()), + telemetryTimePointToMilliseconds(telemetry.getLayoutEndTime()), + telemetryTimePointToMilliseconds(finishTransactionStartTime), + telemetryTimePointToMilliseconds(finishTransactionEndTime)); + + env->DeleteLocalRef(intBufferArray); +} + +void FabricMountingManager::preallocateShadowView( + SurfaceId surfaceId, + ShadowView const &shadowView) { + if (shouldRememberAllocatedViews_) { + std::lock_guard lock(allocatedViewsMutex_); + auto allocatedViewsIterator = allocatedViewRegistry_.find(surfaceId); + if (allocatedViewsIterator == allocatedViewRegistry_.end()) { + return; + } + auto &allocatedViews = allocatedViewsIterator->second; + if (allocatedViews.contains(shadowView.tag)) { + return; + } + allocatedViews.insert(shadowView.tag); + } + + bool isLayoutableShadowNode = shadowView.layoutMetrics != EmptyLayoutMetrics; + + static auto preallocateView = jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("preallocateView"); + + // Do not hold onto Java object from C + // We DO want to hold onto C object from Java, since we don't know the + // lifetime of the Java object + local_ref javaStateWrapper = nullptr; + if (shadowView.state != nullptr) { + javaStateWrapper = StateWrapperImpl::newObjectJavaArgs(); + StateWrapperImpl *cStateWrapper = cthis(javaStateWrapper); + cStateWrapper->state_ = shadowView.state; + } + + // Do not hold a reference to javaEventEmitter from the C++ side. + local_ref javaEventEmitter = nullptr; + if (enableEarlyEventEmitterUpdate_) { + SharedEventEmitter eventEmitter = shadowView.eventEmitter; + if (eventEmitter != nullptr) { + javaEventEmitter = EventEmitterWrapper::newObjectJavaArgs(); + EventEmitterWrapper *cEventEmitter = cthis(javaEventEmitter); + if (enableEventEmitterRawPointer_) { + cEventEmitter->eventEmitterPointer = eventEmitter.get(); + } else { + cEventEmitter->eventEmitter = eventEmitter; + } + } + } + + local_ref props = castReadableMap( + ReadableNativeMap::newObjectCxxArgs(shadowView.props->rawProps)); + auto component = getPlatformComponentName(shadowView); + + preallocateView( + javaUIManager_, + surfaceId, + shadowView.tag, + component.get(), + props.get(), + (javaStateWrapper != nullptr ? javaStateWrapper.get() : nullptr), + (javaEventEmitter != nullptr ? javaEventEmitter.get() : nullptr), + isLayoutableShadowNode); +} + +void FabricMountingManager::dispatchCommand( + ShadowView const &shadowView, + std::string const &commandName, + folly::dynamic const &args) { + static auto dispatchCommand = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod( + "dispatchCommand"); + + local_ref command = make_jstring(commandName); + + local_ref argsArray = + castReadableArray(ReadableNativeArray::newObjectCxxArgs(args)); + + dispatchCommand( + javaUIManager_, + shadowView.surfaceId, + shadowView.tag, + command.get(), + argsArray.get()); +} + +void FabricMountingManager::sendAccessibilityEvent( + ShadowView const &shadowView, + std::string const &eventType) { + local_ref eventTypeStr = make_jstring(eventType); + + static auto sendAccessibilityEventFromJS = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod( + "sendAccessibilityEventFromJS"); + + sendAccessibilityEventFromJS( + javaUIManager_, shadowView.surfaceId, shadowView.tag, eventTypeStr.get()); +} + +void FabricMountingManager::setIsJSResponder( + ShadowView const &shadowView, + bool isJSResponder, + bool blockNativeResponder) { + static auto setJSResponder = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("setJSResponder"); + + static auto clearJSResponder = jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("clearJSResponder"); + + if (isJSResponder) { + setJSResponder( + javaUIManager_, + shadowView.surfaceId, + shadowView.tag, + // The closest non-flattened ancestor of the same value if the node is + // not flattened. For now, we don't support the case when the node can + // be flattened because the only component that uses this feature - + // ScrollView - cannot be flattened. + shadowView.tag, + (jboolean)blockNativeResponder); + } else { + clearJSResponder(javaUIManager_); + } +} + +void FabricMountingManager::onAnimationStarted() { + static auto layoutAnimationsStartedJNI = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("onAnimationStarted"); + + layoutAnimationsStartedJNI(javaUIManager_); +} + +void FabricMountingManager::onAllAnimationsComplete() { + static auto allAnimationsCompleteJNI = + jni::findClassStatic(UIManagerJavaDescriptor) + ->getMethod("onAllAnimationsComplete"); + + allAnimationsCompleteJNI(javaUIManager_); +} + +bool doesUseOverflowInset() { + static const auto reactFeatureFlagsJavaDescriptor = jni::findClassStatic( + FabricMountingManager::ReactFeatureFlagsJavaDescriptor); + static const auto doesUseOverflowInset = + reactFeatureFlagsJavaDescriptor->getStaticMethod( + "doesUseOverflowInset"); + return doesUseOverflowInset(reactFeatureFlagsJavaDescriptor); +} + +FabricMountingManager::FabricMountingManager( + std::shared_ptr &config, + global_ref &javaUIManager) + : javaUIManager_(javaUIManager) { + enableEarlyEventEmitterUpdate_ = + config->getBool("react_fabric:enable_early_event_emitter_update"); + enableEventEmitterRawPointer_ = + config->getBool("react_fabric:enable_event_emitter_wrapper_raw_pointer"); + disablePreallocateViews_ = + config->getBool("react_fabric:disabled_view_preallocation_android"); + disableRevisionCheckForPreallocation_ = + config->getBool("react_fabric:disable_revision_check_for_preallocation"); + useOverflowInset_ = doesUseOverflowInset(); + shouldRememberAllocatedViews_ = config->getBool( + "react_native_new_architecture:remember_views_on_mount_android"); +} + +} // namespace react +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h new file mode 100644 index 000000000000..0ac9ac2e4ab5 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include "FabricMountItem.h" + +#include +#include +#include +#include +#include +#include + +#include + +#include + +namespace facebook { +namespace react { + +class FabricMountingManager { + public: + constexpr static auto UIManagerJavaDescriptor = + "com/facebook/react/fabric/FabricUIManager"; + + constexpr static auto ReactFeatureFlagsJavaDescriptor = + "com/facebook/react/config/ReactFeatureFlags"; + + FabricMountingManager( + std::shared_ptr &config, + jni::global_ref &javaUIManager); + + void onSurfaceStart(SurfaceId surfaceId); + + void onSurfaceStop(SurfaceId surfaceId); + + void preallocateShadowView(SurfaceId surfaceId, ShadowView const &shadowView); + + void executeMount(MountingCoordinator::Shared const &mountingCoordinator); + + void dispatchCommand( + ShadowView const &shadowView, + std::string const &commandName, + folly::dynamic const &args); + + void sendAccessibilityEvent( + const ShadowView &shadowView, + std::string const &eventType); + + void setIsJSResponder( + ShadowView const &shadowView, + bool isJSResponder, + bool blockNativeResponder); + + void onAnimationStarted(); + + void onAllAnimationsComplete(); + + virtual ~FabricMountingManager() = default; + + private: + jni::global_ref javaUIManager_; + + std::recursive_mutex commitMutex_; + + butter::map> allocatedViewRegistry_{}; + std::recursive_mutex allocatedViewsMutex_; + + bool enableEventEmitterRawPointer_{false}; + bool enableEarlyEventEmitterUpdate_{false}; + bool disablePreallocateViews_{false}; + bool disableRevisionCheckForPreallocation_{false}; + bool useOverflowInset_{false}; + bool shouldRememberAllocatedViews_{false}; +}; + +} // namespace react +} // namespace facebook diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp index 63ab0918bca6..c742a4555bcd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h index 31e7b89609fc..1cc2615287f0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.cpp index 61fcec3d1c98..7ebf9b5247ee 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.cpp index 20cd8b928506..8e158a775ef2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.h index 4fe200a5ad40..faf602a2f005 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,6 @@ #include #include -#include #include #include @@ -22,7 +21,7 @@ namespace react { */ class ReactNativeConfigHolder : public ReactNativeConfig { public: - ReactNativeConfigHolder(jni::alias_ref reactNativeConfig) + explicit ReactNativeConfigHolder(jni::alias_ref reactNativeConfig) : reactNativeConfig_(make_global(reactNativeConfig)){}; bool getBool(const std::string ¶m) const override; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.cpp index eaa9398de60b..d3f27b2099df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h index 9193efc2518d..aa897e29ed55 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/StateWrapperImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,10 +29,6 @@ class StateWrapperImpl : public jni::HybridClass { jni::local_ref getStateMapBufferDataImpl(); jni::local_ref getStateDataImpl(); void updateStateImpl(NativeMap *map); - void updateStateWithFailureCallbackImpl( - NativeMap *map, - jni::alias_ref self, - int callbackRefId); State::Shared state_; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp index 0df81d2a8992..5eaf0a363484 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,7 +21,7 @@ void SurfaceHandlerBinding::setDisplayMode(jint mode) { } void SurfaceHandlerBinding::start() { - std::unique_lock lock(lifecycleMutex_); + std::unique_lock lock(lifecycleMutex_); if (surfaceHandler_.getStatus() != SurfaceHandler::Status::Running) { surfaceHandler_.start(); @@ -29,7 +29,7 @@ void SurfaceHandlerBinding::start() { } void SurfaceHandlerBinding::stop() { - std::unique_lock lock(lifecycleMutex_); + std::unique_lock lock(lifecycleMutex_); if (surfaceHandler_.getStatus() == SurfaceHandler::Status::Running) { surfaceHandler_.stop(); @@ -57,12 +57,7 @@ SurfaceHandlerBinding::initHybrid( jni::alias_ref, jint surfaceId, jni::alias_ref moduleName) { - auto env = jni::Environment::current(); - const char *moduleNameValue = - env->GetStringUTFChars(moduleName.get(), JNI_FALSE); - env->ReleaseStringUTFChars(moduleName.get(), moduleNameValue); - - return makeCxxInstance(surfaceId, moduleNameValue); + return makeCxxInstance(surfaceId, moduleName->toStdString()); } void SurfaceHandlerBinding::setLayoutConstraints( diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h index 27158eb2880b..7fdc4919d380 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -28,9 +28,6 @@ class SurfaceHandlerBinding : public jni::HybridClass { void setDisplayMode(jint mode); - void registerScheduler(std::shared_ptr scheduler); - void unregisterScheduler(std::shared_ptr scheduler); - jint getSurfaceId(); void setSurfaceId(jint surfaceId); jni::local_ref getModuleName(); @@ -53,7 +50,7 @@ class SurfaceHandlerBinding : public jni::HybridClass { SurfaceHandler const &getSurfaceHandler(); private: - mutable better::shared_mutex lifecycleMutex_; + mutable butter::shared_mutex lifecycleMutex_; const SurfaceHandler surfaceHandler_; jni::alias_ref jhybridobject_; diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/LayoutMetricsConversions.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/LayoutMetricsConversions.java index 6e803011904b..dba4d35cd67c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/LayoutMetricsConversions.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/LayoutMetricsConversions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java index ca2c7df44f14..240c0e203dc4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountItemDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java index 7e00a20defd0..43ff442ef6d3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/MountingManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -75,27 +75,21 @@ public MountingManager( mMountItemExecutor = mountItemExecutor; } - /** Starts surface and attaches the root view. */ - @AnyThread - public void startSurface( - final int surfaceId, @NonNull final View rootView, ThemedReactContext themedReactContext) { - SurfaceMountingManager mountingManager = startSurface(surfaceId); - mountingManager.attachRootView(rootView, themedReactContext); - } - /** * Starts surface without attaching the view. All view operations executed against that surface * will be queued until the view is attached. */ @AnyThread - public SurfaceMountingManager startSurface(final int surfaceId) { + public SurfaceMountingManager startSurface( + final int surfaceId, ThemedReactContext reactContext, @Nullable View rootView) { SurfaceMountingManager surfaceMountingManager = new SurfaceMountingManager( surfaceId, mJSResponderHandler, mViewManagerRegistry, mRootViewManager, - mMountItemExecutor); + mMountItemExecutor, + reactContext); // There could technically be a race condition here if addRootView is called twice from // different threads, though this is (probably) extremely unlikely, and likely an error. @@ -111,6 +105,11 @@ public SurfaceMountingManager startSurface(final int surfaceId) { } mMostRecentSurfaceMountingManager = mSurfaceIdToManager.get(surfaceId); + + if (rootView != null) { + surfaceMountingManager.attachRootView(rootView, reactContext); + } + return surfaceMountingManager; } @@ -314,8 +313,8 @@ public void updateProps(int reactTag, @Nullable ReadableMap props) { } /** - * Clears the JS Responder specified by {@link #setJSResponder(int, int, int, boolean)}. After - * this method is called, all the touch events are going to be handled by JS. + * Clears the JS Responder specified by {@link SurfaceMountingManager#setJSResponder}. After this + * method is called, all the touch events are going to be handled by JS. */ @UiThread public void clearJSResponder() { diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java index 737a29559aab..7422f18de05a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/SurfaceMountingManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,6 @@ import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.infer.annotation.ThreadConfined; -import com.facebook.react.bridge.ReactNoCrashSoftException; import com.facebook.react.bridge.ReactSoftExceptionLogger; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; @@ -33,6 +32,7 @@ import com.facebook.react.fabric.mounting.mountitems.MountItem; import com.facebook.react.touch.JSResponderHandler; import com.facebook.react.uimanager.IllegalViewOperationException; +import com.facebook.react.uimanager.ReactOverflowViewWithInset; import com.facebook.react.uimanager.ReactRoot; import com.facebook.react.uimanager.ReactStylesDiffMap; import com.facebook.react.uimanager.RootView; @@ -76,13 +76,15 @@ public SurfaceMountingManager( @NonNull JSResponderHandler jsResponderHandler, @NonNull ViewManagerRegistry viewManagerRegistry, @NonNull RootViewManager rootViewManager, - @NonNull MountItemExecutor mountItemExecutor) { + @NonNull MountItemExecutor mountItemExecutor, + @NonNull ThemedReactContext reactContext) { mSurfaceId = surfaceId; mJSResponderHandler = jsResponderHandler; mViewManagerRegistry = viewManagerRegistry; mRootViewManager = rootViewManager; mMountItemExecutor = mountItemExecutor; + mThemedReactContext = reactContext; } public boolean isStopped() { @@ -541,16 +543,12 @@ public void createView( } // We treat this as a perf problem and not a logical error. View Preallocation or unexpected // changes to Differ or C++ Binding could cause some redundant Create instructions. - // This is a NoCrash soft exception because we know there are cases where preallocation happens - // and a node is recreated: if a node is preallocated and then committed with revision 2+, - // an extra CREATE instruction will be generated. + // There are cases where preallocation happens and a node is recreated: if a node is + // preallocated and then committed with revision 2+, an extra CREATE instruction will be + // generated. // This represents a perf issue only, not a correctness issue. In the future we need to // refactor View preallocation to correct the currently incorrect assumptions. if (getNullableViewState(reactTag) != null) { - ReactSoftExceptionLogger.logSoftException( - TAG, - new ReactNoCrashSoftException( - "Cannot CREATE view with tag [" + reactTag + "], already exists.")); return; } @@ -761,6 +759,35 @@ public void updatePadding(int reactTag, int left, int top, int right, int bottom viewManager.setPadding(viewToUpdate, left, top, right, bottom); } + @UiThread + public void updateOverflowInset( + int reactTag, + int overflowInsetLeft, + int overflowInsetTop, + int overflowInsetRight, + int overflowInsetBottom) { + if (isStopped()) { + return; + } + + ViewState viewState = getViewState(reactTag); + // Do not layout Root Views + if (viewState.mIsRoot) { + return; + } + + View viewToUpdate = viewState.mView; + if (viewToUpdate == null) { + throw new IllegalStateException("Unable to find View for tag: " + reactTag); + } + + if (viewToUpdate instanceof ReactOverflowViewWithInset) { + ((ReactOverflowViewWithInset) viewToUpdate) + .setOverflowInset( + overflowInsetLeft, overflowInsetTop, overflowInsetRight, overflowInsetBottom); + } + } + @UiThread public void updateState(final int reactTag, @Nullable StateWrapper stateWrapper) { UiThreadUtil.assertOnUiThread(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java index 29f3063cd46a..43b6d7120b99 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchCommandMountItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchIntCommandMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchIntCommandMountItem.java index 6f23f9b87799..b8f81a306ca5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchIntCommandMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchIntCommandMountItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchStringCommandMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchStringCommandMountItem.java index 1d76091b6ae0..ffb2221c0577 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchStringCommandMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/DispatchStringCommandMountItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java index 038596c6ac49..a8fae7d252df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/IntBufferBatchMountItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -49,6 +49,7 @@ public class IntBufferBatchMountItem implements MountItem { static final int INSTRUCTION_UPDATE_LAYOUT = 128; static final int INSTRUCTION_UPDATE_EVENT_EMITTER = 256; static final int INSTRUCTION_UPDATE_PADDING = 512; + static final int INSTRUCTION_UPDATE_OVERFLOW_INSET = 1024; private final int mSurfaceId; private final int mCommitNumber; @@ -163,11 +164,25 @@ public void execute(@NonNull MountingManager mountingManager) { int width = mIntBuffer[i++]; int height = mIntBuffer[i++]; int displayType = mIntBuffer[i++]; + surfaceMountingManager.updateLayout(reactTag, x, y, width, height, displayType); } else if (type == INSTRUCTION_UPDATE_PADDING) { surfaceMountingManager.updatePadding( mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++]); + } else if (type == INSTRUCTION_UPDATE_OVERFLOW_INSET) { + int reactTag = mIntBuffer[i++]; + int overflowInsetLeft = mIntBuffer[i++]; + int overflowInsetTop = mIntBuffer[i++]; + int overflowInsetRight = mIntBuffer[i++]; + int overflowInsetBottom = mIntBuffer[i++]; + + surfaceMountingManager.updateOverflowInset( + reactTag, + overflowInsetLeft, + overflowInsetTop, + overflowInsetRight, + overflowInsetBottom); } else if (type == INSTRUCTION_UPDATE_EVENT_EMITTER) { surfaceMountingManager.updateEventEmitter( mIntBuffer[i++], castToEventEmitter(mObjBuffer[j++])); @@ -251,6 +266,15 @@ public String toString() { mIntBuffer[i++], mIntBuffer[i++], mIntBuffer[i++])); + } else if (type == INSTRUCTION_UPDATE_OVERFLOW_INSET) { + s.append( + String.format( + "UPDATE OVERFLOWINSET [%d]: left:%d top:%d right:%d bottom:%d\n", + mIntBuffer[i++], + mIntBuffer[i++], + mIntBuffer[i++], + mIntBuffer[i++], + mIntBuffer[i++])); } else if (type == INSTRUCTION_UPDATE_EVENT_EMITTER) { j += 1; s.append(String.format("UPDATE EVENTEMITTER [%d]\n", mIntBuffer[i++])); diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItem.java index 5ec3aeea571a..9bc3995a4844 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/MountItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java index 5a0f5241bc8f..babc0142bdba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/PreAllocateViewMountItem.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java index dc69db7a04ab..6560895fa067 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk index 19a28eee5af2..21e87a443c09 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,12 +10,18 @@ include $(CLEAR_VARS) LOCAL_MODULE := jscexecutor LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS += -fvisibility=hidden -fexceptions -frtti LOCAL_STATIC_LIBRARIES := libjsireact jscruntime -LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libreactnativejni libjsi +LOCAL_SHARED_LIBRARIES := \ + libfb \ + libfbjni \ + libfolly_json \ + libjsi \ + libreactnativejni include $(BUILD_SHARED_LIBRARY) diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java index 09737c178b98..fc9298d74892 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,8 +14,13 @@ import com.facebook.soloader.SoLoader; @DoNotStrip -/* package */ class JSCExecutor extends JavaScriptExecutor { +/* package */ public class JSCExecutor extends JavaScriptExecutor { + static { + loadLibrary(); + } + + public static void loadLibrary() throws UnsatisfiedLinkError { SoLoader.loadLibrary("jscexecutor"); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java index 4795bf453a04..ddd913b77a35 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/JSCExecutorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp index e05dfec2ef98..60450b5c404b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/jscexecutor/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskConfig.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskConfig.java index f96152eaef74..78b99242b36a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java index d31c1371c3c8..b32d74a670d0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskEventListener.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskEventListener.java index 8181950303c3..0de53dbd195c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskRetryPolicy.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskRetryPolicy.java index 6e56ff6d32e4..6a8965f64e55 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskRetryPolicy.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/HeadlessJsTaskRetryPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/LinearCountingRetryPolicy.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/LinearCountingRetryPolicy.java index 0f14772c860c..eadbe5bfaabf 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/LinearCountingRetryPolicy.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/LinearCountingRetryPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java b/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java index d58a1ed0ef11..0fc8f7eebb7a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java +++ b/ReactAndroid/src/main/java/com/facebook/react/jstasks/NoRetryPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.java b/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.java index cbcd4aa6002d..0c9187982f8e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java b/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java index efad29c13444..7bfcdaf40317 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/annotations/ReactModuleList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.java b/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.java index 812c6b63403b..a44d43281e65 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfoProvider.java b/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfoProvider.java index 7adec57a2e00..c430ec2c8fd9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfoProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/model/ReactModuleInfoProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java b/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java index 373c78cc354a..729c609c3cd7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/module/processing/ReactModuleSpecProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java index ad148228cd9b..0ea17b3b52cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/accessibilityinfo/AccessibilityInfoModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -46,6 +46,19 @@ public void onTouchExplorationStateChanged(boolean enabled) { } } + // Android can listen for accessibility service enable with `accessibilityStateChange`, but + // `accessibilityState` conflicts with React Native props and confuses developers. Therefore, the + // name `accessibilityServiceChange` is used here instead. + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + private class ReactAccessibilityServiceChangeListener + implements AccessibilityManager.AccessibilityStateChangeListener { + + @Override + public void onAccessibilityStateChanged(boolean enabled) { + updateAndSendAccessibilityServiceChangeEvent(enabled); + } + } + // Listener that is notified when the global TRANSITION_ANIMATION_SCALE. private final ContentObserver animationScaleObserver = new ContentObserver(new Handler(Looper.getMainLooper())) { @@ -64,13 +77,16 @@ public void onChange(boolean selfChange, Uri uri) { private @Nullable AccessibilityManager mAccessibilityManager; private @Nullable ReactTouchExplorationStateChangeListener mTouchExplorationStateChangeListener; + private @Nullable ReactAccessibilityServiceChangeListener mAccessibilityServiceChangeListener; private final ContentResolver mContentResolver; private boolean mReduceMotionEnabled = false; private boolean mTouchExplorationEnabled = false; + private boolean mAccessibilityServiceEnabled = false; private int mRecommendedTimeout; private static final String REDUCE_MOTION_EVENT_NAME = "reduceMotionDidChange"; private static final String TOUCH_EXPLORATION_EVENT_NAME = "touchExplorationDidChange"; + private static final String ACCESSIBILITY_SERVICE_EVENT_NAME = "accessibilityServiceDidChange"; public AccessibilityInfoModule(ReactApplicationContext context) { super(context); @@ -79,8 +95,10 @@ public AccessibilityInfoModule(ReactApplicationContext context) { (AccessibilityManager) appContext.getSystemService(Context.ACCESSIBILITY_SERVICE); mContentResolver = getReactApplicationContext().getContentResolver(); mTouchExplorationEnabled = mAccessibilityManager.isTouchExplorationEnabled(); + mAccessibilityServiceEnabled = mAccessibilityManager.isEnabled(); mReduceMotionEnabled = this.getIsReduceMotionEnabledValue(); mTouchExplorationStateChangeListener = new ReactTouchExplorationStateChangeListener(); + mAccessibilityServiceChangeListener = new ReactAccessibilityServiceChangeListener(); } @Override @@ -106,6 +124,11 @@ public void isTouchExplorationEnabled(Callback successCallback) { successCallback.invoke(mTouchExplorationEnabled); } + @Override + public void isAccessibilityServiceEnabled(Callback successCallback) { + successCallback.invoke(mAccessibilityServiceEnabled); + } + private void updateAndSendReduceMotionChangeEvent() { boolean isReduceMotionEnabled = this.getIsReduceMotionEnabledValue(); @@ -134,16 +157,31 @@ private void updateAndSendTouchExplorationChangeEvent(boolean enabled) { } } + private void updateAndSendAccessibilityServiceChangeEvent(boolean enabled) { + if (mAccessibilityServiceEnabled != enabled) { + mAccessibilityServiceEnabled = enabled; + + ReactApplicationContext reactApplicationContext = getReactApplicationContextIfActiveOrWarn(); + if (reactApplicationContext != null) { + getReactApplicationContext() + .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) + .emit(ACCESSIBILITY_SERVICE_EVENT_NAME, mAccessibilityServiceEnabled); + } + } + } + @Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void onHostResume() { mAccessibilityManager.addTouchExplorationStateChangeListener( mTouchExplorationStateChangeListener); + mAccessibilityManager.addAccessibilityStateChangeListener(mAccessibilityServiceChangeListener); Uri transitionUri = Settings.Global.getUriFor(Settings.Global.TRANSITION_ANIMATION_SCALE); mContentResolver.registerContentObserver(transitionUri, false, animationScaleObserver); updateAndSendTouchExplorationChangeEvent(mAccessibilityManager.isTouchExplorationEnabled()); + updateAndSendAccessibilityServiceChangeEvent(mAccessibilityManager.isEnabled()); updateAndSendReduceMotionChangeEvent(); } @@ -152,6 +190,8 @@ public void onHostResume() { public void onHostPause() { mAccessibilityManager.removeTouchExplorationStateChangeListener( mTouchExplorationStateChangeListener); + mAccessibilityManager.removeAccessibilityStateChangeListener( + mAccessibilityServiceChangeListener); mContentResolver.unregisterContentObserver(animationScaleObserver); } @@ -160,6 +200,7 @@ public void onHostPause() { public void initialize() { getReactApplicationContext().addLifecycleEventListener(this); updateAndSendTouchExplorationChangeEvent(mAccessibilityManager.isTouchExplorationEnabled()); + updateAndSendAccessibilityServiceChangeEvent(mAccessibilityManager.isEnabled()); updateAndSendReduceMotionChangeEvent(); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java index ab47e66c526b..e5b941594718 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/appearance/AppearanceModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java index 321dd45cd713..25d10174fd76 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/appregistry/AppRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java index 4b5c08a4c31e..972cd971bae7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/appstate/AppStateModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobCollector.java b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobCollector.java index ae4a38060a0e..60e05a404d77 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobCollector.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobCollector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java index fa782cf9770e..a84a81cc1544 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobProvider.java b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobProvider.java index 96141bafb6a0..a5110807c3cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/BlobProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/FileReaderModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/FileReaderModule.java index 805d744cf0ec..2449ab60d6e7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/FileReaderModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/FileReaderModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk index 6c5a7224c78a..ff14f7bb5b90 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,12 +10,18 @@ include $(CLEAR_VARS) LOCAL_MODULE := reactnativeblob LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS += -fvisibility=hidden -fexceptions -frtti LOCAL_STATIC_LIBRARIES := libjsireact -LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libreactnativejni libjsi +LOCAL_SHARED_LIBRARIES := \ + libfb \ + libfbjni \ + libfolly_json \ + libjsi \ + libreactnativejni include $(BUILD_SHARED_LIBRARY) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.cpp b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.cpp index 285e881472aa..fd5e106631ca 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.h b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.h index 6cb79c052a3d..6f0943801c35 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.h +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/BlobCollector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/OnLoad.cpp index 54bb91af292d..12b7e7e699d8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/blob/jni/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java index 0a491f172a69..f1a5aefa3c8e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/bundleloader/NativeDevSplitBundleLoaderModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageStoreManager.java b/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageStoreManager.java index 0752be6e554c..f62bed56f9b7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageStoreManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/camera/ImageStoreManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java index fd152947efd4..88ab7b51bd04 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard/ClipboardModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java b/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java index 3e773d782b3b..561e59ab5987 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/common/ModuleDataCleaner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ChoreographerCompat.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ChoreographerCompat.java index 19f71b0cca7f..75346c427657 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ChoreographerCompat.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ChoreographerCompat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/DefaultHardwareBackBtnHandler.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/DefaultHardwareBackBtnHandler.java index 799a2e337c38..241704e6b516 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/DefaultHardwareBackBtnHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/DefaultHardwareBackBtnHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/DeviceEventManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/DeviceEventManagerModule.java index cf8231716433..5422c8d7cc0a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/DeviceEventManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/DeviceEventManagerModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java index bb5e4be1b1a3..8213e4205316 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ExceptionsManagerModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/HeadlessJsTaskSupportModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/HeadlessJsTaskSupportModule.java index ce9f6fc48c71..59597c7f19e7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/HeadlessJsTaskSupportModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/HeadlessJsTaskSupportModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/JSTimers.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/JSTimers.java index 4a3c8c08a995..74455dc16370 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/JSTimers.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/JSTimers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaScriptTimerExecutor.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaScriptTimerExecutor.java index 655d91985e15..768d63a93828 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaScriptTimerExecutor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaScriptTimerExecutor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java index c9329fb2f51e..f90205da5e13 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/JavaTimerManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionAwareActivity.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionAwareActivity.java index d590c996b81e..21c075c0b8db 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionAwareActivity.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionAwareActivity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionListener.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionListener.java index b6f20f4d2b12..7c93305b56bb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/PermissionListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/RCTNativeAppEventEmitter.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/RCTNativeAppEventEmitter.java index 47153f6cb447..c2cf5d03b1ed 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/RCTNativeAppEventEmitter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/RCTNativeAppEventEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java index 4ec763c878f1..0accdd22f273 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactChoreographer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java index 94a8a5eca4c0..52bbd3f72269 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/core/TimingModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java index b803f0d46b49..6f36af8ce384 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/AnimationsDebugModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevSettingsModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevSettingsModule.java index 5edda1a1c21c..a6f932523847 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevSettingsModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DevSettingsModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.java index 4417e144e114..a7f1e77093df 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/DidJSUpdateUiDuringFrameDetector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.java index df4b653cc9bf..f4197d63b7a9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/FpsDebugFrameCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java index 88ee3dbedf44..a274a64caa3d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/SourceCodeModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java index 118c8fdb276a..08a77564d557 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/debug/interfaces/DeveloperSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java index 8e7b79822104..9ee7adf29d0c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/deviceinfo/DeviceInfoModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.java b/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.java index f7ba9a132453..8bc0481f6869 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/AlertFragment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/DialogModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/DialogModule.java index 8a111555e5e1..2cb3f1e9aa6d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/DialogModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/dialog/DialogModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/fabric/ReactFabric.java b/ReactAndroid/src/main/java/com/facebook/react/modules/fabric/ReactFabric.java index afdc96ed6b51..46bd31ba032d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/fabric/ReactFabric.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/fabric/ReactFabric.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java index 2dc27d679cc3..b47c4d15a093 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/FrescoModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactNetworkImageRequest.java b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactNetworkImageRequest.java index 789fcc4d5eee..1f1e936a6e0b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactNetworkImageRequest.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactNetworkImageRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.java b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.java index 6ee5d11f91dc..18a7ce9d8d04 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/ReactOkHttpNetworkFetcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/SystraceRequestListener.java b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/SystraceRequestListener.java index 893315a3ebbc..12e5b5c3d86d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/SystraceRequestListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/fresco/SystraceRequestListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java index c2c54b93df4b..3f7aa3ff1301 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nManagerModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java index 7b98359ba69f..db6d8052420c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/i18nmanager/I18nUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.java index 71fb0a809c81..c2fb799d34e7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/image/ImageLoaderModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java index 98377c76f790..e0f5b87847fb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/intent/IntentModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/CookieJarContainer.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/CookieJarContainer.java index 95c0fcc78d99..339bee4e6592 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/CookieJarContainer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/CookieJarContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java index 529af0090f53..b48563b3fe34 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/HeaderUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/HeaderUtil.java index 44dddd2627ea..07485deffca4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/HeaderUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/HeaderUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkInterceptorCreator.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkInterceptorCreator.java index 81f4a3e549b5..6a2cebfe2bb8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkInterceptorCreator.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkInterceptorCreator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java index 9c97c468db14..55cfb20215a9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/NetworkingModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientFactory.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientFactory.java index fe43b97406a6..684d4a616511 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java index c9cd347831f9..291f4c6c8a7f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/OkHttpClientProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressListener.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressListener.java index 5dcbd1e98264..714ea9f902ae 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.java index ab03ee3e4210..3b15d62f7f13 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressRequestBody.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressResponseBody.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressResponseBody.java index b57b8d2b2727..e2bb720288b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressResponseBody.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressResponseBody.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressiveStringDecoder.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressiveStringDecoder.java index 46f9fbe675c1..a89865e3f741 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressiveStringDecoder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressiveStringDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ReactCookieJarContainer.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ReactCookieJarContainer.java index 497fb1f81a34..2f9cddd4d6ee 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ReactCookieJarContainer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ReactCookieJarContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/RequestBodyUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/RequestBodyUtil.java index d06162a36e0d..a7d5fcf415f6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/RequestBodyUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/RequestBodyUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ResponseUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ResponseUtil.java index 75015efb366f..8abf12b22b00 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/ResponseUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/ResponseUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/network/TLSSocketFactory.java b/ReactAndroid/src/main/java/com/facebook/react/modules/network/TLSSocketFactory.java index 1050eb1b0566..77798a81fc82 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/network/TLSSocketFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/network/TLSSocketFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java index 879481740de1..bb0001e0769a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java index ee826d69eb98..92d9b83ab510 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/share/ShareModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/sound/SoundManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/sound/SoundManagerModule.java index 8e1b122defb8..7e995eb7c9fd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/sound/SoundManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/sound/SoundManagerModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java index b4a4e80e6848..e8dc15272e9a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/statusbar/StatusBarModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncLocalStorageUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncLocalStorageUtil.java index 0a7c176871fc..d3e8fb9b3591 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncLocalStorageUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncLocalStorageUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageErrorUtil.java b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageErrorUtil.java index 7bef3e1c9da1..eaa59f4c2d05 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageErrorUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageErrorUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java index 4ba1a4ac2c65..1b33b4b83d7d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/AsyncStorageModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/ReactDatabaseSupplier.java b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/ReactDatabaseSupplier.java index 1245570b460d..ccf9fb9fe2aa 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/storage/ReactDatabaseSupplier.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/storage/ReactDatabaseSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java index c5453d39e81d..6f86abb28b7e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoHelpers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java index b2355c7ecbf6..5bc5192dee27 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/AndroidInfoModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java index 6278912404c9..d398c75bb29f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java @@ -1,7 +1,7 @@ /** - * @generated by scripts/bump-oss-version.js + * @generated by scripts/set-rn-version.js * - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +16,7 @@ public class ReactNativeVersion { public static final Map VERSION = MapBuilder.of( "major", 0, - "minor", 0, - "patch", 0, + "minor", 68, + "patch", 3, "prerelease", null); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.java index c646c946327e..fef2c1dac1b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/toast/ToastModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java index b911b7b0b505..10071358c120 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/vibration/VibrationModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java index 987374ca639d..92e5b9143b3f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.java index 06c046ffb92a..bbcc413dd88f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/FileIoHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/JSPackagerClient.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/JSPackagerClient.java index ff077ad47e2f..347b7784029a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/JSPackagerClient.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/JSPackagerClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java index 761959d58bf5..e7366fd2ddba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/NotificationOnlyHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/PackagerConnectionSettings.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/PackagerConnectionSettings.java index 255219b251dc..61526205f63e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/PackagerConnectionSettings.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/PackagerConnectionSettings.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.java index 69a417078f9f..6cb8cb7a8a9a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/ReconnectingWebSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestHandler.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestHandler.java index 106ceaca2bbc..af0a710cfe4d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestOnlyHandler.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestOnlyHandler.java index beadadab4f94..7edf0f404b7b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestOnlyHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/RequestOnlyHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/Responder.java b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/Responder.java index f38e51a5559c..4e3773ddcbf1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/Responder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/packagerconnection/Responder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java b/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java index 9ac447022451..6fbd70d42f2c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/processing/ReactPropertyProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/NativeModulePerfLogger.java b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/NativeModulePerfLogger.java index 56f9adfbbfb8..266eb927e818 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/NativeModulePerfLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/NativeModulePerfLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/Android.mk index fd0ff0d7fd64..04ab85dc0254 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -26,6 +26,7 @@ LOCAL_MODULE := reactperfloggerjni # Compile all local c++ files LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/reactperflogger/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) # Build the files in this directory as a shared library include $(BUILD_SHARED_LIBRARY) diff --git a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/JNativeModulePerfLogger.h b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/JNativeModulePerfLogger.h index 018d8de782de..362246c7945a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/JNativeModulePerfLogger.h +++ b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/JNativeModulePerfLogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/OnLoad.cpp index 4ac3d4764416..fa21e017741d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/reactperflogger/jni/reactperflogger/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/shell/MainPackageConfig.java b/ReactAndroid/src/main/java/com/facebook/react/shell/MainPackageConfig.java index 9b3127d73dc5..fb71a6b4b4ab 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/shell/MainPackageConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/react/shell/MainPackageConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java b/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java index 34dc28005784..6fc4a536e2b1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/shell/MainReactPackage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/surface/ReactStage.java b/ReactAndroid/src/main/java/com/facebook/react/surface/ReactStage.java index 14bb08565f35..4ae44ea31ba3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/surface/ReactStage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/surface/ReactStage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/touch/JSResponderHandler.java b/ReactAndroid/src/main/java/com/facebook/react/touch/JSResponderHandler.java index 5a2ff439e3f0..a43ee164cc1a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/touch/JSResponderHandler.java +++ b/ReactAndroid/src/main/java/com/facebook/react/touch/JSResponderHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/touch/OnInterceptTouchEventListener.java b/ReactAndroid/src/main/java/com/facebook/react/touch/OnInterceptTouchEventListener.java index 956ea81cec1d..f9f5c61d6fe5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/touch/OnInterceptTouchEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/touch/OnInterceptTouchEventListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java b/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java index bb8d0cd10635..8231a335a7be 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/touch/ReactHitSlopView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.java index 7701e1cf7cbb..70543c35d0d1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/touch/ReactInterceptingViewGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/CallInvokerHolderImpl.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/CallInvokerHolderImpl.java index c76bb1bc1097..3f1321a68704 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/CallInvokerHolderImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/CallInvokerHolderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java index 6a592ae02fb0..440037ab7cd9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java index 9dcd6126e0c3..d4aad22112e5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModuleManagerDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java index 36d7d1d010c4..5bb2a8ca9f7d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/TurboModulePerfLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder.java index ddef4d637133..42073a555e41 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/CallInvokerHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java index 6c80d059f5a3..1ce998e33af4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModuleRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModuleRegistry.java index 5da527fe217f..d46ab4be96bb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModuleRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModuleRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/Android.mk index b017546b19db..56a796474f3d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -19,15 +19,16 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall -LOCAL_SHARED_LIBRARIES = libfb libfbjni libreactnativeutilsjni +LOCAL_SHARED_LIBRARIES = libfb libfbjni libreactnativejni libruntimeexecutor -LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni libruntimeexecutor +LOCAL_STATIC_LIBRARIES = libcallinvoker libreactperfloggerjni # Name of this module. LOCAL_MODULE := callinvokerholder # Compile all local c++ files LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/CallInvokerHolder.cpp +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) # Build the files in this directory as a shared library include $(BUILD_STATIC_LIBRARY) @@ -56,6 +57,7 @@ LOCAL_STATIC_LIBRARIES = libcallinvokerholder libreactperfloggerjni # Compile all local c++ files LOCAL_SRC_FILES := $(LOCAL_PATH)/ReactCommon/TurboModuleManager.cpp $(LOCAL_PATH)/ReactCommon/OnLoad.cpp +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) # Build the files in this directory as a shared library include $(BUILD_SHARED_LIBRARY) diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/BUCK b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/BUCK index 4291e2ae40f1..448c7a47d922 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/BUCK @@ -11,6 +11,7 @@ rn_xplat_cxx_library( "ReactCommon/TurboModuleManager.h": "ReactCommon/TurboModuleManager.h", "ReactCommon/TurboModuleManagerDelegate.h": "ReactCommon/TurboModuleManagerDelegate.h", }, + fbandroid_allow_jni_merging = True, labels = ["supermodule:xplat/default/public.react_native.infra"], platforms = ANDROID, preprocessor_flags = [ diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.cpp b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.cpp index 1169dd2337e5..f2d610b5e0bd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.h b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.h index edb621ce6a07..5e64012dba8a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.h +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/CallInvokerHolder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/OnLoad.cpp index 63a0d05445e3..4e1f74c0a8b9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp index ce7a43e0c91a..3097d8da52f1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,7 +14,6 @@ #include #include #include -#include #include "TurboModuleManager.h" diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h index 6b8fd0669b86..26c13fd55064 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include diff --git a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManagerDelegate.h b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManagerDelegate.h index d98cb3901302..76485439ac3c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManagerDelegate.h +++ b/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni/ReactCommon/TurboModuleManagerDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java index 25579c4c292f..3c9c1eae3bb3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -137,6 +137,21 @@ public void setNativeId(@NonNull T view, @Nullable String nativeId) { ReactFindViewUtil.notifyViewRendered(view); } + @Override + @ReactProp(name = ViewProps.ACCESSIBILITY_LABELLED_BY) + public void setAccessibilityLabelledBy(@NonNull T view, @Nullable Dynamic nativeId) { + if (nativeId.isNull()) { + return; + } + if (nativeId.getType() == ReadableType.String) { + view.setTag(R.id.labelled_by, nativeId.asString()); + } else if (nativeId.getType() == ReadableType.Array) { + // On Android, this takes a single View as labeledBy. If an array is specified, set the first + // element in the tag. + view.setTag(R.id.labelled_by, nativeId.asArray().getString(0)); + } + } + @Override @ReactProp(name = ViewProps.ACCESSIBILITY_LABEL) public void setAccessibilityLabel(@NonNull T view, @Nullable String accessibilityLabel) { @@ -429,9 +444,17 @@ protected void onAfterUpdateTransaction(@NonNull T view) { @Override public @Nullable Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.builder() - .put("topAccessibilityAction", MapBuilder.of("registrationName", "onAccessibilityAction")) - .build(); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.builder() + .put( + "topAccessibilityAction", + MapBuilder.of("registrationName", "onAccessibilityAction")) + .build()); + return eventTypeConstants; } @Override @@ -462,4 +485,19 @@ public void setBorderTopRightRadius(T view, float borderRadius) { private void logUnsupportedPropertyWarning(String propName) { FLog.w(ReactConstants.TAG, "%s doesn't support property '%s'", getName(), propName); } + + @ReactProp(name = "pointerenter") + public void setPointerEnter(@NonNull T view, @Nullable boolean value) { + view.setTag(R.id.pointer_enter, value); + } + + @ReactProp(name = "pointerleave") + public void setPointerLeave(@NonNull T view, @Nullable boolean value) { + view.setTag(R.id.pointer_leave, value); + } + + @ReactProp(name = "pointermove") + public void setPointerMove(@NonNull T view, @Nullable boolean value) { + view.setTag(R.id.pointer_move, value); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManagerAdapter.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManagerAdapter.java index c0e21dece66f..6a19c5a7cd20 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManagerAdapter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManagerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; @@ -64,6 +65,9 @@ public void setImportantForAccessibility( @Override public void setNativeId(@NonNull T view, String nativeId) {} + @Override + public void setAccessibilityLabelledBy(@NonNull T view, Dynamic nativeId) {} + @Override public void setOpacity(@NonNull T view, float opacity) {} diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolver.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolver.java index 002477dbdbbc..fb9d15de2974 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolver.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolverManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolverManager.java index 9f519114ed70..75463b8c43ba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolverManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ComponentNameResolverManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java index 3caf9bcf44cb..c3a2c630563f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/DisplayMetricsHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java index 1a1cdd076422..2b096b1bbf0d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/FabricViewStateManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.java index def573a9b805..421942a4ad64 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/GuardedFrameCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/IViewManagerWithChildren.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/IViewManagerWithChildren.java index af160957ea98..8b9ea09e1486 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/IViewManagerWithChildren.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/IViewManagerWithChildren.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java index df596f43fc09..931f338e4bda 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/IllegalViewOperationException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java index 901961494ccb..275fe49d7639 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/JSTouchDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,6 @@ import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.common.ReactConstants; -import com.facebook.react.uimanager.common.UIManagerType; import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.react.uimanager.events.TouchEvent; import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper; @@ -51,23 +50,9 @@ public void onChildStartedNativeGesture( mTargetTag = -1; } - /** - * See Event.java. By contract, this surfaceId should be a valid SurfaceId in Fabric, and should - * ALWAYS return -1 in non-Fabric. - * - * @return - */ - private int getSurfaceId() { - if (mRootViewGroup != null - && mRootViewGroup instanceof ReactRoot - && ((ReactRoot) mRootViewGroup).getUIManagerType() == UIManagerType.FABRIC) { - if (mRootViewGroup.getContext() instanceof ThemedReactContext) { - ThemedReactContext context = (ThemedReactContext) mRootViewGroup.getContext(); - return context.getSurfaceId(); - } - return ((ReactRoot) mRootViewGroup).getRootViewTag(); - } - return -1; + public void onChildEndedNativeGesture(MotionEvent androidEvent, EventDispatcher eventDispatcher) { + // There should be only one child gesture at any given time. We can safely turn off the flag. + mChildIsHandlingNativeGesture = false; } /** @@ -94,7 +79,7 @@ public void handleTouchEvent(MotionEvent ev, EventDispatcher eventDispatcher) { mTargetTag = findTargetTagAndSetCoordinates(ev); eventDispatcher.dispatchEvent( TouchEvent.obtain( - getSurfaceId(), + UIManagerHelper.getSurfaceId(mRootViewGroup), mTargetTag, TouchEventType.START, ev, @@ -119,7 +104,7 @@ public void handleTouchEvent(MotionEvent ev, EventDispatcher eventDispatcher) { findTargetTagAndSetCoordinates(ev); eventDispatcher.dispatchEvent( TouchEvent.obtain( - getSurfaceId(), + UIManagerHelper.getSurfaceId(mRootViewGroup), mTargetTag, TouchEventType.END, ev, @@ -134,7 +119,7 @@ public void handleTouchEvent(MotionEvent ev, EventDispatcher eventDispatcher) { findTargetTagAndSetCoordinates(ev); eventDispatcher.dispatchEvent( TouchEvent.obtain( - getSurfaceId(), + UIManagerHelper.getSurfaceId(mRootViewGroup), mTargetTag, TouchEventType.MOVE, ev, @@ -146,7 +131,7 @@ public void handleTouchEvent(MotionEvent ev, EventDispatcher eventDispatcher) { // New pointer goes down, this can only happen after ACTION_DOWN is sent for the first pointer eventDispatcher.dispatchEvent( TouchEvent.obtain( - getSurfaceId(), + UIManagerHelper.getSurfaceId(mRootViewGroup), mTargetTag, TouchEventType.START, ev, @@ -158,7 +143,7 @@ public void handleTouchEvent(MotionEvent ev, EventDispatcher eventDispatcher) { // Exactly one of the pointers goes up eventDispatcher.dispatchEvent( TouchEvent.obtain( - getSurfaceId(), + UIManagerHelper.getSurfaceId(mRootViewGroup), mTargetTag, TouchEventType.END, ev, @@ -207,7 +192,7 @@ private void dispatchCancelEvent(MotionEvent androidEvent, EventDispatcher event Assertions.assertNotNull(eventDispatcher) .dispatchEvent( TouchEvent.obtain( - getSurfaceId(), + UIManagerHelper.getSurfaceId(mRootViewGroup), mTargetTag, TouchEventType.CANCEL, androidEvent, diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java index 5c6a7bff7d90..5cc1ad9e4cca 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -807,4 +807,22 @@ public void setPosition(@Nullable String position) { public void setShouldNotifyOnLayout(boolean shouldNotifyOnLayout) { super.setShouldNotifyOnLayout(shouldNotifyOnLayout); } + + @ReactProp(name = "pointerenter") + public void setShouldNotifyPointerEnter(boolean value) { + // This method exists to inject Native View configs in RN Android VR + // DO NOTHING + } + + @ReactProp(name = "pointerleave") + public void setShouldNotifyPointerLeave(boolean value) { + // This method exists to inject Native View configs in RN Android VR + // DO NOTHING + } + + @ReactProp(name = "pointermove") + public void setShouldNotifyPointerMove(boolean value) { + // This method exists to inject Native View configs in RN Android VR + // DO NOTHING + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.java index cf448bd58908..0d698f791896 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/MatrixMathHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.java index c5e90b95daf2..3f2954547d33 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/MeasureSpecAssertions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java index 1b7de286692e..e45f7dd805be 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeKind.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java index 5ca18f60b057..d5fafeb70fc8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java index 66e1cb38f3a9..31614ca9c6d6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NativeViewHierarchyOptimizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.java index d93321888eb5..6dfdf53601d6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/NoSuchNativeViewException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/OnLayoutEvent.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/OnLayoutEvent.java index d7eb8de6860c..4d771f59492b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/OnLayoutEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/OnLayoutEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.java index e4d9c7ee2243..b38c1beeeb05 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/PixelUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java index 508fc9487503..bf97d45b502f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/PointerEvents.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,8 @@ package com.facebook.react.uimanager; +import java.util.Locale; + /** * Possible values for pointer events that a view and its descendants should receive. See * https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events for more info. @@ -25,4 +27,20 @@ public enum PointerEvents { /** Container and all of its children receive touch events (like pointerEvents is unspecified). */ AUTO, ; + + public static PointerEvents parsePointerEvents(String pointerEventsStr) { + if (pointerEventsStr == null) { + return PointerEvents.AUTO; + } else { + return PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_")); + } + } + + public static boolean canBeTouchTarget(PointerEvents pointerEvents) { + return pointerEvents == AUTO || pointerEvents == PointerEvents.BOX_ONLY; + } + + public static boolean canChildrenBeTouchTarget(PointerEvents pointerEvents) { + return pointerEvents == PointerEvents.AUTO || pointerEvents == PointerEvents.BOX_NONE; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java index 9436df80d3f0..79693c11522e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactAccessibilityDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,6 +35,7 @@ import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.Event; import com.facebook.react.uimanager.events.EventDispatcher; +import com.facebook.react.uimanager.util.ReactFindViewUtil; import java.util.HashMap; /** @@ -191,6 +192,8 @@ public void handleMessage(Message msg) { }; } + @Nullable View mAccessibilityLabelledBy; + @Override public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCompat info) { super.onInitializeAccessibilityNodeInfo(host, info); @@ -200,6 +203,15 @@ public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfoCo setRole(info, accessibilityRole, host.getContext()); } + final Object accessibilityLabelledBy = host.getTag(R.id.labelled_by); + if (accessibilityLabelledBy != null) { + mAccessibilityLabelledBy = + ReactFindViewUtil.findView(host.getRootView(), (String) accessibilityLabelledBy); + if (mAccessibilityLabelledBy != null) { + info.setLabeledBy(mAccessibilityLabelledBy); + } + } + // state is changeable. final ReadableMap accessibilityState = (ReadableMap) host.getTag(R.id.accessibility_state); if (accessibilityState != null) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingProhibitedView.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingProhibitedView.java index c6ff728e0a46..66b1c72e0481 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingProhibitedView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingProhibitedView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroup.java index 9ac8ef5412db..9430dcd7f4ef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.java index 8c9399073af3..0616b16a76bc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactClippingViewGroupHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundView.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundView.java index f255d9cbaa37..dd1d7a9a2cce 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundViewGroup.java index 34e3cadc08e0..e46401da7af9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactCompoundViewGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactInvalidPropertyException.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactInvalidPropertyException.java index 954f7e7cb1de..f574371ae30b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactInvalidPropertyException.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactInvalidPropertyException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowView.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowView.java index 89c437e38696..6958e361ac26 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowViewWithInset.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowViewWithInset.java new file mode 100644 index 000000000000..6253463f8a19 --- /dev/null +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactOverflowViewWithInset.java @@ -0,0 +1,33 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.uimanager; + +import android.graphics.Rect; +import android.view.View; + +/** + * Interface that should be implemented by {@link View} subclasses that support {@code overflow} + * style and want to use the overflowInset values. This allows the overflow information to be used + * by {@link TouchTargetHelper} to determine if a View is touchable. + */ +public interface ReactOverflowViewWithInset extends ReactOverflowView { + /** + * Get the overflow inset rect values which indicate the extensions to the boundaries of current + * view that wraps all of its children views + * + * @return Rect of integers indicating the left, top, right, bottom pixel extensions. The values + * are non-positive (indicating enlarged boundaries). + */ + Rect getOverflowInset(); + + /** + * Set the overflow inset rect values which indicate the extensions to the boundaries of current + * view that wraps all of its children views + */ + void setOverflowInset(int left, int top, int right, int bottom); +} diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactPointerEventsView.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactPointerEventsView.java index 2f17fb74c150..cd35fb34218b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactPointerEventsView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactPointerEventsView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRoot.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRoot.java index 9ce17ea68095..ebfb0d002f49 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRoot.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRoot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRootViewTagGenerator.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRootViewTagGenerator.java index 13a6baf575b1..90d9ac63ad74 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRootViewTagGenerator.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactRootViewTagGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java index c21eaecad363..18da96c97c84 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java index 18aaad08112a..ad64a3a120a1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactShadowNodeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStylesDiffMap.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStylesDiffMap.java index df2878b7087a..504bedbfe220 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStylesDiffMap.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactStylesDiffMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactYogaConfigProvider.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactYogaConfigProvider.java index 0119ac83bbfd..a9da826a4c80 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactYogaConfigProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactYogaConfigProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.java index 749afca4598a..887ed96d1e58 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ReactZIndexedViewGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java index 94eef5e1ceb1..ca8fa5f65849 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ package com.facebook.react.uimanager; import android.view.MotionEvent; +import android.view.View; /** Interface for the root native view of a React native application. */ public interface RootView { @@ -16,7 +17,16 @@ public interface RootView { * Called when a child starts a native gesture (e.g. a scroll in a ScrollView). Should be called * from the child's onTouchIntercepted implementation. */ - void onChildStartedNativeGesture(MotionEvent androidEvent); + void onChildStartedNativeGesture(View childView, MotionEvent ev); + + /** @deprecated */ + void onChildStartedNativeGesture(MotionEvent ev); + + /** + * Called when a child ends a native gesture. Should be called from the child's onTouchIntercepted + * implementation. + */ + void onChildEndedNativeGesture(View childView, MotionEvent ev); void handleException(Throwable t); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewManager.java index 3e78ec077770..4393528caac2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewUtil.java index 2c2e35460b80..466b87f1b0e1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/RootViewUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.java index 6d9e7402c62e..3cee1ccda33b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ShadowNodeRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java index c27673bca8c4..ef65aae2f835 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/SimpleViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/StateWrapper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/StateWrapper.java index 8bec238604f6..c995bc3c8613 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/StateWrapper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/StateWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java index 15701d63618a..28cd1855473d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java index 05d2b48971b4..bfac2387e2c9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TouchTargetHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,9 @@ package com.facebook.react.uimanager; +import static com.facebook.react.uimanager.common.UIManagerType.FABRIC; + +import android.annotation.SuppressLint; import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.Rect; @@ -16,7 +19,9 @@ import androidx.annotation.Nullable; import com.facebook.react.bridge.JSApplicationIllegalArgumentException; import com.facebook.react.bridge.UiThreadUtil; +import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.touch.ReactHitSlopView; +import com.facebook.react.uimanager.common.ViewUtil; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; @@ -107,6 +112,7 @@ public static int findTargetTagAndCoordinatesForTouch( * @return If a target was found, returns a path through the view tree of all react tags that are * a container for the touch target, ordered from target to root (last element) */ + @SuppressLint("ResourceType") public static List findTargetPathAndCoordinatesForTouch( float eventX, float eventY, ViewGroup viewGroup, float[] viewCoords) { UiThreadUtil.assertOnUiThread(); @@ -119,9 +125,21 @@ public static List findTargetPathAndCoordinatesForTouch( View targetView = findTouchTargetViewWithPointerEvents(viewCoords, viewGroup, pathAccumulator); if (targetView != null) { - View reactTargetView = findClosestReactAncestor(targetView); - int targetTag = getTouchTargetForView(reactTargetView, viewCoords[0], viewCoords[1]); - if (targetTag != pathAccumulator.get(0)) { + View reactTargetView = targetView; + int firstReactAncestor = 0; + // Same logic as findClosestReactAncestor but also track the index + while (reactTargetView != null && reactTargetView.getId() <= 0) { + reactTargetView = (View) reactTargetView.getParent(); + firstReactAncestor++; + } + + if (firstReactAncestor > 0) { + // Drop non-React views from the path trace + pathAccumulator = pathAccumulator.subList(firstReactAncestor, pathAccumulator.size()); + } + + int targetTag = getTouchTargetForView(reactTargetView, eventX, eventY); + if (targetTag != reactTargetView.getId()) { pathAccumulator.add(0, targetTag); } } @@ -129,6 +147,7 @@ public static List findTargetPathAndCoordinatesForTouch( return pathAccumulator; } + @SuppressLint("ResourceType") private static View findClosestReactAncestor(View view) { while (view != null && view.getId() <= 0) { view = (View) view.getParent(); @@ -164,6 +183,31 @@ private static View findTouchTargetView( if (allowReturnTouchTargetTypes.contains(TouchTargetReturnType.CHILD) && view instanceof ViewGroup) { ViewGroup viewGroup = (ViewGroup) view; + if (!isTouchPointInView(eventCoords[0], eventCoords[1], view)) { + // We don't allow touches on views that are outside the bounds of an `overflow: hidden` and + // `overflow: scroll` View. + if (view instanceof ReactOverflowViewWithInset) { + // If the touch point is outside of the overflowinset for the view, we can safely ignore + // it. + if (ViewUtil.getUIManagerType(view.getId()) == FABRIC + && ReactFeatureFlags.doesUseOverflowInset() + && !isTouchPointInViewWithOverflowInset(eventCoords[0], eventCoords[1], view)) { + return null; + } + + @Nullable String overflow = ((ReactOverflowViewWithInset) view).getOverflow(); + if (ViewProps.HIDDEN.equals(overflow) || ViewProps.SCROLL.equals(overflow)) { + return null; + } + } + + // We don't allow touches on views that are outside the bounds and has clipChildren set to + // true. + if (viewGroup.getClipChildren()) { + return null; + } + } + int childrenCount = viewGroup.getChildCount(); // Consider z-index when determining the touch target. ReactZIndexedViewGroup zIndexedViewGroup = @@ -183,22 +227,7 @@ private static View findTouchTargetView( eventCoords[1] = childPoint.y; View targetView = findTouchTargetViewWithPointerEvents(eventCoords, child, pathAccumulator); if (targetView != null) { - // We don't allow touches on views that are outside the bounds of an `overflow: hidden` - // View - boolean inOverflowBounds = true; - if (viewGroup instanceof ReactOverflowView) { - @Nullable String overflow = ((ReactOverflowView) viewGroup).getOverflow(); - if ((ViewProps.HIDDEN.equals(overflow) || ViewProps.SCROLL.equals(overflow)) - && !isTouchPointInView(restoreX, restoreY, view)) { - inOverflowBounds = false; - } - } - if (inOverflowBounds) { - return targetView; - } else if (pathAccumulator != null) { - // Not a hit, reset the path found so far - pathAccumulator.clear(); - } + return targetView; } eventCoords[0] = restoreX; eventCoords[1] = restoreY; @@ -236,6 +265,16 @@ private static boolean isTouchPointInView(float x, float y, View view) { } } + private static boolean isTouchPointInViewWithOverflowInset(float x, float y, View view) { + if (!(view instanceof ReactOverflowViewWithInset)) { + return false; + } + + final Rect overflowInset = ((ReactOverflowViewWithInset) view).getOverflowInset(); + return (x >= overflowInset.left && x < view.getWidth() - overflowInset.right) + && (y >= overflowInset.top && y < view.getHeight() - overflowInset.bottom); + } + /** * Returns the coordinates of a touch in the child View. It is transform aware and will invert the * transform Matrix to find the true local points This code is taken from {@link diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.java index e7f790b05704..da72da4b8d57 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.java index 0a22785098c0..cc468e6f1419 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIBlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java index bce8995feeed..1549f364e2e2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementationProvider.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementationProvider.java index efc7703918ea..65b85ed22da2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementationProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementationProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java index 9effc356f7f0..6fff633ac9a4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -160,10 +160,18 @@ public static ReactContext getReactContext(View view) { } /** - * @return Get the ThemedReactContext associated with a View, if possible, and then call - * getSurfaceId on it. See above (getReactContext) for additional context. + * @return Gets the surfaceId for the {@link ThemedReactContext} associated with a View, if + * possible, and then call getSurfaceId on it. See above (getReactContext) for additional + * context. + *

For RootViews, the root's rootViewTag is returned + *

Returns -1 for non-Fabric views */ public static int getSurfaceId(View view) { + if (view instanceof ReactRoot) { + ReactRoot rootView = (ReactRoot) view; + return rootView.getUIManagerType() == UIManagerType.FABRIC ? rootView.getRootViewTag() : -1; + } + int reactTag = view.getId(); // In non-Fabric we don't have (or use) SurfaceId @@ -177,9 +185,8 @@ public static int getSurfaceId(View view) { } int surfaceId = getSurfaceId(context); - - // All Fabric-managed Views (should) have a ThemedReactContext attached. if (surfaceId == -1) { + // All Fabric-managed Views (should) have a ThemedReactContext attached. ReactSoftExceptionLogger.logSoftException( TAG, new IllegalStateException( diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java index b034d1c8faf8..bcf11bf677c3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -234,9 +234,6 @@ public void onCatalystInstanceDestroy() { mUIImplementation.onCatalystInstanceDestroyed(); ReactApplicationContext reactApplicationContext = getReactApplicationContext(); - if (ReactFeatureFlags.enableReactContextCleanupFix) { - reactApplicationContext.removeLifecycleEventListener(this); - } reactApplicationContext.unregisterComponentCallbacks(mMemoryTrimCallback); YogaNodePool.get().clear(); ViewManagerPropertyUpdater.clear(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java index 759df363a1c3..71b64cd2364f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -59,6 +59,9 @@ return MapBuilder.builder() .put("topContentSizeChange", MapBuilder.of(rn, "onContentSizeChange")) .put("topLayout", MapBuilder.of(rn, "onLayout")) + .put("topPointerEnter", MapBuilder.of(rn, "pointerenter")) + .put("topPointerLeave", MapBuilder.of(rn, "pointerleave")) + .put("topPointerMove", MapBuilder.of(rn, "pointermove")) .put("topLoadingError", MapBuilder.of(rn, "onLoadingError")) .put("topLoadingFinish", MapBuilder.of(rn, "onLoadingFinish")) .put("topLoadingStart", MapBuilder.of(rn, "onLoadingStart")) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java index 40a3730b7cba..93fe6baaea73 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleConstantsHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleListener.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleListener.java index 19163fd6c2d6..66614b9e4ac2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModuleListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java index 289b2774bf91..93ccb0a9fbf9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewAtIndex.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewAtIndex.java index 6cb8c37410a0..3ad0bc67baf7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewAtIndex.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewAtIndex.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewDefaults.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewDefaults.java index 60d1f31c4d4e..8cab4071bda2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewDefaults.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.java index 5ac255a993f9..96448f6c01a2 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupDrawingOrderHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java index a0c249d4d1b5..86054051773b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewGroupManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewHierarchyDumper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewHierarchyDumper.java index 056defbcbd61..26421911bddb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewHierarchyDumper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewHierarchyDumper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java index 6af66a6f0801..f27c5eddec71 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.java index 2957f491cd0f..42e9d8b2992d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerPropertyUpdater.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java index b01234dbb6dd..54c7d78d8cf7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerResolver.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerResolver.java index d00b30fe8046..05c75eb1bac6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerResolver.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java index f856e85d53cf..438ec3fd0b57 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -45,13 +45,11 @@ public static void clear() { protected final Method mSetter; protected final @Nullable Integer mIndex; /* non-null only for group setters */ - // The following Object arrays are used to prevent extra allocations from varargs when we call - // Method.invoke. It's safe for those objects to be static as we update properties in a single - // thread sequentially - private static final Object[] VIEW_MGR_ARGS = new Object[2]; - private static final Object[] VIEW_MGR_GROUP_ARGS = new Object[3]; - private static final Object[] SHADOW_ARGS = new Object[1]; - private static final Object[] SHADOW_GROUP_ARGS = new Object[2]; + // The following Object arrays are used to prevent extra allocations from varargs when we call. + private static final ThreadLocal VIEW_MGR_ARGS = createThreadLocalArray(2); + private static final ThreadLocal VIEW_MGR_GROUP_ARGS = createThreadLocalArray(3); + private static final ThreadLocal SHADOW_ARGS = createThreadLocalArray(1); + private static final ThreadLocal SHADOW_GROUP_ARGS = createThreadLocalArray(2); private PropSetter(ReactProp prop, String defaultType, Method setter) { mPropName = prop.name(); @@ -81,18 +79,19 @@ public String getPropType() { public void updateViewProp(ViewManager viewManager, View viewToUpdate, Object value) { try { + Object[] args; if (mIndex == null) { - VIEW_MGR_ARGS[0] = viewToUpdate; - VIEW_MGR_ARGS[1] = getValueOrDefault(value, viewToUpdate.getContext()); - mSetter.invoke(viewManager, VIEW_MGR_ARGS); - Arrays.fill(VIEW_MGR_ARGS, null); + args = VIEW_MGR_ARGS.get(); + args[0] = viewToUpdate; + args[1] = getValueOrDefault(value, viewToUpdate.getContext()); } else { - VIEW_MGR_GROUP_ARGS[0] = viewToUpdate; - VIEW_MGR_GROUP_ARGS[1] = mIndex; - VIEW_MGR_GROUP_ARGS[2] = getValueOrDefault(value, viewToUpdate.getContext()); - mSetter.invoke(viewManager, VIEW_MGR_GROUP_ARGS); - Arrays.fill(VIEW_MGR_GROUP_ARGS, null); + args = VIEW_MGR_GROUP_ARGS.get(); + args[0] = viewToUpdate; + args[1] = mIndex; + args[2] = getValueOrDefault(value, viewToUpdate.getContext()); } + mSetter.invoke(viewManager, args); + Arrays.fill(args, null); } catch (Throwable t) { FLog.e(ViewManager.class, "Error while updating prop " + mPropName, t); throw new JSApplicationIllegalArgumentException( @@ -106,16 +105,17 @@ public void updateViewProp(ViewManager viewManager, View viewToUpdate, Object va public void updateShadowNodeProp(ReactShadowNode nodeToUpdate, Object value) { try { + Object[] args; if (mIndex == null) { - SHADOW_ARGS[0] = getValueOrDefault(value, nodeToUpdate.getThemedContext()); - mSetter.invoke(nodeToUpdate, SHADOW_ARGS); - Arrays.fill(SHADOW_ARGS, null); + args = SHADOW_ARGS.get(); + args[0] = getValueOrDefault(value, nodeToUpdate.getThemedContext()); } else { - SHADOW_GROUP_ARGS[0] = mIndex; - SHADOW_GROUP_ARGS[1] = getValueOrDefault(value, nodeToUpdate.getThemedContext()); - mSetter.invoke(nodeToUpdate, SHADOW_GROUP_ARGS); - Arrays.fill(SHADOW_GROUP_ARGS, null); + args = SHADOW_GROUP_ARGS.get(); + args[0] = mIndex; + args[1] = getValueOrDefault(value, nodeToUpdate.getThemedContext()); } + mSetter.invoke(nodeToUpdate, args); + Arrays.fill(args, null); } catch (Throwable t) { FLog.e(ViewManager.class, "Error while updating prop " + mPropName, t); throw new JSApplicationIllegalArgumentException( @@ -574,4 +574,19 @@ private static void extractPropSettersFromShadowNodeClassDefinition( } } } + + private static ThreadLocal createThreadLocalArray(final int size) { + + if (size <= 0) { + return null; + } + + return new ThreadLocal() { + @Nullable + @Override + protected Object[] initialValue() { + return new Object[size]; + } + }; + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/YogaNodePool.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/YogaNodePool.java index 12c4fdc61918..9e4eeed4a8a0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/YogaNodePool.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/YogaNodePool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactProp.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactProp.java index 5fe59ae00414..b3f7e8fa4176 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactProp.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactProp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropGroup.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropGroup.java index a5c568ead37d..e4a301fe89b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropertyHolder.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropertyHolder.java index f4f33a2ec1a8..311388ca3643 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropertyHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/annotations/ReactPropertyHolder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.java index 0845903c97d2..1e1577caabfa 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/UIManagerType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.java index 15ee80ba11e8..be03cc75edc6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.java index 35450527dae2..915df10541ad 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/NotThreadSafeViewHierarchyUpdateDebugListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BatchEventDispatchedListener.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BatchEventDispatchedListener.java index b93bcadd76fa..798a0dcba97c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BatchEventDispatchedListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BatchEventDispatchedListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BlackHoleEventDispatcher.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BlackHoleEventDispatcher.java index 15abfde7a042..44ea8002acec 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BlackHoleEventDispatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/BlackHoleEventDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ContentSizeChangeEvent.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ContentSizeChangeEvent.java index d65c810b095f..6e85121b6900 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ContentSizeChangeEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ContentSizeChangeEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java index b205bdeb3c76..61665a11dd94 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/Event.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -159,7 +159,7 @@ public void onDispose() {} /** * Dispatch this event to JS using the given event emitter. Compatible with old and new renderer. * Instead of using this or dispatchModern, it is recommended that you simply override - * `getEventData`. In the future + * `getEventData`. */ @Deprecated public void dispatch(RCTEventEmitter rctEventEmitter) { @@ -192,25 +192,14 @@ protected int getEventCategory() { * non-null, this will use the RCTModernEventEmitter API. Otherwise, it falls back to the * old-style dispatch function. For Event classes that need to do something different, this method * can always be overridden entirely, but it is not recommended. - */ - public void dispatchModern(RCTModernEventEmitter rctEventEmitter) { - if (getSurfaceId() != -1) { - WritableMap eventData = getEventData(); - if (eventData != null) { - rctEventEmitter.receiveEvent(getSurfaceId(), getViewTag(), getEventName(), eventData); - return; - } - } - dispatch(rctEventEmitter); - } - - /** - * Dispatch this event to JS using a V2 version of dispatchModern. See all comments from - * `dispatchModern` - all still apply. This method additionally allows C++ to coalesce events - * (Fabric only). This will ONLY be called in an experimental path, and in Fabric only. + * + *

This method additionally allows C++ to coalesce events and detect continuous ones for + * concurrent mode (Fabric only). + * + * @see #dispatch */ @Deprecated - public void dispatchModernV2(RCTModernEventEmitter rctEventEmitter) { + public void dispatchModern(RCTModernEventEmitter rctEventEmitter) { if (getSurfaceId() != -1) { WritableMap eventData = getEventData(); if (eventData != null) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.java index 60c5a50df784..4cf9f7ef5b71 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventCategoryDef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java index 2e9ac90cc2c9..056d671143cb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.java index c972fe03ad13..8b00f7766e12 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,7 +13,6 @@ import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.bridge.UiThreadUtil; import com.facebook.react.common.MapBuilder; -import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.modules.core.ChoreographerCompat; import com.facebook.react.modules.core.ReactChoreographer; import com.facebook.react.uimanager.common.UIManagerType; @@ -368,11 +367,7 @@ public void run() { Systrace.endAsyncFlow( Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, event.getEventName(), event.getUniqueID()); - if (ReactFeatureFlags.useDispatchUniqueForCoalescableEvents) { - event.dispatchModernV2(mReactEventEmitter); - } else { - event.dispatchModern(mReactEventEmitter); - } + event.dispatchModern(mReactEventEmitter); event.dispose(); } clearEventsToDispatch(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherListener.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherListener.java index 424bdd583bb4..f12c37cccacf 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherProvider.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherProvider.java index 6f6537c068cf..e95aabfa1427 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherProvider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/EventDispatcherProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java index a16f43494a27..3c5f7efc6b7f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/LockFreeEventDispatcherImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -84,7 +84,7 @@ public void dispatchEvent(Event event) { listener.onEventDispatch(event); } - event.dispatchModernV2(mReactEventEmitter); + event.dispatchModern(mReactEventEmitter); event.dispose(); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/NativeGestureUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/NativeGestureUtil.java index 7323a48ed427..00d860593a74 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/NativeGestureUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/NativeGestureUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,6 +23,18 @@ public class NativeGestureUtil { * @param event the MotionEvent that caused the gesture to be started */ public static void notifyNativeGestureStarted(View view, MotionEvent event) { - RootViewUtil.getRootView(view).onChildStartedNativeGesture(event); + RootViewUtil.getRootView(view).onChildStartedNativeGesture(view, event); + } + + /** + * Helper method that should be called when a native view ends a native gesture (e.g. a native + * ScrollView takes control of a gesture stream and starts scrolling). This will handle + * dispatching the appropriate events to JS to make sure future gesture is not blocked. + * + * @param view the View ending the native gesture + * @param event the MotionEvent that caused the gesture to be ended + */ + public static void notifyNativeGestureEnded(View view, MotionEvent event) { + RootViewUtil.getRootView(view).onChildEndedNativeGesture(view, event); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.java index 06e7aa93664a..82e26d5f6a54 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTEventEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTModernEventEmitter.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTModernEventEmitter.java index 4466e07b11c6..d5939b74d8e4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTModernEventEmitter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/RCTModernEventEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,4 +30,6 @@ void receiveEvent( int customCoalesceKey, @Nullable WritableMap event, @EventCategoryDef int category); + + void receiveTouches(TouchEvent event); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ReactEventEmitter.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ReactEventEmitter.java index 1ab5400106e1..a1eb560914b6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ReactEventEmitter.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/ReactEventEmitter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -70,14 +70,27 @@ public void receiveEvent( @Override public void receiveTouches( String eventName, WritableArray touches, WritableArray changedIndices) { + /* + * This method should be unused by default processing pipeline, but leaving it here to make sure + * that any custom code using it in legacy renderer is compatible + */ Assertions.assertCondition(touches.size() > 0); int reactTag = touches.getMap(0).getInt(TARGET_KEY); @UIManagerType int uiManagerType = ViewUtil.getUIManagerType(reactTag); + if (uiManagerType == UIManagerType.DEFAULT && getEventEmitter(reactTag) != null) { + mRCTEventEmitter.receiveTouches(eventName, touches, changedIndices); + } + } + + @Override + public void receiveTouches(TouchEvent event) { + int reactTag = event.getViewTag(); + @UIManagerType int uiManagerType = ViewUtil.getUIManagerType(reactTag); if (uiManagerType == UIManagerType.FABRIC && mFabricEventEmitter != null) { - mFabricEventEmitter.receiveTouches(eventName, touches, changedIndices); + mFabricEventEmitter.receiveTouches(event); } else if (uiManagerType == UIManagerType.DEFAULT && getEventEmitter(reactTag) != null) { - mRCTEventEmitter.receiveTouches(eventName, touches, changedIndices); + TouchesHelper.sendTouchesLegacy(mRCTEventEmitter, event); } else { ReactSoftExceptionLogger.logSoftException( TAG, @@ -87,7 +100,7 @@ public void receiveTouches( + "] UIManagerType[" + uiManagerType + "] EventName[" - + eventName + + event.getEventName() + "]")); } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java index eb8b7a78a7e5..91cf784260c9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,7 +13,6 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.ReactSoftExceptionLogger; import com.facebook.react.bridge.SoftAssertions; -import com.facebook.react.config.ReactFeatureFlags; /** * An event representing the start, end or movement of a touch. Corresponds to a single {@link @@ -182,32 +181,15 @@ public short getCoalescingKey() { @Override public void dispatch(RCTEventEmitter rctEventEmitter) { - if (!hasMotionEvent()) { - ReactSoftExceptionLogger.logSoftException( - TAG, - new IllegalStateException( - "Cannot dispatch a TouchEvent that has no MotionEvent; the TouchEvent has been recycled")); - return; + if (verifyMotionEvent()) { + TouchesHelper.sendTouchesLegacy(rctEventEmitter, this); } - - TouchesHelper.sendTouchEvent(rctEventEmitter, this); } @Override public void dispatchModern(RCTModernEventEmitter rctEventEmitter) { - if (ReactFeatureFlags.useUpdatedTouchPreprocessing) { - TouchesHelper.sendTouchEventModern(rctEventEmitter, this, /* useDispatchV2 */ false); - } else { - dispatch(rctEventEmitter); - } - } - - @Override - public void dispatchModernV2(RCTModernEventEmitter rctEventEmitter) { - if (ReactFeatureFlags.useUpdatedTouchPreprocessing) { - TouchesHelper.sendTouchEventModern(rctEventEmitter, this, /* useDispatchV2 */ true); - } else { - dispatch(rctEventEmitter); + if (verifyMotionEvent()) { + rctEventEmitter.receiveTouches(this); } } @@ -237,8 +219,15 @@ public MotionEvent getMotionEvent() { return mMotionEvent; } - private boolean hasMotionEvent() { - return mMotionEvent != null; + private boolean verifyMotionEvent() { + if (mMotionEvent == null) { + ReactSoftExceptionLogger.logSoftException( + TAG, + new IllegalStateException( + "Cannot dispatch a TouchEvent that has no MotionEvent; the TouchEvent has been recycled")); + return false; + } + return true; } public TouchEventType getTouchEventType() { diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper.java index 1e0caea1b467..39ffadabd222 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventCoalescingKeyHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventType.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventType.java index 9a60a8c7197b..04c08c935aa4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchEventType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.java index 9b60f6f8030f..09bddb3298c6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/TouchesHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,6 +13,7 @@ import com.facebook.react.bridge.WritableArray; import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.PixelUtil; +import com.facebook.systrace.Systrace; /** Class responsible for generating catalyst touch events based on android {@link MotionEvent}. */ public class TouchesHelper { @@ -74,15 +75,16 @@ private static WritableMap[] createPointersArray(TouchEvent event) { /** * Generate and send touch event to RCTEventEmitter JS module associated with the given {@param - * context}. Touch event can encode multiple concurrent touches (pointers). + * context} for legacy renderer. Touch event can encode multiple concurrent touches (pointers). * * @param rctEventEmitter Event emitter used to execute JS module call * @param touchEvent native touch event to read pointers count and coordinates from */ - public static void sendTouchEvent(RCTEventEmitter rctEventEmitter, TouchEvent touchEvent) { + public static void sendTouchesLegacy(RCTEventEmitter rctEventEmitter, TouchEvent touchEvent) { TouchEventType type = touchEvent.getTouchEventType(); - WritableArray pointers = getWritableArray(createPointersArray(touchEvent)); + WritableArray pointers = + getWritableArray(/* copyObjects */ false, createPointersArray(touchEvent)); MotionEvent motionEvent = touchEvent.getMotionEvent(); // For START and END events send only index of the pointer that is associated with that event @@ -111,10 +113,11 @@ public static void sendTouchEvent(RCTEventEmitter rctEventEmitter, TouchEvent to * * @param eventEmitter emitter to dispatch event to * @param event the touch event to extract data from - * @param useDispatchV2 whether to dispatch additional data used by {@link Event#dispatchModernV2} */ - public static void sendTouchEventModern( - RCTModernEventEmitter eventEmitter, TouchEvent event, boolean useDispatchV2) { + public static void sendTouchEvent(RCTModernEventEmitter eventEmitter, TouchEvent event) { + Systrace.beginSection( + Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, + "TouchesHelper.sentTouchEventModern(" + event.getEventName() + ")"); TouchEventType type = event.getTouchEventType(); MotionEvent motionEvent = event.getMotionEvent(); @@ -158,31 +161,25 @@ public static void sendTouchEventModern( break; } - WritableArray touchesArray = getWritableArray(touches); - WritableArray changedTouchesArray = getWritableArray(/* copyObjects */ true, changedTouches); + for (WritableMap touchData : changedTouches) { + WritableMap eventData = touchData.copy(); + WritableArray changedTouchesArray = getWritableArray(/* copyObjects */ true, changedTouches); + WritableArray touchesArray = getWritableArray(/* copyObjects */ true, touches); - for (WritableMap eventData : changedTouches) { eventData.putArray(CHANGED_TOUCHES_KEY, changedTouchesArray); eventData.putArray(TOUCHES_KEY, touchesArray); - if (useDispatchV2) { - eventEmitter.receiveEvent( - event.getSurfaceId(), - event.getViewTag(), - event.getEventName(), - event.canCoalesce(), - 0, - eventData, - event.getEventCategory()); - } else { - eventEmitter.receiveEvent( - event.getSurfaceId(), event.getViewTag(), event.getEventName(), eventData); - } + eventEmitter.receiveEvent( + event.getSurfaceId(), + event.getViewTag(), + event.getEventName(), + event.canCoalesce(), + 0, + eventData, + event.getEventCategory()); } - } - private static WritableArray getWritableArray(WritableMap... objects) { - return getWritableArray(false, objects); + Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE); } private static WritableArray getWritableArray(boolean copyObjects, WritableMap... objects) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerDelegate.java index 1598b578877b..6bc0b1bc0449 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ import android.view.View; import androidx.annotation.Nullable; import com.facebook.react.bridge.ColorPropConverter; +import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.yoga.YogaConstants; @@ -84,6 +85,9 @@ public void setProperty(T view, String propName, @Nullable Object value) { case ViewProps.NATIVE_ID: mViewManager.setNativeId(view, (String) value); break; + case ViewProps.ACCESSIBILITY_LABELLED_BY: + mViewManager.setAccessibilityLabelledBy(view, (Dynamic) value); + break; case ViewProps.OPACITY: mViewManager.setOpacity(view, value == null ? 1.0f : ((Double) value).floatValue()); break; diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerInterface.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerInterface.java index 5423eeedd91a..cfdc791caf5f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerInterface.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/BaseViewManagerInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,7 @@ import android.view.View; import androidx.annotation.Nullable; +import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; @@ -49,6 +50,8 @@ public interface BaseViewManagerInterface { void setNativeId(T view, @Nullable String nativeId); + void setAccessibilityLabelledBy(T view, @Nullable Dynamic nativeId); + void setOpacity(T view, float opacity); void setRenderToHardwareTexture(T view, boolean useHWTexture); diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/FloatUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/FloatUtil.java index 18c62ddf4116..94add5350e3d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/FloatUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/FloatUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/Spacing.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/Spacing.java index 653db42877ff..36aeb9776da0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/Spacing.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/Spacing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewManagerDelegate.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewManagerDelegate.java index a464a10c97e1..f8ca8f7c2cf9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewManagerDelegate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewManagerDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewProps.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewProps.java index 61151919cc0d..661c3466dde9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewProps.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces/ViewProps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -152,6 +152,7 @@ public class ViewProps { public static final String ACCESSIBILITY_STATE = "accessibilityState"; public static final String ACCESSIBILITY_ACTIONS = "accessibilityActions"; public static final String ACCESSIBILITY_VALUE = "accessibilityValue"; + public static final String ACCESSIBILITY_LABELLED_BY = "accessibilityLabelledBy"; public static final String IMPORTANT_FOR_ACCESSIBILITY = "importantForAccessibility"; // DEPRECATED diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/Android.mk b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/Android.mk index a4085b466b0f..12dbce0696b7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/Android.mk +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,8 +10,18 @@ include $(CLEAR_VARS) LOCAL_MODULE := uimanagerjni LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) - -LOCAL_SHARED_LIBRARIES := libyoga libglog libfb libfbjni libglog_init libfolly_json libfolly_futures react_render_componentregistry librrc_native +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) + +LOCAL_SHARED_LIBRARIES := \ + libfb \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog \ + libglog_init \ + librrc_native \ + libyoga \ + react_render_componentregistry LOCAL_STATIC_LIBRARIES := diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.cpp b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.cpp index cbd69e2f4912..ec528b53e4ba 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.h b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.h index e8a128583171..33a667e96139 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.h +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/ComponentNameResolverManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/OnLoad.cpp b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/OnLoad.cpp index b7167dfbd9cc..4e153e824259 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/jni/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AbstractLayoutAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AbstractLayoutAnimation.java index 43a5ba39ee76..630d554237a9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AbstractLayoutAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AbstractLayoutAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AnimatedPropertyType.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AnimatedPropertyType.java index 81aee61e9c98..6eaa564362e8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AnimatedPropertyType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/AnimatedPropertyType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/BaseLayoutAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/BaseLayoutAnimation.java index 8f1109a16757..551690dc55a5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/BaseLayoutAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/BaseLayoutAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/InterpolatorType.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/InterpolatorType.java index ce0164fd286e..ec4c866c2e37 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/InterpolatorType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/InterpolatorType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.java index 046d757e2af9..9f926dba3b87 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationController.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.java index 7972795165fd..0f392cc267c5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationType.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationType.java index 1f6e49108080..b12335f51863 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutAnimationType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutCreateAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutCreateAnimation.java index 68572cf5cf75..e2d062e3f161 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutCreateAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutCreateAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutDeleteAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutDeleteAnimation.java index e1e951342be4..6da804add622 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutDeleteAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutDeleteAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutHandlingAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutHandlingAnimation.java index 6f59dacd6d5a..fe128d19c1b7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutHandlingAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutHandlingAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutUpdateAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutUpdateAnimation.java index 77de085da83b..b4757cf44d86 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutUpdateAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/LayoutUpdateAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/OpacityAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/OpacityAnimation.java index df0faed2a302..6d1c350a3a09 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/OpacityAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/OpacityAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java index 5270ce39503d..26789ecbbadb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/PositionAndSizeAnimation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/SimpleSpringInterpolator.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/SimpleSpringInterpolator.java index f7bcc6466dac..57304103e2e0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/SimpleSpringInterpolator.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/layoutanimation/SimpleSpringInterpolator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java index a1a199536cd6..c86e73199227 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/util/ReactFindViewUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/util/ExceptionDataHelper.java b/ReactAndroid/src/main/java/com/facebook/react/util/ExceptionDataHelper.java index 671706ed1d2a..a266dd8cf8fa 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/util/ExceptionDataHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/util/ExceptionDataHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.java b/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.java index 90a4b26f5c69..f35e5a8a5433 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.java +++ b/ReactAndroid/src/main/java/com/facebook/react/util/JSStackTrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/util/RCTLog.java b/ReactAndroid/src/main/java/com/facebook/react/util/RCTLog.java index 511190ebac65..823dac142565 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/util/RCTLog.java +++ b/ReactAndroid/src/main/java/com/facebook/react/util/RCTLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.java b/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.java index 6355251cb5c6..280ff714ac55 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.java +++ b/ReactAndroid/src/main/java/com/facebook/react/util/RNLog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/common/ContextUtils.java b/ReactAndroid/src/main/java/com/facebook/react/views/common/ContextUtils.java index 49970e81c97a..668df6e7ec6f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/common/ContextUtils.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/common/ContextUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.java b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.java index 6cf2dedc8453..3cebb40d7bdc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java index b3d9cc11bcdc..f3b50120c4bf 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/ReactDrawerLayoutManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -31,6 +31,7 @@ import com.facebook.react.views.drawer.events.DrawerOpenedEvent; import com.facebook.react.views.drawer.events.DrawerSlideEvent; import com.facebook.react.views.drawer.events.DrawerStateChangedEvent; +import java.util.HashMap; import java.util.Map; /** View Manager for {@link ReactDrawerLayout} components. */ @@ -153,12 +154,15 @@ public void closeDrawer(ReactDrawerLayout view) { } @Override + @ReactProp(name = "keyboardDismissMode") public void setKeyboardDismissMode(ReactDrawerLayout view, @Nullable String value) {} @Override + @ReactProp(name = "drawerBackgroundColor", customType = "Color") public void setDrawerBackgroundColor(ReactDrawerLayout view, @Nullable Integer value) {} @Override + @ReactProp(name = "statusBarBackgroundColor", customType = "Color") public void setStatusBarBackgroundColor(ReactDrawerLayout view, @Nullable Integer value) {} @Override @@ -210,12 +214,18 @@ public void receiveCommand( @Override public @Nullable Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.of( - DrawerSlideEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerSlide"), - DrawerOpenedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerOpen"), - DrawerClosedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerClose"), - DrawerStateChangedEvent.EVENT_NAME, - MapBuilder.of("registrationName", "onDrawerStateChanged")); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.of( + DrawerSlideEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerSlide"), + DrawerOpenedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerOpen"), + DrawerClosedEvent.EVENT_NAME, MapBuilder.of("registrationName", "onDrawerClose"), + DrawerStateChangedEvent.EVENT_NAME, + MapBuilder.of("registrationName", "onDrawerStateChanged"))); + return eventTypeConstants; } /** diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerClosedEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerClosedEvent.java index 29c724c1ada9..4e4d9eaa65a5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerClosedEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerClosedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerOpenedEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerOpenedEvent.java index d1402f593cec..46bfc8f1df98 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerOpenedEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerOpenedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerSlideEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerSlideEvent.java index 57f2ef5fa60a..0bba976967b4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerSlideEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerSlideEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerStateChangedEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerStateChangedEvent.java index 6a9f8e9fb06d..52091824e38a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerStateChangedEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/drawer/events/DrawerStateChangedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/BUCK b/ReactAndroid/src/main/java/com/facebook/react/views/image/BUCK index 40f0d2f5592b..a13531e19271 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/BUCK @@ -55,6 +55,7 @@ rn_android_library( react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_target("java/com/facebook/react/bridge:bridge"), react_native_target("java/com/facebook/react/common:common"), + react_native_target("java/com/facebook/react/config:config"), react_native_target("java/com/facebook/react/module/annotations:annotations"), react_native_target("java/com/facebook/react/uimanager:uimanager"), react_native_target("java/com/facebook/react/modules/fresco:fresco"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/GlobalImageLoadListener.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/GlobalImageLoadListener.java index 4a95dec48b60..745b910a133a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/GlobalImageLoadListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/GlobalImageLoadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java index 130cb67ad8b6..715d0871a713 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMethod.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMethod.java index 7fa830b588b6..bc4a924c2a6a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMethod.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java index c847b28c138d..54df4db60d3e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageResizeMode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/MultiPostprocessor.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/MultiPostprocessor.java index 7b3f52e93a99..3c880f32105a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/MultiPostprocessor.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/MultiPostprocessor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactCallerContextFactory.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactCallerContextFactory.java index cb1c6a336048..183ff6d3d0ee 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactCallerContextFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactCallerContextFactory.java @@ -1,7 +1,5 @@ -// (c) Facebook, Inc. and its affiliates. Confidential and proprietary. - /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageDownloadListener.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageDownloadListener.java index 336738e5d43b..e145e21e93f8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageDownloadListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageDownloadListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java index 646cc5fc5941..187958c6ee4d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,6 +24,7 @@ import com.facebook.react.uimanager.annotations.ReactProp; import com.facebook.react.uimanager.annotations.ReactPropGroup; import com.facebook.yoga.YogaConstants; +import java.util.HashMap; import java.util.Map; @ReactModule(name = ReactImageManager.REACT_CLASS) @@ -245,17 +246,23 @@ public void setHeaders(ReactImageView view, ReadableMap headers) { @Override public @Nullable Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.of( - ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD_START), - MapBuilder.of("registrationName", "onLoadStart"), - ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_PROGRESS), - MapBuilder.of("registrationName", "onProgress"), - ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD), - MapBuilder.of("registrationName", "onLoad"), - ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_ERROR), - MapBuilder.of("registrationName", "onError"), - ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD_END), - MapBuilder.of("registrationName", "onLoadEnd")); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.of( + ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD_START), + MapBuilder.of("registrationName", "onLoadStart"), + ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_PROGRESS), + MapBuilder.of("registrationName", "onProgress"), + ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD), + MapBuilder.of("registrationName", "onLoad"), + ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_ERROR), + MapBuilder.of("registrationName", "onError"), + ImageLoadEvent.eventNameForType(ImageLoadEvent.ON_LOAD_END), + MapBuilder.of("registrationName", "onLoadEnd"))); + return eventTypeConstants; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java index a25658a27f2b..b841ddbec1b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -48,6 +48,7 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.common.build.ReactBuildConfig; +import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.modules.fresco.ReactNetworkImageRequest; import com.facebook.react.uimanager.FloatUtil; import com.facebook.react.uimanager.PixelUtil; @@ -124,7 +125,7 @@ void getRadii(Bitmap source, float[] computedCornerRadii, float[] mappedRadii) { @Override public void process(Bitmap output, Bitmap source) { - cornerRadii(sComputedCornerRadii); + getCornerRadii(sComputedCornerRadii); output.setHasAlpha(true); if (FloatUtil.floatsEqual(sComputedCornerRadii[0], 0f) @@ -160,7 +161,6 @@ private class TilePostprocessor extends BasePostprocessor { @Override public CloseableReference process(Bitmap source, PlatformBitmapFactory bitmapFactory) { final Rect destRect = new Rect(0, 0, getWidth(), getHeight()); - mScaleType.getTransform( sTileMatrix, destRect, source.getWidth(), source.getHeight(), 0.0f, 0.0f); @@ -181,7 +181,7 @@ public CloseableReference process(Bitmap source, PlatformBitmapFactory b } } - private final List mSources; + private final List mSources = new LinkedList<>(); private @Nullable ImageSource mImageSource; private @Nullable ImageSource mCachedImageSource; @@ -194,12 +194,12 @@ public CloseableReference process(Bitmap source, PlatformBitmapFactory b private float mBorderWidth; private float mBorderRadius = YogaConstants.UNDEFINED; private @Nullable float[] mBorderCornerRadii; - private ScalingUtils.ScaleType mScaleType; + private ScalingUtils.ScaleType mScaleType = ImageResizeMode.defaultValue(); private Shader.TileMode mTileMode = ImageResizeMode.defaultTileMode(); private boolean mIsDirty; private final AbstractDraweeControllerBuilder mDraweeControllerBuilder; - private final RoundedCornerPostprocessor mRoundedCornerPostprocessor; - private final TilePostprocessor mTilePostprocessor; + private @Nullable RoundedCornerPostprocessor mRoundedCornerPostprocessor; + private @Nullable TilePostprocessor mTilePostprocessor; private @Nullable IterativeBoxBlurPostProcessor mIterativeBoxBlurPostProcessor; private @Nullable ReactImageDownloadListener mDownloadListener; private @Nullable ControllerListener mControllerForTesting; @@ -222,13 +222,9 @@ public ReactImageView( @Nullable GlobalImageLoadListener globalImageLoadListener, @Nullable Object callerContext) { super(context, buildHierarchy(context)); - mScaleType = ImageResizeMode.defaultValue(); mDraweeControllerBuilder = draweeControllerBuilder; - mRoundedCornerPostprocessor = new RoundedCornerPostprocessor(); - mTilePostprocessor = new TilePostprocessor(); mGlobalImageLoadListener = globalImageLoadListener; mCallerContext = callerContext; - mSources = new LinkedList<>(); } public void setShouldNotifyLoadEvents(boolean shouldNotify) { @@ -357,6 +353,11 @@ public void setBorderRadius(float borderRadius, int position) { public void setScaleType(ScalingUtils.ScaleType scaleType) { if (mScaleType != scaleType) { mScaleType = scaleType; + if (shouldUseRoundedCornerPostprocessing()) { + mRoundedCornerPostprocessor = new RoundedCornerPostprocessor(); + } else { + mRoundedCornerPostprocessor = null; + } mIsDirty = true; } } @@ -364,6 +365,11 @@ public void setScaleType(ScalingUtils.ScaleType scaleType) { public void setTileMode(Shader.TileMode tileMode) { if (mTileMode != tileMode) { mTileMode = tileMode; + if (isTiled()) { + mTilePostprocessor = new TilePostprocessor(); + } else { + mTilePostprocessor = null; + } mIsDirty = true; } } @@ -448,7 +454,7 @@ public void setFadeDuration(int durationMs) { // no worth marking as dirty if it already rendered.. } - private void cornerRadii(float[] computedCorners) { + private void getCornerRadii(float[] computedCorners) { float defaultBorderRadius = !YogaConstants.isUndefined(mBorderRadius) ? mBorderRadius : 0; computedCorners[0] = @@ -510,14 +516,9 @@ public void maybeUpdateView() { hierarchy.setPlaceholderImage(mLoadingImageDrawable, ScalingUtils.ScaleType.CENTER); } - boolean usePostprocessorScaling = - mScaleType != ScalingUtils.ScaleType.CENTER_CROP - && mScaleType != ScalingUtils.ScaleType.FOCUS_CROP; + getCornerRadii(sComputedCornerRadii); RoundingParams roundingParams = hierarchy.getRoundingParams(); - - cornerRadii(sComputedCornerRadii); - roundingParams.setCornersRadii( sComputedCornerRadii[0], sComputedCornerRadii[1], @@ -529,11 +530,9 @@ public void maybeUpdateView() { mBackgroundImageDrawable.setRadii(roundingParams.getCornersRadii()); hierarchy.setBackgroundImage(mBackgroundImageDrawable); } - - if (usePostprocessorScaling) { + if (shouldUseRoundedCornerPostprocessing()) { roundingParams.setCornersRadius(0); } - roundingParams.setBorder(mBorderColor, mBorderWidth); if (mOverlayColor != Color.TRANSPARENT) { roundingParams.setOverlayColor(mOverlayColor); @@ -548,13 +547,13 @@ public void maybeUpdateView() { : mImageSource.isResource() ? 0 : REMOTE_IMAGE_FADE_DURATION_MS); List postprocessors = new LinkedList<>(); - if (usePostprocessorScaling) { + if (mRoundedCornerPostprocessor != null) { postprocessors.add(mRoundedCornerPostprocessor); } if (mIterativeBoxBlurPostProcessor != null) { postprocessors.add(mIterativeBoxBlurPostProcessor); } - if (isTiled()) { + if (mTilePostprocessor != null) { postprocessors.add(mTilePostprocessor); } Postprocessor postprocessor = MultiPostprocessor.from(postprocessors); @@ -648,6 +647,12 @@ private boolean isTiled() { return mTileMode != Shader.TileMode.CLAMP; } + private boolean shouldUseRoundedCornerPostprocessing() { + return mScaleType != ScalingUtils.ScaleType.CENTER_CROP + && mScaleType != ScalingUtils.ScaleType.FOCUS_CROP + && ReactFeatureFlags.enableRoundedCornerPostprocessing; + } + private void setSourceImage() { mImageSource = null; if (mSources.isEmpty()) { diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ScaleTypeStartInside.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ScaleTypeStartInside.java index fda8d384ad51..a1888c3b0bef 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ScaleTypeStartInside.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ScaleTypeStartInside.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.java b/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.java index 065ebbe63668..94a3e1c8ace9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.java index 21532d9b7f78..8081d3f113b5 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/MultiSourceHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.java index 96ccd7e80d98..804e9d7b023e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ResourceDrawableIdHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostHelper.java index db9522926a3e..3a226c01549f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostShadowNode.java index 102fc6f17296..7288fe06faf6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ModalHostShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.java index d4f3394269c2..f078c599c7d8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,6 +24,7 @@ import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.react.viewmanagers.ModalHostViewManagerDelegate; import com.facebook.react.viewmanagers.ModalHostViewManagerInterface; +import java.util.HashMap; import java.util.Map; /** View manager for {@link ReactModalHostView} components. */ @@ -98,15 +99,19 @@ public void setVisible(ReactModalHostView view, boolean visible) { } @Override + @ReactProp(name = "presentationStyle") public void setPresentationStyle(ReactModalHostView view, @Nullable String value) {} @Override + @ReactProp(name = "animated") public void setAnimated(ReactModalHostView view, boolean value) {} @Override + @ReactProp(name = "supportedOrientations") public void setSupportedOrientations(ReactModalHostView view, @Nullable ReadableArray value) {} @Override + @ReactProp(name = "identifier") public void setIdentifier(ReactModalHostView view, int value) {} @Override @@ -137,10 +142,20 @@ public void onShow(DialogInterface dialog) { @Override public Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.builder() - .put(RequestCloseEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRequestClose")) - .put(ShowEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShow")) - .build(); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.builder() + .put(RequestCloseEvent.EVENT_NAME, MapBuilder.of("registrationName", "onRequestClose")) + .put(ShowEvent.EVENT_NAME, MapBuilder.of("registrationName", "onShow")) + // iOS only + .put("topDismiss", MapBuilder.of("registrationName", "onDismiss")) + // iOS only + .put("topOrientationChange", MapBuilder.of("registrationName", "onOrientationChange")) + .build()); + return eventTypeConstants; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java index 561b96d13bae..adbd81d7fd1d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -528,8 +528,18 @@ public boolean onTouchEvent(MotionEvent event) { } @Override - public void onChildStartedNativeGesture(MotionEvent androidEvent) { - mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, mEventDispatcher); + public void onChildStartedNativeGesture(MotionEvent ev) { + mJSTouchDispatcher.onChildStartedNativeGesture(ev, mEventDispatcher); + } + + @Override + public void onChildStartedNativeGesture(View childView, MotionEvent ev) { + mJSTouchDispatcher.onChildStartedNativeGesture(ev, mEventDispatcher); + } + + @Override + public void onChildEndedNativeGesture(View childView, MotionEvent ev) { + mJSTouchDispatcher.onChildEndedNativeGesture(ev, mEventDispatcher); } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/RequestCloseEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/RequestCloseEvent.java index aa8ed464e570..4ea4b50f396f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/RequestCloseEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/RequestCloseEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ShowEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ShowEvent.java index 1f126db46830..7ded5c9f0727 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/modal/ShowEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/modal/ShowEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java index 1558eb991aac..f5a5d2f9f612 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarContainerView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.java index 4c90372be9a8..d20d7659493e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ProgressBarShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java index aae6bd5cfc43..3cdb730a3913 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/progressbar/ReactProgressBarViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -44,6 +44,7 @@ public class ReactProgressBarViewManager private final WeakHashMap> mMeasuredStyles = new WeakHashMap<>(); /* package */ static final String PROP_STYLE = "styleAttr"; + /* package */ static final String PROP_ATTR = "typeAttr"; /* package */ static final String PROP_INDETERMINATE = "indeterminate"; /* package */ static final String PROP_PROGRESS = "progress"; /* package */ static final String PROP_ANIMATING = "animating"; @@ -115,6 +116,7 @@ public void setTestID(ProgressBarContainerView view, @Nullable String value) { } @Override + @ReactProp(name = PROP_ATTR) public void setTypeAttr(ProgressBarContainerView view, @Nullable String value) {} @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/FpsListener.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/FpsListener.java index 905f26bb0576..e572c2ceb87e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/FpsListener.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/FpsListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java index e14952c9c296..46dc67a81154 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/OnScrollDispatchHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java index 831e4555a590..3ac3d425659b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager.java index 12c7a7542896..497de4b072f1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollContainerViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java index 470c7d0f9bff..27eb39335310 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,15 +7,12 @@ package com.facebook.react.views.scroll; -import static com.facebook.react.config.ReactFeatureFlags.enableScrollViewSnapToAlignmentProp; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_CENTER; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISABLED; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START; -import android.animation.Animator; import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; @@ -37,19 +34,20 @@ import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; -import com.facebook.react.bridge.WritableMap; -import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.common.ReactConstants; import com.facebook.react.common.build.ReactBuildConfig; import com.facebook.react.modules.i18nmanager.I18nUtil; import com.facebook.react.uimanager.FabricViewStateManager; import com.facebook.react.uimanager.MeasureSpecAssertions; -import com.facebook.react.uimanager.PixelUtil; +import com.facebook.react.uimanager.PointerEvents; import com.facebook.react.uimanager.ReactClippingViewGroup; import com.facebook.react.uimanager.ReactClippingViewGroupHelper; -import com.facebook.react.uimanager.ReactOverflowView; +import com.facebook.react.uimanager.ReactOverflowViewWithInset; import com.facebook.react.uimanager.ViewProps; import com.facebook.react.uimanager.events.NativeGestureUtil; +import com.facebook.react.views.scroll.ReactScrollViewHelper.HasFlingAnimator; +import com.facebook.react.views.scroll.ReactScrollViewHelper.HasScrollState; +import com.facebook.react.views.scroll.ReactScrollViewHelper.ReactScrollViewScrollState; import com.facebook.react.views.view.ReactViewBackgroundManager; import java.lang.reflect.Field; import java.util.ArrayList; @@ -59,7 +57,9 @@ public class ReactHorizontalScrollView extends HorizontalScrollView implements ReactClippingViewGroup, FabricViewStateManager.HasFabricViewStateManager, - ReactOverflowView { + ReactOverflowViewWithInset, + HasScrollState, + HasFlingAnimator { private static boolean DEBUG_MODE = false && ReactBuildConfig.DEBUG; private static String TAG = ReactHorizontalScrollView.class.getSimpleName(); @@ -68,10 +68,6 @@ public class ReactHorizontalScrollView extends HorizontalScrollView private static @Nullable Field sScrollerField; private static boolean sTriedToGetScrollerField = false; - private static final String CONTENT_OFFSET_LEFT = "contentOffsetLeft"; - private static final String CONTENT_OFFSET_TOP = "contentOffsetTop"; - private static final String SCROLL_AWAY_PADDING_TOP = "scrollAwayPaddingTop"; - private int mLayoutDirection; private int mScrollXAfterMeasure = NO_SCROLL_POSITION; @@ -81,6 +77,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView private final @Nullable OverScroller mScroller; private final VelocityHelper mVelocityHelper = new VelocityHelper(); private final Rect mRect = new Rect(); + private final Rect mOverflowInset = new Rect(); private boolean mActivelyScrolling; private @Nullable Rect mClippingRect; @@ -97,7 +94,6 @@ public class ReactHorizontalScrollView extends HorizontalScrollView private int mEndFillColor = Color.TRANSPARENT; private boolean mDisableIntervalMomentum = false; private int mSnapInterval = 0; - private float mDecelerationRate = 0.985f; private @Nullable List mSnapOffsets; private boolean mSnapToStart = true; private boolean mSnapToEnd = true; @@ -107,13 +103,9 @@ public class ReactHorizontalScrollView extends HorizontalScrollView private int pendingContentOffsetX = UNSET_CONTENT_OFFSET; private int pendingContentOffsetY = UNSET_CONTENT_OFFSET; private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager(); - - private @Nullable ValueAnimator mScrollAnimator; - private int mFinalAnimatedPositionScrollX = 0; - private int mFinalAnimatedPositionScrollY = 0; - - private int mLastStateUpdateScrollX = -1; - private int mLastStateUpdateScrollY = -1; + private final ReactScrollViewScrollState mReactScrollViewScrollState; + private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollX", 0, 0); + private PointerEvents mPointerEvents = PointerEvents.AUTO; private final Rect mTempRect = new Rect(); @@ -144,10 +136,11 @@ public void onInitializeAccessibilityNodeInfo( }); mScroller = getOverScrollerFromParent(); - mLayoutDirection = - I18nUtil.getInstance().isRTL(context) - ? ViewCompat.LAYOUT_DIRECTION_RTL - : ViewCompat.LAYOUT_DIRECTION_LTR; + mReactScrollViewScrollState = + new ReactScrollViewScrollState( + I18nUtil.getInstance().isRTL(context) + ? ViewCompat.LAYOUT_DIRECTION_RTL + : ViewCompat.LAYOUT_DIRECTION_LTR); } @Nullable @@ -224,10 +217,10 @@ public void setPagingEnabled(boolean pagingEnabled) { } public void setDecelerationRate(float decelerationRate) { - mDecelerationRate = decelerationRate; + getReactScrollViewScrollState().setDecelerationRate(decelerationRate); if (mScroller != null) { - mScroller.setFriction(1.0f - mDecelerationRate); + mScroller.setFriction(1.0f - decelerationRate); } } @@ -265,6 +258,16 @@ public void setOverflow(String overflow) { return mOverflow; } + @Override + public void setOverflowInset(int left, int top, int right, int bottom) { + mOverflowInset.set(left, top, right, bottom); + } + + @Override + public Rect getOverflowInset() { + return mOverflowInset; + } + @Override protected void onDraw(Canvas canvas) { if (DEBUG_MODE) { @@ -437,13 +440,7 @@ protected void onScrollChanged(int x, int y, int oldX, int oldY) { updateClippingRect(); } - // Race an UpdateState with every onScroll. This makes it more likely that, in Fabric, - // when JS processes the scroll event, the C++ ShadowNode representation will have a - // "more correct" scroll position. It will frequently be /incorrect/ but this decreases - // the error as much as possible. - updateStateOnScroll(); - - ReactScrollViewHelper.emitScrollEvent( + ReactScrollViewHelper.updateStateOnScrollChanged( this, mOnScrollDispatchHelper.getXFlingVelocity(), mOnScrollDispatchHelper.getYFlingVelocity()); @@ -456,12 +453,18 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { return false; } + // We intercept the touch event if the children are not supposed to receive it. + if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) { + return true; + } + try { if (super.onInterceptTouchEvent(ev)) { NativeGestureUtil.notifyNativeGestureStarted(this, ev); ReactScrollViewHelper.emitScrollBeginDragEvent(this); mDragging = true; enableFpsListener(); + getFlingAnimator().cancel(); return true; } } catch (IllegalArgumentException e) { @@ -522,10 +525,15 @@ public boolean onTouchEvent(MotionEvent ev) { return false; } + // We do not accept the touch event if this view is not supposed to receive it. + if (!PointerEvents.canBeTouchTarget(mPointerEvents)) { + return false; + } + mVelocityHelper.calculateVelocity(ev); int action = ev.getAction() & MotionEvent.ACTION_MASK; if (action == MotionEvent.ACTION_UP && mDragging) { - updateStateOnScroll(); + ReactScrollViewHelper.updateFabricScrollState(this); float velocityX = mVelocityHelper.getXVelocity(); float velocityY = mVelocityHelper.getYVelocity(); @@ -773,7 +781,7 @@ public void run() { mRunning = true; } else { // There has not been a scroll update since the last time this Runnable executed. - updateStateOnScroll(); + ReactScrollViewHelper.updateFabricScrollState(ReactHorizontalScrollView.this); // We keep checking for updates until the ScrollView has "stabilized" and hasn't // scrolled for N consecutive frames. This number is arbitrary: big enough to catch @@ -814,43 +822,19 @@ public void run() { this, mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY); } - /** Get current X position or position after current animation finishes, if any. */ - private int getPostAnimationScrollX() { - return mScrollAnimator != null && mScrollAnimator.isRunning() - ? mFinalAnimatedPositionScrollX - : getScrollX(); - } - - /** Get current X position or position after current animation finishes, if any. */ - private int getPostAnimationScrollY() { - return mScrollAnimator != null && mScrollAnimator.isRunning() - ? mFinalAnimatedPositionScrollY - : getScrollY(); - } - private int predictFinalScrollPosition(int velocityX) { - // ScrollView can *only* scroll for 250ms when using smoothScrollTo and there's - // no way to customize the scroll duration. So, we create a temporary OverScroller - // so we can predict where a fling would land and snap to nearby that point. - OverScroller scroller = new OverScroller(getContext()); - scroller.setFriction(1.0f - mDecelerationRate); - // predict where a fling would end up so we can scroll to the nearest snap offset - int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth()); - int width = getWidth() - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this); - scroller.fling( - getPostAnimationScrollX(), // startX - getPostAnimationScrollY(), // startY - velocityX, // velocityX - 0, // velocityY - 0, // minX - maximumOffset, // maxX - 0, // minY - 0, // maxY - width / 2, // overX - 0 // overY - ); - return scroller.getFinalX(); + final int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth()); + // TODO(T106335409): Existing prediction still uses overscroller. Consider change this to use + // fling animator instead. + return getFlingAnimator() == DEFAULT_FLING_ANIMATOR + ? ReactScrollViewHelper.predictFinalScrollPosition(this, velocityX, 0, maximumOffset, 0).x + : ReactScrollViewHelper.getNextFlingStartValue( + this, + getScrollX(), + getReactScrollViewScrollState().getFinalAnimatedPositionScroll().x, + velocityX) + + getFlingExtrapolatedDistance(velocityX); } /** @@ -864,7 +848,13 @@ private void smoothScrollAndSnap(int velocity) { } double interval = (double) getSnapInterval(); - double currentOffset = (double) (getPostAnimationScrollX()); + double currentOffset = + (double) + (ReactScrollViewHelper.getNextFlingStartValue( + this, + getScrollX(), + getReactScrollViewScrollState().getFinalAnimatedPositionScroll().x, + velocity)); double targetOffset = (double) predictFinalScrollPosition(velocity); int previousPage = (int) Math.floor(currentOffset / interval); @@ -917,13 +907,12 @@ private void flingAndSnap(int velocityX) { } // pagingEnabled only allows snapping one interval at a time - if (mSnapInterval == 0 - && mSnapOffsets == null - && (!enableScrollViewSnapToAlignmentProp || mSnapToAlignment == SNAP_ALIGNMENT_DISABLED)) { + if (mSnapInterval == 0 && mSnapOffsets == null && mSnapToAlignment == SNAP_ALIGNMENT_DISABLED) { smoothScrollAndSnap(velocityX); return; } + boolean hasCustomizedFlingAnimator = getFlingAnimator() != DEFAULT_FLING_ANIMATOR; int maximumOffset = Math.max(0, computeHorizontalScrollRange() - getWidth()); int targetOffset = predictFinalScrollPosition(velocityX); if (mDisableIntervalMomentum) { @@ -935,9 +924,10 @@ private void flingAndSnap(int velocityX) { int firstOffset = 0; int lastOffset = maximumOffset; int width = getWidth() - ViewCompat.getPaddingStart(this) - ViewCompat.getPaddingEnd(this); + int layoutDirection = getReactScrollViewScrollState().getLayoutDirection(); // offsets are from the right edge in RTL layouts - if (mLayoutDirection == LAYOUT_DIRECTION_RTL) { + if (layoutDirection == LAYOUT_DIRECTION_RTL) { targetOffset = maximumOffset - targetOffset; velocityX = -velocityX; } @@ -962,7 +952,7 @@ private void flingAndSnap(int velocityX) { } } } - } else if (enableScrollViewSnapToAlignmentProp && mSnapToAlignment != SNAP_ALIGNMENT_DISABLED) { + } else if (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED) { if (mSnapInterval > 0) { double ratio = (double) targetOffset / mSnapInterval; smallerOffset = @@ -983,7 +973,9 @@ private void flingAndSnap(int velocityX) { maximumOffset); } else { ViewGroup contentView = (ViewGroup) getContentView(); - for (int i = 1; i < contentView.getChildCount(); i++) { + int smallerChildOffset = largerOffset; + int largerChildOffset = smallerOffset; + for (int i = 0; i < contentView.getChildCount(); i++) { View item = contentView.getChildAt(i); int itemStartOffset = getItemStartOffset(mSnapToAlignment, item.getLeft(), item.getWidth(), width); @@ -998,7 +990,16 @@ private void flingAndSnap(int velocityX) { largerOffset = itemStartOffset; } } + + smallerChildOffset = Math.min(smallerChildOffset, itemStartOffset); + largerChildOffset = Math.max(largerChildOffset, itemStartOffset); } + + // For Recycler ViewGroup, the maximumOffset can be much larger than the total heights of + // items in the layout. In this case snapping is not possible beyond the currently rendered + // children. + smallerOffset = Math.max(smallerOffset, smallerChildOffset); + largerOffset = Math.min(largerOffset, largerChildOffset); } } else { double interval = getSnapInterval(); @@ -1009,12 +1010,14 @@ private void flingAndSnap(int velocityX) { // Calculate the nearest offset int nearestOffset = - targetOffset - smallerOffset < largerOffset - targetOffset ? smallerOffset : largerOffset; + Math.abs(targetOffset - smallerOffset) < Math.abs(largerOffset - targetOffset) + ? smallerOffset + : largerOffset; // if scrolling after the last snap offset and snapping to the // end of the list is disabled, then we allow free scrolling int currentOffset = getScrollX(); - if (mLayoutDirection == LAYOUT_DIRECTION_RTL) { + if (layoutDirection == LAYOUT_DIRECTION_RTL) { currentOffset = maximumOffset - currentOffset; } if (!mSnapToEnd && targetOffset >= lastOffset) { @@ -1032,13 +1035,19 @@ private void flingAndSnap(int velocityX) { targetOffset = firstOffset; } } else if (velocityX > 0) { - // when snapping velocity can feel sluggish for slow swipes - velocityX += (int) ((largerOffset - targetOffset) * 10.0); + if (!hasCustomizedFlingAnimator) { + // The default animator requires boost on initial velocity as when snapping velocity can + // feel sluggish for slow swipes + velocityX += (int) ((largerOffset - targetOffset) * 10.0); + } targetOffset = largerOffset; } else if (velocityX < 0) { - // when snapping velocity can feel sluggish for slow swipes - velocityX -= (int) ((targetOffset - smallerOffset) * 10.0); + if (!hasCustomizedFlingAnimator) { + // The default animator requires boost on initial velocity as when snapping velocity can + // feel sluggish for slow swipes + velocityX -= (int) ((targetOffset - smallerOffset) * 10.0); + } targetOffset = smallerOffset; } else { @@ -1048,16 +1057,18 @@ private void flingAndSnap(int velocityX) { // Make sure the new offset isn't out of bounds targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset); - if (mLayoutDirection == LAYOUT_DIRECTION_RTL) { + if (layoutDirection == LAYOUT_DIRECTION_RTL) { targetOffset = maximumOffset - targetOffset; velocityX = -velocityX; } - // smoothScrollTo will always scroll over 250ms which is often *waaay* - // too short and will cause the scrolling to feel almost instant - // try to manually interact with OverScroller instead - // if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo - if (mScroller != null) { + if (hasCustomizedFlingAnimator || mScroller == null) { + reactSmoothScrollTo(targetOffset, getScrollY()); + } else { + // smoothScrollTo will always scroll over 250ms which is often *waaay* + // too short and will cause the scrolling to feel almost instant + // try to manually interact with OverScroller instead + // if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo mActivelyScrolling = true; mScroller.fling( @@ -1079,8 +1090,6 @@ private void flingAndSnap(int velocityX) { ); postInvalidateOnAnimation(); - } else { - reactSmoothScrollTo(targetOffset, getScrollY()); } } @@ -1162,56 +1171,7 @@ public void setBorderStyle(@Nullable String style) { * scroll view and state. Calling raw `smoothScrollTo` doesn't update state. */ public void reactSmoothScrollTo(int x, int y) { - if (DEBUG_MODE) { - FLog.i(TAG, "reactSmoothScrollTo[%d] x %d y %d", getId(), x, y); - } - - // `smoothScrollTo` contains some logic that, if called multiple times in a short amount of - // time, will treat all calls as part of the same animation and will not lengthen the duration - // of the animation. This means that, for example, if the user is scrolling rapidly, multiple - // pages could be considered part of one animation, causing some page animations to be animated - // very rapidly - looking like they're not animated at all. - if (mScrollAnimator != null) { - mScrollAnimator.cancel(); - } - - mFinalAnimatedPositionScrollX = x; - mFinalAnimatedPositionScrollY = y; - PropertyValuesHolder scrollX = PropertyValuesHolder.ofInt("scrollX", getScrollX(), x); - PropertyValuesHolder scrollY = PropertyValuesHolder.ofInt("scrollY", getScrollY(), y); - mScrollAnimator = ObjectAnimator.ofPropertyValuesHolder(scrollX, scrollY); - mScrollAnimator.setDuration( - ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())); - mScrollAnimator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { - int scrollValueX = (Integer) valueAnimator.getAnimatedValue("scrollX"); - int scrollValueY = (Integer) valueAnimator.getAnimatedValue("scrollY"); - scrollTo(scrollValueX, scrollValueY); - } - }); - mScrollAnimator.addListener( - new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animator) {} - - @Override - public void onAnimationEnd(Animator animator) { - mFinalAnimatedPositionScrollX = -1; - mFinalAnimatedPositionScrollY = -1; - mScrollAnimator = null; - updateStateOnScroll(); - } - - @Override - public void onAnimationCancel(Animator animator) {} - - @Override - public void onAnimationRepeat(Animator animator) {} - }); - mScrollAnimator.start(); - updateStateOnScroll(x, y); + ReactScrollViewHelper.smoothScrollTo(this, x, y); setPendingContentOffsets(x, y); } @@ -1235,7 +1195,7 @@ public void scrollTo(int x, int y) { // to the last item in the list, but that item cannot be move to the start position of the view. final int actualX = getScrollX(); final int actualY = getScrollY(); - updateStateOnScroll(actualX, actualY); + ReactScrollViewHelper.updateFabricScrollState(this, actualX, actualY); setPendingContentOffsets(actualX, actualY); } @@ -1260,62 +1220,54 @@ private void setPendingContentOffsets(int x, int y) { } } - /** - * Called on any stabilized onScroll change to propagate content offset value to a Shadow Node. - */ - private void updateStateOnScroll(final int scrollX, final int scrollY) { - if (DEBUG_MODE) { - FLog.i(TAG, "updateStateOnScroll[%d] scrollX %d scrollY %d", getId(), scrollX, scrollY); - } - - // Dedupe events to reduce JNI traffic - if (scrollX == mLastStateUpdateScrollX && scrollY == mLastStateUpdateScrollY) { - return; - } + @Override + public FabricViewStateManager getFabricViewStateManager() { + return mFabricViewStateManager; + } - mLastStateUpdateScrollX = scrollX; - mLastStateUpdateScrollY = scrollY; + @Override + public ReactScrollViewScrollState getReactScrollViewScrollState() { + return mReactScrollViewScrollState; + } - final int fabricScrollX; - if (mLayoutDirection == LAYOUT_DIRECTION_RTL) { - // getScrollX returns offset from left even when layout direction is RTL. - // The following line calculates offset from right. - View child = getContentView(); - int contentWidth = child != null ? child.getWidth() : 0; - fabricScrollX = -(contentWidth - scrollX - getWidth()); - } else { - fabricScrollX = scrollX; - } + @Override + public void startFlingAnimator(int start, int end) { + // Always cancel existing animator before starting the new one. `smoothScrollTo` contains some + // logic that, if called multiple times in a short amount of time, will treat all calls as part + // of the same animation and will not lengthen the duration of the animation. This means that, + // for example, if the user is scrolling rapidly, multiple pages could be considered part of one + // animation, causing some page animations to be animated very rapidly - looking like they're + // not animated at all. + DEFAULT_FLING_ANIMATOR.cancel(); - if (DEBUG_MODE) { - FLog.i( - TAG, - "updateStateOnScroll[%d] scrollX %d scrollY %d fabricScrollX", - getId(), - scrollX, - scrollY, - fabricScrollX); - } + // Update the fling animator with new values + DEFAULT_FLING_ANIMATOR + .setDuration(ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())) + .setIntValues(start, end); - mFabricViewStateManager.setState( - new FabricViewStateManager.StateUpdateCallback() { - @Override - public WritableMap getStateUpdate() { - WritableMap map = new WritableNativeMap(); - map.putDouble(CONTENT_OFFSET_LEFT, PixelUtil.toDIPFromPixel(fabricScrollX)); - map.putDouble(CONTENT_OFFSET_TOP, PixelUtil.toDIPFromPixel(scrollY)); - map.putDouble(SCROLL_AWAY_PADDING_TOP, 0); - return map; - } - }); + // Start the animator + DEFAULT_FLING_ANIMATOR.start(); } - private void updateStateOnScroll() { - updateStateOnScroll(getScrollX(), getScrollY()); + @Override + public ValueAnimator getFlingAnimator() { + return DEFAULT_FLING_ANIMATOR; } @Override - public FabricViewStateManager getFabricViewStateManager() { - return mFabricViewStateManager; + public int getFlingExtrapolatedDistance(int velocityX) { + // The DEFAULT_FLING_ANIMATOR uses AccelerateDecelerateInterpolator, which is not depending on + // the init velocity. We use the overscroller to decide the fling distance. + return ReactScrollViewHelper.predictFinalScrollPosition( + this, velocityX, 0, Math.max(0, computeHorizontalScrollRange() - getWidth()), 0) + .x; + } + + public void setPointerEvents(PointerEvents pointerEvents) { + mPointerEvents = pointerEvents; + } + + public PointerEvents getPointerEvents() { + return mPointerEvents; } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java index 5775d3106c70..ddd60f19ac0d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,6 +16,7 @@ import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.DisplayMetricsHolder; import com.facebook.react.uimanager.PixelUtil; +import com.facebook.react.uimanager.PointerEvents; import com.facebook.react.uimanager.ReactClippingViewGroupHelper; import com.facebook.react.uimanager.ReactStylesDiffMap; import com.facebook.react.uimanager.Spacing; @@ -321,4 +322,9 @@ public void setContentOffset(ReactHorizontalScrollView view, ReadableMap value) view.scrollTo(0, 0); } } + + @ReactProp(name = ViewProps.POINTER_EVENTS) + public void setPointerEvents(ReactHorizontalScrollView view, @Nullable String pointerEventsStr) { + view.setPointerEvents(PointerEvents.parsePointerEvents(pointerEventsStr)); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java index 54643e6e2da4..e9b99417a438 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,16 +7,14 @@ package com.facebook.react.views.scroll; -import static com.facebook.react.config.ReactFeatureFlags.enableScrollViewSnapToAlignmentProp; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_CENTER; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_DISABLED; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_END; import static com.facebook.react.views.scroll.ReactScrollViewHelper.SNAP_ALIGNMENT_START; -import android.animation.Animator; import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; +import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Rect; @@ -34,20 +32,18 @@ import com.facebook.common.logging.FLog; import com.facebook.infer.annotation.Assertions; import com.facebook.react.R; -import com.facebook.react.bridge.ReactContext; -import com.facebook.react.bridge.WritableMap; -import com.facebook.react.bridge.WritableNativeMap; import com.facebook.react.common.ReactConstants; import com.facebook.react.uimanager.FabricViewStateManager; import com.facebook.react.uimanager.MeasureSpecAssertions; -import com.facebook.react.uimanager.PixelUtil; +import com.facebook.react.uimanager.PointerEvents; import com.facebook.react.uimanager.ReactClippingViewGroup; import com.facebook.react.uimanager.ReactClippingViewGroupHelper; -import com.facebook.react.uimanager.ReactOverflowView; +import com.facebook.react.uimanager.ReactOverflowViewWithInset; import com.facebook.react.uimanager.ViewProps; -import com.facebook.react.uimanager.common.UIManagerType; -import com.facebook.react.uimanager.common.ViewUtil; import com.facebook.react.uimanager.events.NativeGestureUtil; +import com.facebook.react.views.scroll.ReactScrollViewHelper.HasFlingAnimator; +import com.facebook.react.views.scroll.ReactScrollViewHelper.HasScrollState; +import com.facebook.react.views.scroll.ReactScrollViewHelper.ReactScrollViewScrollState; import com.facebook.react.views.view.ReactViewBackgroundManager; import java.lang.reflect.Field; import java.util.List; @@ -64,13 +60,12 @@ public class ReactScrollView extends ScrollView ViewGroup.OnHierarchyChangeListener, View.OnLayoutChangeListener, FabricViewStateManager.HasFabricViewStateManager, - ReactOverflowView { + ReactOverflowViewWithInset, + HasScrollState, + HasFlingAnimator { private static @Nullable Field sScrollerField; private static boolean sTriedToGetScrollerField = false; - private static final String CONTENT_OFFSET_LEFT = "contentOffsetLeft"; - private static final String CONTENT_OFFSET_TOP = "contentOffsetTop"; - private static final String SCROLL_AWAY_PADDING_TOP = "scrollAwayPaddingTop"; private static final int UNSET_CONTENT_OFFSET = -1; @@ -78,6 +73,7 @@ public class ReactScrollView extends ScrollView private final @Nullable OverScroller mScroller; private final VelocityHelper mVelocityHelper = new VelocityHelper(); private final Rect mRect = new Rect(); // for reuse to avoid allocation + private final Rect mOverflowInset = new Rect(); private boolean mActivelyScrolling; private @Nullable Rect mClippingRect; @@ -94,7 +90,6 @@ public class ReactScrollView extends ScrollView private int mEndFillColor = Color.TRANSPARENT; private boolean mDisableIntervalMomentum = false; private int mSnapInterval = 0; - private float mDecelerationRate = 0.985f; private @Nullable List mSnapOffsets; private boolean mSnapToStart = true; private boolean mSnapToEnd = true; @@ -104,21 +99,16 @@ public class ReactScrollView extends ScrollView private int pendingContentOffsetX = UNSET_CONTENT_OFFSET; private int pendingContentOffsetY = UNSET_CONTENT_OFFSET; private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager(); + private final ReactScrollViewScrollState mReactScrollViewScrollState = + new ReactScrollViewScrollState(ViewCompat.LAYOUT_DIRECTION_LTR); + private final ValueAnimator DEFAULT_FLING_ANIMATOR = ObjectAnimator.ofInt(this, "scrollY", 0, 0); + private PointerEvents mPointerEvents = PointerEvents.AUTO; - private @Nullable ValueAnimator mScrollAnimator; - private int mFinalAnimatedPositionScrollX; - private int mFinalAnimatedPositionScrollY; - - private int mScrollAwayPaddingTop = 0; - - private int mLastStateUpdateScrollX = -1; - private int mLastStateUpdateScrollY = -1; - - public ReactScrollView(ReactContext context) { + public ReactScrollView(Context context) { this(context, null); } - public ReactScrollView(ReactContext context, @Nullable FpsListener fpsListener) { + public ReactScrollView(Context context, @Nullable FpsListener fpsListener) { super(context); mFpsListener = fpsListener; mReactBackgroundManager = new ReactViewBackgroundManager(this); @@ -202,10 +192,10 @@ public void setPagingEnabled(boolean pagingEnabled) { } public void setDecelerationRate(float decelerationRate) { - mDecelerationRate = decelerationRate; + getReactScrollViewScrollState().setDecelerationRate(decelerationRate); if (mScroller != null) { - mScroller.setFriction(1.0f - mDecelerationRate); + mScroller.setFriction(1.0f - decelerationRate); } } @@ -243,6 +233,16 @@ public void setOverflow(String overflow) { return mOverflow; } + @Override + public void setOverflowInset(int left, int top, int right, int bottom) { + mOverflowInset.set(left, top, right, bottom); + } + + @Override + public Rect getOverflowInset() { + return mOverflowInset; + } + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { MeasureSpecAssertions.assertExplicitMeasureSpec(widthMeasureSpec, heightMeasureSpec); @@ -320,13 +320,7 @@ protected void onScrollChanged(int x, int y, int oldX, int oldY) { updateClippingRect(); } - // Race an UpdateState with every onScroll. This makes it more likely that, in Fabric, - // when JS processes the scroll event, the C++ ShadowNode representation will have a - // "more correct" scroll position. It will frequently be /incorrect/ but this decreases - // the error as much as possible. - updateStateOnScroll(); - - ReactScrollViewHelper.emitScrollEvent( + ReactScrollViewHelper.updateStateOnScrollChanged( this, mOnScrollDispatchHelper.getXFlingVelocity(), mOnScrollDispatchHelper.getYFlingVelocity()); @@ -339,12 +333,18 @@ public boolean onInterceptTouchEvent(MotionEvent ev) { return false; } + // We intercept the touch event if the children are not supposed to receive it. + if (!PointerEvents.canChildrenBeTouchTarget(mPointerEvents)) { + return true; + } + try { if (super.onInterceptTouchEvent(ev)) { NativeGestureUtil.notifyNativeGestureStarted(this, ev); ReactScrollViewHelper.emitScrollBeginDragEvent(this); mDragging = true; enableFpsListener(); + getFlingAnimator().cancel(); return true; } } catch (IllegalArgumentException e) { @@ -363,10 +363,15 @@ public boolean onTouchEvent(MotionEvent ev) { return false; } + // We do not accept the touch event if this view is not supposed to receive it. + if (!PointerEvents.canBeTouchTarget(mPointerEvents)) { + return false; + } + mVelocityHelper.calculateVelocity(ev); int action = ev.getAction() & MotionEvent.ACTION_MASK; if (action == MotionEvent.ACTION_UP && mDragging) { - updateStateOnScroll(); + ReactScrollViewHelper.updateFabricScrollState(this); float velocityX = mVelocityHelper.getXVelocity(); float velocityY = mVelocityHelper.getYVelocity(); @@ -565,7 +570,7 @@ public void run() { mRunning = true; } else { // There has not been a scroll update since the last time this Runnable executed. - updateStateOnScroll(); + ReactScrollViewHelper.updateFabricScrollState(ReactScrollView.this); // We keep checking for updates until the ScrollView has "stabilized" and hasn't // scrolled for N consecutive frames. This number is arbitrary: big enough to catch @@ -606,43 +611,18 @@ public void run() { this, mPostTouchRunnable, ReactScrollViewHelper.MOMENTUM_DELAY); } - /** Get current X position or position after current animation finishes, if any. */ - private int getPostAnimationScrollX() { - return mScrollAnimator != null && mScrollAnimator.isRunning() - ? mFinalAnimatedPositionScrollX - : getScrollX(); - } - - /** Get current X position or position after current animation finishes, if any. */ - private int getPostAnimationScrollY() { - return mScrollAnimator != null && mScrollAnimator.isRunning() - ? mFinalAnimatedPositionScrollY - : getScrollY(); - } - private int predictFinalScrollPosition(int velocityY) { - // ScrollView can *only* scroll for 250ms when using smoothScrollTo and there's - // no way to customize the scroll duration. So, we create a temporary OverScroller - // so we can predict where a fling would land and snap to nearby that point. - OverScroller scroller = new OverScroller(getContext()); - scroller.setFriction(1.0f - mDecelerationRate); - // predict where a fling would end up so we can scroll to the nearest snap offset - int maximumOffset = getMaxScrollY(); - int height = getHeight() - getPaddingBottom() - getPaddingTop(); - scroller.fling( - getPostAnimationScrollX(), // startX - getPostAnimationScrollY(), // startY - 0, // velocityX - velocityY, // velocityY - 0, // minX - 0, // maxX - 0, // minY - maximumOffset, // maxY - 0, // overX - height / 2 // overY - ); - return scroller.getFinalY(); + // TODO(T106335409): Existing prediction still uses overscroller. Consider change this to use + // fling animator instead. + return getFlingAnimator() == DEFAULT_FLING_ANIMATOR + ? ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY()).y + : ReactScrollViewHelper.getNextFlingStartValue( + this, + getScrollY(), + getReactScrollViewScrollState().getFinalAnimatedPositionScroll().y, + velocityY) + + getFlingExtrapolatedDistance(velocityY); } private View getContentView() { @@ -656,7 +636,13 @@ private View getContentView() { */ private void smoothScrollAndSnap(int velocity) { double interval = (double) getSnapInterval(); - double currentOffset = (double) getPostAnimationScrollY(); + double currentOffset = + (double) + (ReactScrollViewHelper.getNextFlingStartValue( + this, + getScrollY(), + getReactScrollViewScrollState().getFinalAnimatedPositionScroll().y, + velocity)); double targetOffset = (double) predictFinalScrollPosition(velocity); int previousPage = (int) Math.floor(currentOffset / interval); @@ -705,13 +691,12 @@ private void flingAndSnap(int velocityY) { } // pagingEnabled only allows snapping one interval at a time - if (mSnapInterval == 0 - && mSnapOffsets == null - && (!enableScrollViewSnapToAlignmentProp || mSnapToAlignment == SNAP_ALIGNMENT_DISABLED)) { + if (mSnapInterval == 0 && mSnapOffsets == null && mSnapToAlignment == SNAP_ALIGNMENT_DISABLED) { smoothScrollAndSnap(velocityY); return; } + boolean hasCustomizedFlingAnimator = getFlingAnimator() != DEFAULT_FLING_ANIMATOR; int maximumOffset = getMaxScrollY(); int targetOffset = predictFinalScrollPosition(velocityY); if (mDisableIntervalMomentum) { @@ -745,7 +730,7 @@ private void flingAndSnap(int velocityY) { } } - } else if (enableScrollViewSnapToAlignmentProp && mSnapToAlignment != SNAP_ALIGNMENT_DISABLED) { + } else if (mSnapToAlignment != SNAP_ALIGNMENT_DISABLED) { if (mSnapInterval > 0) { double ratio = (double) targetOffset / mSnapInterval; smallerOffset = @@ -766,7 +751,9 @@ private void flingAndSnap(int velocityY) { maximumOffset); } else { ViewGroup contentView = (ViewGroup) getContentView(); - for (int i = 1; i < contentView.getChildCount(); i++) { + int smallerChildOffset = largerOffset; + int largerChildOffset = smallerOffset; + for (int i = 0; i < contentView.getChildCount(); i++) { View item = contentView.getChildAt(i); int itemStartOffset; switch (mSnapToAlignment) { @@ -793,7 +780,16 @@ private void flingAndSnap(int velocityY) { largerOffset = itemStartOffset; } } + + smallerChildOffset = Math.min(smallerChildOffset, itemStartOffset); + largerChildOffset = Math.max(largerChildOffset, itemStartOffset); } + + // For Recycler ViewGroup, the maximumOffset can be much larger than the total heights of + // items in the layout. In this case snapping is not possible beyond the currently rendered + // children. + smallerOffset = Math.max(smallerOffset, smallerChildOffset); + largerOffset = Math.min(largerOffset, largerChildOffset); } } else { double interval = (double) getSnapInterval(); @@ -804,7 +800,9 @@ private void flingAndSnap(int velocityY) { // Calculate the nearest offset int nearestOffset = - targetOffset - smallerOffset < largerOffset - targetOffset ? smallerOffset : largerOffset; + Math.abs(targetOffset - smallerOffset) < Math.abs(largerOffset - targetOffset) + ? smallerOffset + : largerOffset; // if scrolling after the last snap offset and snapping to the // end of the list is disabled, then we allow free scrolling @@ -823,13 +821,19 @@ private void flingAndSnap(int velocityY) { targetOffset = firstOffset; } } else if (velocityY > 0) { - // when snapping velocity can feel sluggish for slow swipes - velocityY += (int) ((largerOffset - targetOffset) * 10.0); + if (!hasCustomizedFlingAnimator) { + // The default animator requires boost on initial velocity as when snapping velocity can + // feel sluggish for slow swipes + velocityY += (int) ((largerOffset - targetOffset) * 10.0); + } targetOffset = largerOffset; } else if (velocityY < 0) { - // when snapping velocity can feel sluggish for slow swipes - velocityY -= (int) ((targetOffset - smallerOffset) * 10.0); + if (!hasCustomizedFlingAnimator) { + // The default animator requires boost on initial velocity as when snapping velocity can + // feel sluggish for slow swipes + velocityY -= (int) ((targetOffset - smallerOffset) * 10.0); + } targetOffset = smallerOffset; } else { @@ -839,11 +843,13 @@ private void flingAndSnap(int velocityY) { // Make sure the new offset isn't out of bounds targetOffset = Math.min(Math.max(0, targetOffset), maximumOffset); - // smoothScrollTo will always scroll over 250ms which is often *waaay* - // too short and will cause the scrolling to feel almost instant - // try to manually interact with OverScroller instead - // if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo - if (mScroller != null) { + if (hasCustomizedFlingAnimator || mScroller == null) { + reactSmoothScrollTo(getScrollX(), targetOffset); + } else { + // smoothScrollTo will always scroll over 250ms which is often *waaay* + // too short and will cause the scrolling to feel almost instant + // try to manually interact with OverScroller instead + // if velocity is 0 however, fling() won't work, so we want to use smoothScrollTo mActivelyScrolling = true; mScroller.fling( @@ -865,8 +871,6 @@ private void flingAndSnap(int velocityY) { ); postInvalidateOnAnimation(); - } else { - reactSmoothScrollTo(getScrollX(), targetOffset); } } @@ -945,52 +949,7 @@ public void onChildViewRemoved(View parent, View child) { * scroll view and state. Calling raw `smoothScrollTo` doesn't update state. */ public void reactSmoothScrollTo(int x, int y) { - // `smoothScrollTo` contains some logic that, if called multiple times in a short amount of - // time, will treat all calls as part of the same animation and will not lengthen the duration - // of the animation. This means that, for example, if the user is scrolling rapidly, multiple - // pages could be considered part of one animation, causing some page animations to be animated - // very rapidly - looking like they're not animated at all. - if (mScrollAnimator != null) { - mScrollAnimator.cancel(); - } - - mFinalAnimatedPositionScrollX = x; - mFinalAnimatedPositionScrollY = y; - PropertyValuesHolder scrollX = PropertyValuesHolder.ofInt("scrollX", getScrollX(), x); - PropertyValuesHolder scrollY = PropertyValuesHolder.ofInt("scrollY", getScrollY(), y); - mScrollAnimator = ObjectAnimator.ofPropertyValuesHolder(scrollX, scrollY); - mScrollAnimator.setDuration( - ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())); - mScrollAnimator.addUpdateListener( - new ValueAnimator.AnimatorUpdateListener() { - @Override - public void onAnimationUpdate(ValueAnimator valueAnimator) { - int scrollValueX = (Integer) valueAnimator.getAnimatedValue("scrollX"); - int scrollValueY = (Integer) valueAnimator.getAnimatedValue("scrollY"); - scrollTo(scrollValueX, scrollValueY); - } - }); - mScrollAnimator.addListener( - new Animator.AnimatorListener() { - @Override - public void onAnimationStart(Animator animator) {} - - @Override - public void onAnimationEnd(Animator animator) { - mFinalAnimatedPositionScrollX = -1; - mFinalAnimatedPositionScrollY = -1; - mScrollAnimator = null; - updateStateOnScroll(); - } - - @Override - public void onAnimationCancel(Animator animator) {} - - @Override - public void onAnimationRepeat(Animator animator) {} - }); - mScrollAnimator.start(); - updateStateOnScroll(x, y); + ReactScrollViewHelper.smoothScrollTo(this, x, y); setPendingContentOffsets(x, y); } @@ -1010,7 +969,7 @@ public void scrollTo(int x, int y) { // to the last item in the list, but that item cannot be move to the start position of the view. final int actualX = getScrollX(); final int actualY = getScrollY(); - updateStateOnScroll(actualX, actualY); + ReactScrollViewHelper.updateFabricScrollState(this, actualX, actualY); setPendingContentOffsets(actualX, actualY); } @@ -1119,61 +1078,58 @@ public void setScrollAwayTopPaddingEnabledUnstable(int topPadding) { setRemoveClippedSubviews(mRemoveClippedSubviews); } - /** - * Called on any stabilized onScroll change to propagate content offset value to a Shadow Node. - */ - private boolean updateStateOnScroll(final int scrollX, final int scrollY) { - if (ViewUtil.getUIManagerType(getId()) == UIManagerType.DEFAULT) { - return false; - } - - // Dedupe events to reduce JNI traffic - if (scrollX == mLastStateUpdateScrollX && scrollY == mLastStateUpdateScrollY) { - return false; - } - - mLastStateUpdateScrollX = scrollX; - mLastStateUpdateScrollY = scrollY; - - forceUpdateState(); + private void updateScrollAwayState(int scrollAwayPaddingTop) { + getReactScrollViewScrollState().setScrollAwayPaddingTop(scrollAwayPaddingTop); + ReactScrollViewHelper.forceUpdateState(this); + } - return true; + @Override + public FabricViewStateManager getFabricViewStateManager() { + return mFabricViewStateManager; } - private boolean updateStateOnScroll() { - return updateStateOnScroll(getScrollX(), getScrollY()); + @Override + public ReactScrollViewScrollState getReactScrollViewScrollState() { + return mReactScrollViewScrollState; } - private void updateScrollAwayState(int scrollAwayPaddingTop) { - if (mScrollAwayPaddingTop == scrollAwayPaddingTop) { - return; - } + @Override + public void startFlingAnimator(int start, int end) { + // Always cancel existing animator before starting the new one. `smoothScrollTo` contains some + // logic that, if called multiple times in a short amount of time, will treat all calls as part + // of the same animation and will not lengthen the duration of the animation. This means that, + // for example, if the user is scrolling rapidly, multiple pages could be considered part of one + // animation, causing some page animations to be animated very rapidly - looking like they're + // not animated at all. + DEFAULT_FLING_ANIMATOR.cancel(); - mScrollAwayPaddingTop = scrollAwayPaddingTop; + // Update the fling animator with new values + DEFAULT_FLING_ANIMATOR + .setDuration(ReactScrollViewHelper.getDefaultScrollAnimationDuration(getContext())) + .setIntValues(start, end); - forceUpdateState(); + // Start the animator + DEFAULT_FLING_ANIMATOR.start(); } - private void forceUpdateState() { - final int scrollX = mLastStateUpdateScrollX; - final int scrollY = mLastStateUpdateScrollY; - final int scrollAwayPaddingTop = mScrollAwayPaddingTop; - - mFabricViewStateManager.setState( - new FabricViewStateManager.StateUpdateCallback() { - @Override - public WritableMap getStateUpdate() { - WritableMap map = new WritableNativeMap(); - map.putDouble(CONTENT_OFFSET_LEFT, PixelUtil.toDIPFromPixel(scrollX)); - map.putDouble(CONTENT_OFFSET_TOP, PixelUtil.toDIPFromPixel(scrollY)); - map.putDouble(SCROLL_AWAY_PADDING_TOP, PixelUtil.toDIPFromPixel(scrollAwayPaddingTop)); - return map; - } - }); + @Override + public ValueAnimator getFlingAnimator() { + return DEFAULT_FLING_ANIMATOR; } @Override - public FabricViewStateManager getFabricViewStateManager() { - return mFabricViewStateManager; + public int getFlingExtrapolatedDistance(int velocityY) { + // The DEFAULT_FLING_ANIMATOR uses AccelerateDecelerateInterpolator, which is not depending on + // the init velocity. We use the overscroller to decide the fling distance. + return ReactScrollViewHelper.predictFinalScrollPosition(this, 0, velocityY, 0, getMaxScrollY()) + .y; + } + + public void setPointerEvents(PointerEvents pointerEvents) { + mPointerEvents = pointerEvents; + } + + public PointerEvents getPointerEvents() { + return mPointerEvents; } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.java index 8c431b4c43c3..8b6641b25ed8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewCommandHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java index f383b2931260..c8ae52828c76 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,20 +7,38 @@ package com.facebook.react.views.scroll; +import android.animation.Animator; +import android.animation.ValueAnimator; import android.content.Context; +import android.graphics.Point; import android.view.View; import android.view.ViewGroup; import android.widget.OverScroller; import androidx.annotation.Nullable; +import androidx.core.view.ViewCompat; +import com.facebook.common.logging.FLog; import com.facebook.react.bridge.JSApplicationIllegalArgumentException; import com.facebook.react.bridge.ReactContext; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.bridge.WritableNativeMap; +import com.facebook.react.common.build.ReactBuildConfig; +import com.facebook.react.uimanager.FabricViewStateManager; +import com.facebook.react.uimanager.PixelUtil; import com.facebook.react.uimanager.UIManagerHelper; +import com.facebook.react.uimanager.common.UIManagerType; +import com.facebook.react.uimanager.common.ViewUtil; +import com.facebook.react.uimanager.events.EventDispatcher; import java.util.Collections; import java.util.Set; import java.util.WeakHashMap; /** Helper class that deals with emitting Scroll Events. */ public class ReactScrollViewHelper { + private static String TAG = ReactHorizontalScrollView.class.getSimpleName(); + private static boolean DEBUG_MODE = false && ReactBuildConfig.DEBUG; + private static final String CONTENT_OFFSET_LEFT = "contentOffsetLeft"; + private static final String CONTENT_OFFSET_TOP = "contentOffsetTop"; + private static final String SCROLL_AWAY_PADDING_TOP = "scrollAwayPaddingTop"; public static final long MOMENTUM_DELAY = 20; public static final String OVER_SCROLL_ALWAYS = "always"; @@ -90,20 +108,28 @@ private static void emitScrollEvent( ReactContext reactContext = (ReactContext) scrollView.getContext(); int surfaceId = UIManagerHelper.getSurfaceId(reactContext); - UIManagerHelper.getEventDispatcherForReactTag(reactContext, scrollView.getId()) - .dispatchEvent( - ScrollEvent.obtain( - surfaceId, - scrollView.getId(), - scrollEventType, - scrollView.getScrollX(), - scrollView.getScrollY(), - xVelocity, - yVelocity, - contentView.getWidth(), - contentView.getHeight(), - scrollView.getWidth(), - scrollView.getHeight())); + + // It's possible for the EventDispatcher to go away - for example, + // if there's a crash initiated from JS and we tap on a ScrollView + // around teardown of RN, this will cause a NPE. We can safely ignore + // this since the crash is usually a red herring. + EventDispatcher eventDispatcher = + UIManagerHelper.getEventDispatcherForReactTag(reactContext, scrollView.getId()); + if (eventDispatcher != null) { + eventDispatcher.dispatchEvent( + ScrollEvent.obtain( + surfaceId, + scrollView.getId(), + scrollEventType, + scrollView.getScrollX(), + scrollView.getScrollY(), + xVelocity, + yVelocity, + contentView.getWidth(), + contentView.getHeight(), + scrollView.getWidth(), + scrollView.getHeight())); + } } /** This is only for Java listeners. onLayout events emitted to JS are handled elsewhere. */ @@ -198,4 +224,359 @@ public static void addScrollListener(ScrollListener listener) { public static void removeScrollListener(ScrollListener listener) { sScrollListeners.remove(listener); } + + public static class ReactScrollViewScrollState { + private final int mLayoutDirection; + private final Point mFinalAnimatedPositionScroll = new Point(); + private int mScrollAwayPaddingTop = 0; + private final Point mLastStateUpdateScroll = new Point(-1, -1); + private boolean mIsCanceled = false; + private boolean mIsFinished = true; + private float mDecelerationRate = 0.985f; + + public ReactScrollViewScrollState(final int layoutDirection) { + mLayoutDirection = layoutDirection; + } + + /** + * Get the layout direction. Can be either scrollView.LAYOUT_DIRECTION_RTL (1) or + * scrollView.LAYOUT_DIRECTION_LTR (0). If the value is -1, it means unknown layout. + */ + public int getLayoutDirection() { + return mLayoutDirection; + } + + /** Get the position after current animation is finished */ + public Point getFinalAnimatedPositionScroll() { + return mFinalAnimatedPositionScroll; + } + + /** Set the final scroll position after scrolling animation is finished */ + public ReactScrollViewScrollState setFinalAnimatedPositionScroll( + int finalAnimatedPositionScrollX, int finalAnimatedPositionScrollY) { + mFinalAnimatedPositionScroll.set(finalAnimatedPositionScrollX, finalAnimatedPositionScrollY); + return this; + } + + /** Get the Fabric state of last scroll position */ + public Point getLastStateUpdateScroll() { + return mLastStateUpdateScroll; + } + + /** Set the Fabric state of last scroll position */ + public ReactScrollViewScrollState setLastStateUpdateScroll( + int lastStateUpdateScrollX, int lastStateUpdateScrollY) { + mLastStateUpdateScroll.set(lastStateUpdateScrollX, lastStateUpdateScrollY); + return this; + } + + /** Get the padding on the top for nav bar */ + public int getScrollAwayPaddingTop() { + return mScrollAwayPaddingTop; + } + + /** Set the padding on the top for nav bar */ + public ReactScrollViewScrollState setScrollAwayPaddingTop(int scrollAwayPaddingTop) { + mScrollAwayPaddingTop = scrollAwayPaddingTop; + return this; + } + + /** Get true if the previous animation was canceled */ + public boolean getIsCanceled() { + return mIsCanceled; + } + + /** Set the state of current animation is canceled or not */ + public ReactScrollViewScrollState setIsCanceled(boolean isCanceled) { + mIsCanceled = isCanceled; + return this; + } + + /** Get true if previous animation was finished */ + public boolean getIsFinished() { + return mIsFinished; + } + + /** Set the state of current animation is finished or not */ + public ReactScrollViewScrollState setIsFinished(boolean isFinished) { + mIsFinished = isFinished; + return this; + } + + /** Get true if previous animation was finished */ + public float getDecelerationRate() { + return mDecelerationRate; + } + + /** Set the state of current animation is finished or not */ + public ReactScrollViewScrollState setDecelerationRate(float decelerationRate) { + mDecelerationRate = decelerationRate; + return this; + } + } + + /** + * Scroll the given view to the location (x, y), with provided initial velocity. This method works + * by calculate the "would be" initial velocity with internal friction to move to the point (x, + * y), then apply that to the animator. + */ + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + void smoothScrollTo(final T scrollView, final int x, final int y) { + if (DEBUG_MODE) { + FLog.i(TAG, "smoothScrollTo[%d] x %d y %d", scrollView.getId(), x, y); + } + + // Register the listeners for the fling animator if there isn't any + final ValueAnimator flingAnimator = scrollView.getFlingAnimator(); + if (flingAnimator.getListeners() == null || flingAnimator.getListeners().size() == 0) { + registerFlingAnimator(scrollView); + } + + final ReactScrollViewScrollState scrollState = scrollView.getReactScrollViewScrollState(); + scrollState.setFinalAnimatedPositionScroll(x, y); + + final int scrollX = scrollView.getScrollX(); + final int scrollY = scrollView.getScrollY(); + // Only one fling animator will be started. For the horizontal scroll view, scrollY will always + // be the same to y. This is the same to the vertical scroll view. + if (scrollX != x) { + scrollView.startFlingAnimator(scrollX, x); + } + if (scrollY != y) { + scrollView.startFlingAnimator(scrollY, y); + } + + updateFabricScrollState(scrollView, x, y); + } + + /** Get current position or position after current animation finishes, if any. */ + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + int getNextFlingStartValue( + final T scrollView, + final int currentValue, + final int postAnimationValue, + final int velocity) { + final ReactScrollViewScrollState scrollState = scrollView.getReactScrollViewScrollState(); + final int velocityDirectionMask = velocity != 0 ? velocity / Math.abs(velocity) : 0; + final boolean isMovingTowardsAnimatedValue = + velocityDirectionMask * (postAnimationValue - currentValue) > 0; + + // When the fling animation is not finished, or it was canceled and now we are moving towards + // the final animated value, we will return the final animated value. This is because follow up + // animation should consider the "would be" animated location, so that previous quick small + // scrolls are still working. + return !scrollState.getIsFinished() + || (scrollState.getIsCanceled() && isMovingTowardsAnimatedValue) + ? postAnimationValue + : currentValue; + } + + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + boolean updateFabricScrollState(final T scrollView) { + return updateFabricScrollState(scrollView, scrollView.getScrollX(), scrollView.getScrollY()); + } + + /** + * Called on any stabilized onScroll change to propagate content offset value to a Shadow Node. + */ + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + boolean updateFabricScrollState(final T scrollView, final int scrollX, final int scrollY) { + if (DEBUG_MODE) { + FLog.i( + TAG, + "updateFabricScrollState[%d] scrollX %d scrollY %d", + scrollView.getId(), + scrollX, + scrollY); + } + + if (ViewUtil.getUIManagerType(scrollView.getId()) == UIManagerType.DEFAULT) { + return false; + } + + final ReactScrollViewScrollState scrollState = scrollView.getReactScrollViewScrollState(); + // Dedupe events to reduce JNI traffic + if (scrollState.getLastStateUpdateScroll().equals(scrollX, scrollY)) { + return false; + } + + scrollState.setLastStateUpdateScroll(scrollX, scrollY); + forceUpdateState(scrollView); + return true; + } + + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + void forceUpdateState(final T scrollView) { + final ReactScrollViewScrollState scrollState = scrollView.getReactScrollViewScrollState(); + final int scrollAwayPaddingTop = scrollState.getScrollAwayPaddingTop(); + final Point scrollPos = scrollState.getLastStateUpdateScroll(); + final int scrollX = scrollPos.x; + final int scrollY = scrollPos.y; + final int fabricScrollX; + int layoutDirection = scrollState.getLayoutDirection(); + + if (layoutDirection == scrollView.LAYOUT_DIRECTION_RTL) { + // getScrollX returns offset from left even when layout direction is RTL. + // The following line calculates offset from right. + View child = scrollView.getChildAt(0); + int contentWidth = child != null ? child.getWidth() : 0; + fabricScrollX = -(contentWidth - scrollX - scrollView.getWidth()); + } else { + fabricScrollX = scrollX; + } + + if (DEBUG_MODE) { + FLog.i( + TAG, + "updateFabricScrollState[%d] scrollX %d scrollY %d fabricScrollX", + scrollView.getId(), + scrollX, + scrollY, + fabricScrollX); + } + + scrollView + .getFabricViewStateManager() + .setState( + new FabricViewStateManager.StateUpdateCallback() { + @Override + public WritableMap getStateUpdate() { + WritableMap map = new WritableNativeMap(); + map.putDouble(CONTENT_OFFSET_LEFT, PixelUtil.toDIPFromPixel(scrollX)); + map.putDouble(CONTENT_OFFSET_TOP, PixelUtil.toDIPFromPixel(scrollY)); + map.putDouble( + SCROLL_AWAY_PADDING_TOP, PixelUtil.toDIPFromPixel(scrollAwayPaddingTop)); + return map; + } + }); + } + + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + void updateStateOnScrollChanged( + final T scrollView, final float xVelocity, final float yVelocity) { + // Race an UpdateState with every onScroll. This makes it more likely that, in Fabric, + // when JS processes the scroll event, the C++ ShadowNode representation will have a + // "more correct" scroll position. It will frequently be /incorrect/ but this decreases + // the error as much as possible. + updateFabricScrollState(scrollView); + emitScrollEvent(scrollView, xVelocity, yVelocity); + } + + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + void registerFlingAnimator(final T scrollView) { + scrollView + .getFlingAnimator() + .addListener( + new Animator.AnimatorListener() { + @Override + public void onAnimationStart(Animator animator) { + final ReactScrollViewScrollState scrollState = + scrollView.getReactScrollViewScrollState(); + scrollState.setIsCanceled(false); + scrollState.setIsFinished(false); + } + + @Override + public void onAnimationEnd(Animator animator) { + scrollView.getReactScrollViewScrollState().setIsFinished(true); + updateFabricScrollState(scrollView); + } + + @Override + public void onAnimationCancel(Animator animator) { + scrollView.getReactScrollViewScrollState().setIsCanceled(true); + } + + @Override + public void onAnimationRepeat(Animator animator) {} + }); + } + + public static < + T extends + ViewGroup & FabricViewStateManager.HasFabricViewStateManager & HasScrollState + & HasFlingAnimator> + Point predictFinalScrollPosition( + final T scrollView, + final int velocityX, + final int velocityY, + final int maximumOffsetX, + final int maximumOffsetY) { + final ReactScrollViewScrollState scrollState = scrollView.getReactScrollViewScrollState(); + // ScrollView can *only* scroll for 250ms when using smoothScrollTo and there's + // no way to customize the scroll duration. So, we create a temporary OverScroller + // so we can predict where a fling would land and snap to nearby that point. + OverScroller scroller = new OverScroller(scrollView.getContext()); + scroller.setFriction(1.0f - scrollState.getDecelerationRate()); + + // predict where a fling would end up so we can scroll to the nearest snap offset + int width = + scrollView.getWidth() + - ViewCompat.getPaddingStart(scrollView) + - ViewCompat.getPaddingEnd(scrollView); + int height = + scrollView.getHeight() - scrollView.getPaddingBottom() - scrollView.getPaddingTop(); + Point finalAnimatedPositionScroll = scrollState.getFinalAnimatedPositionScroll(); + scroller.fling( + getNextFlingStartValue( + scrollView, + scrollView.getScrollX(), + finalAnimatedPositionScroll.x, + velocityX), // startX + getNextFlingStartValue( + scrollView, + scrollView.getScrollY(), + finalAnimatedPositionScroll.y, + velocityY), // startY + velocityX, // velocityX + velocityY, // velocityY + 0, // minX + maximumOffsetX, // maxX + 0, // minY + maximumOffsetY, // maxY + width / 2, // overX + height / 2 // overY + ); + return new Point(scroller.getFinalX(), scroller.getFinalY()); + } + + public interface HasScrollState { + /** Get the scroll state for the current ScrollView */ + ReactScrollViewScrollState getReactScrollViewScrollState(); + } + + public interface HasFlingAnimator { + /** + * Start the fling animator that the ScrollView has to go from the start position to end + * position. + */ + void startFlingAnimator(int start, int end); + + /** Get the fling animator that is reused for the ScrollView to handle fling animation. */ + ValueAnimator getFlingAnimator(); + + /** Get the fling distance with current velocity for prediction */ + int getFlingExtrapolatedDistance(int velocity); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java index ac9787e56f79..495246845890 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,7 @@ import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.uimanager.DisplayMetricsHolder; import com.facebook.react.uimanager.PixelUtil; +import com.facebook.react.uimanager.PointerEvents; import com.facebook.react.uimanager.ReactClippingViewGroupHelper; import com.facebook.react.uimanager.ReactStylesDiffMap; import com.facebook.react.uimanager.Spacing; @@ -30,6 +31,7 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup; import com.facebook.yoga.YogaConstants; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -335,7 +337,12 @@ public Object updateState( @Override public @Nullable Map getExportedCustomDirectEventTypeConstants() { - return createExportedCustomDirectEventTypeConstants(); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll(createExportedCustomDirectEventTypeConstants()); + return eventTypeConstants; } public static Map createExportedCustomDirectEventTypeConstants() { @@ -357,4 +364,9 @@ public static Map createExportedCustomDirectEventTypeConstants() MapBuilder.of("registrationName", "onMomentumScrollEnd")) .build(); } + + @ReactProp(name = ViewProps.POINTER_EVENTS) + public void setPointerEvents(ReactScrollView view, @Nullable String pointerEventsStr) { + view.setPointerEvents(PointerEvents.parsePointerEvents(pointerEventsStr)); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.java index ecefb6067b00..6d3eba9b8170 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java index 87387d23d3e7..14785849f727 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ScrollEventType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VelocityHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VelocityHelper.java index a3a9acaf85ae..601dc05f9e8e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VelocityHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/scroll/VelocityHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlider.java b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlider.java index 03d527b02d93..d255cb6e3bcb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlider.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderEvent.java index 5b5c85f85925..2ac05779a12b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderManager.java index 278972551ef9..78203bbaf202 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSliderManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -37,6 +37,7 @@ import com.facebook.yoga.YogaMeasureMode; import com.facebook.yoga.YogaMeasureOutput; import com.facebook.yoga.YogaNode; +import java.util.HashMap; import java.util.Map; /** @@ -220,12 +221,15 @@ public void setMaximumTrackTintColor(ReactSlider view, Integer color) { } @Override + @ReactProp(name = "disabled") public void setDisabled(ReactSlider view, boolean value) {} @Override + @ReactProp(name = "maximumTrackImage", customType = "ImageSource") public void setMaximumTrackImage(ReactSlider view, @Nullable ReadableMap value) {} @Override + @ReactProp(name = "minimumTrackImage", customType = "ImageSource") public void setMinimumTrackImage(ReactSlider view, @Nullable ReadableMap value) {} @Override @@ -234,9 +238,11 @@ public void setTestID(ReactSlider view, @Nullable String value) { } @Override + @ReactProp(name = "thumbImage", customType = "ImageSource") public void setThumbImage(ReactSlider view, @Nullable ReadableMap value) {} @Override + @ReactProp(name = "trackImage", customType = "ImageSource") public void setTrackImage(ReactSlider view, @Nullable ReadableMap value) {} @Override @@ -246,9 +252,34 @@ protected void addEventEmitters(final ThemedReactContext reactContext, final Rea @Override public Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.of( - ReactSlidingCompleteEvent.EVENT_NAME, - MapBuilder.of("registrationName", "onSlidingComplete")); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.of( + ReactSlidingCompleteEvent.EVENT_NAME, + MapBuilder.of("registrationName", "onSlidingComplete"))); + return eventTypeConstants; + } + + @Nullable + @Override + public Map getExportedCustomBubblingEventTypeConstants() { + @Nullable + Map baseEventTypeConstants = + super.getExportedCustomBubblingEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.builder() + .put( + "topValueChange", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of("bubbled", "onValueChange", "captured", "onValueChangeCapture"))) + .build()); + return eventTypeConstants; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlidingCompleteEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlidingCompleteEvent.java index 44832295f071..b1c249b7cc46 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlidingCompleteEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/slider/ReactSlidingCompleteEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java index 8728b85d9289..ab1cd9a9ca74 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/ReactSwipeRefreshLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/RefreshEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/RefreshEvent.java index 85d23cff992d..0d2780f202d6 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/RefreshEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/RefreshEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java index 888c7d8c0a30..255855f3cab4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/swiperefresh/SwipeRefreshLayoutManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,6 +29,7 @@ import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.react.viewmanagers.AndroidSwipeRefreshLayoutManagerDelegate; import com.facebook.react.viewmanagers.AndroidSwipeRefreshLayoutManagerInterface; +import java.util.HashMap; import java.util.Map; /** @@ -175,9 +176,15 @@ public Map getExportedViewConstants() { @Override public Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.builder() - .put("topRefresh", MapBuilder.of("registrationName", "onRefresh")) - .build(); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.builder() + .put("topRefresh", MapBuilder.of("registrationName", "onRefresh")) + .build()); + return eventTypeConstants; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java index 4819bf2abd94..69c7dbd5dc66 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ import android.content.Context; import android.content.res.ColorStateList; import android.graphics.PorterDuff; +import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.os.Build; @@ -48,6 +49,18 @@ public void setChecked(boolean checked) { } } + @Override + public void setBackgroundColor(int color) { + // Ensure RippleDrawable is preserved for >=21 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + setBackground( + new RippleDrawable( + createRippleDrawableColorStateList(color), new ColorDrawable(color), null)); + } else { + super.setBackgroundColor(color); + } + } + void setColor(Drawable drawable, @Nullable Integer color) { if (color == null) { drawable.clearColorFilter(); @@ -63,14 +76,10 @@ public void setTrackColor(@Nullable Integer color) { public void setThumbColor(@Nullable Integer color) { setColor(super.getThumbDrawable(), color); - // Set the ripple color with thumb color if >= LOLLIPOP - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { - RippleDrawable ripple = (RippleDrawable) super.getBackground(); - ColorStateList customColorState = - new ColorStateList( - new int[][] {new int[] {android.R.attr.state_pressed}}, new int[] {color}); - - ripple.setColor(customColorState); + // Set the ripple color if background is instance of RippleDrawable + if (color != null && super.getBackground() instanceof RippleDrawable) { + ColorStateList customColorState = createRippleDrawableColorStateList(color); + ((RippleDrawable) super.getBackground()).setColor(customColorState); } } @@ -113,4 +122,9 @@ private void setTrackColor(boolean checked) { setTrackColor(currentTrackColor); } } + + private ColorStateList createRippleDrawableColorStateList(@Nullable Integer color) { + return new ColorStateList( + new int[][] {new int[] {android.R.attr.state_pressed}}, new int[] {color}); + } } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.java index 70f44a035467..ef0d94d1fc78 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java index 40750ff9ced9..9fc2d32315ea 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitchManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java index 16da0ed10b22..3b9cf58e33d3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLetterSpacingSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java index 0c8208468bad..1c09358b6005 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomLineHeightSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java index 61900f19f6f2..b249126cf957 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/DefaultStyleValuesUtil.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/DefaultStyleValuesUtil.java index fc93147afebe..c71bae2d11fd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/DefaultStyleValuesUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/DefaultStyleValuesUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/FontMetricsUtil.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/FontMetricsUtil.java index 57428908dfcb..f19a1b042588 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/FontMetricsUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/FontMetricsUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java index 79d6de1d29d5..073a57c21139 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactAbsoluteSizeSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java index 2be5319b9365..0954a0f8bc8c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBackgroundColorSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java index f685bf567b24..cdffdb37c71e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java index bb093d2691dd..bff24563aa1a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactClickableSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.java index 077f6006887c..d81490fd82cb 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java index 8eaa571cc2a5..3aebde60799b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactForegroundColorSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java index f18ff1a2273d..4a6901198f0b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java index 8bc11fbb4bb0..4c7af8c72e09 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactRawTextShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java index f6f74a386f5b..c847a92cb373 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java index 190b8364a938..5c5eae7bfbf1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactStrikethroughSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java index 8db06fac1a7c..535fd9757f53 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTagSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java index 6ee067cb661a..10e0f8cd19c1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextAnchorViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java index 627626abacc2..9e011bade6bf 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextInlineImageShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java index 26257ebe9388..4e67070aca4b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -343,11 +343,6 @@ public void onCollectExtraUpdates(UIViewOperationQueue uiViewOperationQueue) { mJustificationMode); uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate); } - - if (mAdjustsFontSizeToFit) { - // Nodes with `adjustsFontSizeToFit` enabled need to be remeasured on every relayout. - markUpdated(); - } } @ReactProp(name = "onTextLayout") diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java index 7400b1df909e..f1591a5fe35d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextUpdate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java index a6d48f57d17a..c71a130419b9 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java index f4f618c5ef95..04af66144bb1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,6 +22,7 @@ import com.facebook.react.uimanager.StateWrapper; import com.facebook.react.uimanager.ThemedReactContext; import com.facebook.yoga.YogaMeasureMode; +import java.util.HashMap; import java.util.Map; /** @@ -152,9 +153,15 @@ private Object getReactTextUpdate( @Override public @Nullable Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.of( - "topTextLayout", MapBuilder.of("registrationName", "onTextLayout"), - "topInlineViewLayout", MapBuilder.of("registrationName", "onInlineViewLayout")); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.of( + "topTextLayout", MapBuilder.of("registrationName", "onTextLayout"), + "topInlineViewLayout", MapBuilder.of("registrationName", "onInlineViewLayout"))); + return eventTypeConstants; } @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManagerCallback.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManagerCallback.java index 16eeab59d70e..22bb7b29fa22 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManagerCallback.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTextViewManagerCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java index 85948ef78e89..76da16072cde 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactTypefaceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java index b7067d700849..f625dfc8d4fe 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactUnderlineSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextShadowNode.java index 0f2fde535048..3c6949a3081e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java index 8b98c49121f3..421a9e8c7b42 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactVirtualTextViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java index 91c57beaccb0..4fe4bf958201 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/ShadowStyleSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java index 6c93d200e857..e2e717b2b513 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -47,8 +47,7 @@ public class TextAttributeProps { public static final short TA_KEY_BEST_WRITING_DIRECTION = 13; public static final short TA_KEY_TEXT_DECORATION_COLOR = 14; public static final short TA_KEY_TEXT_DECORATION_LINE = 15; - public static final short TA_KEY_TEXT_DECORATION_LINE_STYLE = 16; - public static final short TA_KEY_TEXT_DECORATION_LINE_PATTERN = 17; + public static final short TA_KEY_TEXT_DECORATION_STYLE = 16; public static final short TA_KEY_TEXT_SHADOW_RAIDUS = 18; public static final short TA_KEY_TEXT_SHADOW_COLOR = 19; public static final short TA_KEY_IS_HIGHLIGHTED = 20; @@ -150,10 +149,10 @@ public static TextAttributeProps fromReadableMapBuffer(ReadableMapBuffer props) ReadableMapBuffer.MapBufferEntry entry = iterator.next(); switch (entry.getKey()) { case TA_KEY_FOREGROUND_COLOR: - result.setColor(entry.getInt(0)); + result.setColor(entry.getInt()); break; case TA_KEY_BACKGROUND_COLOR: - result.setBackgroundColor(entry.getInt(0)); + result.setBackgroundColor(entry.getInt()); break; case TA_KEY_OPACITY: break; @@ -161,7 +160,7 @@ public static TextAttributeProps fromReadableMapBuffer(ReadableMapBuffer props) result.setFontFamily(entry.getString()); break; case TA_KEY_FONT_SIZE: - result.setFontSize((float) entry.getDouble(UNSET)); + result.setFontSize((float) entry.getDouble()); break; case TA_KEY_FONT_SIZE_MULTIPLIER: break; @@ -175,13 +174,13 @@ public static TextAttributeProps fromReadableMapBuffer(ReadableMapBuffer props) result.setFontVariant(entry.getReadableMapBuffer()); break; case TA_KEY_ALLOW_FONT_SCALING: - result.setAllowFontScaling(entry.getBoolean(true)); + result.setAllowFontScaling(entry.getBoolean()); break; case TA_KEY_LETTER_SPACING: - result.setLetterSpacing((float) entry.getDouble(Float.NaN)); + result.setLetterSpacing((float) entry.getDouble()); break; case TA_KEY_LINE_HEIGHT: - result.setLineHeight((float) entry.getDouble(UNSET)); + result.setLineHeight((float) entry.getDouble()); break; case TA_KEY_ALIGNMENT: break; @@ -192,15 +191,13 @@ public static TextAttributeProps fromReadableMapBuffer(ReadableMapBuffer props) case TA_KEY_TEXT_DECORATION_LINE: result.setTextDecorationLine(entry.getString()); break; - case TA_KEY_TEXT_DECORATION_LINE_STYLE: - break; - case TA_KEY_TEXT_DECORATION_LINE_PATTERN: + case TA_KEY_TEXT_DECORATION_STYLE: break; case TA_KEY_TEXT_SHADOW_RAIDUS: - result.setTextShadowRadius(entry.getInt(1)); + result.setTextShadowRadius(entry.getInt()); break; case TA_KEY_TEXT_SHADOW_COLOR: - result.setTextShadowColor(entry.getInt(DEFAULT_TEXT_SHADOW_COLOR)); + result.setTextShadowColor(entry.getInt()); break; case TA_KEY_IS_HIGHLIGHTED: break; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java index 64ab07e1bea9..f4f78871e8b3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java index 9b5596cee327..6d674ebba9b4 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineImageSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java index 3961dca4e4dd..3b0196ecd52e 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextInlineViewPlaceholderSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java index f31eee22e300..ecf50f5df779 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java index ee86e49d97e4..b73c0e5fa0b0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManagerMapBuffer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -117,7 +117,7 @@ private static void buildSpannableFromFragment( SpannableStringBuilder sb, List ops) { - for (short i = 0, length = fragments.getCount(); i < length; i++) { + for (int i = 0, length = fragments.getCount(); i < length; i++) { ReadableMapBuffer fragment = fragments.getMapBuffer(i); int start = sb.length(); diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextTransform.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextTransform.java index a36b958b43a6..ad96b7d4437b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TextTransform.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TextTransform.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/TypefaceStyle.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/TypefaceStyle.java index 3119ae63afd6..7fb87a4ff543 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/TypefaceStyle.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/TypefaceStyle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java index e43ed0361e61..65d83c2a536c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -73,7 +73,7 @@ public void setHeaders(ReadableMap headers) { mHeaders = headers; } - @ReactProp(name = "tintColor") + @ReactProp(name = "tintColor", customType = "Color") public void setTintColor(int tintColor) { mTintColor = tintColor; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java index 653ff3490f15..42eda049376a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageSpan.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager.java index dd2267cad9f3..9e0cc7998c4d 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/text/frescosupport/FrescoBasedReactTextInlineImageViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ import com.facebook.drawee.backends.pipeline.Fresco; import com.facebook.drawee.controller.AbstractDraweeControllerBuilder; import com.facebook.react.module.annotations.ReactModule; +import com.facebook.react.uimanager.BaseViewManager; import com.facebook.react.uimanager.ThemedReactContext; -import com.facebook.react.uimanager.ViewManager; /** * Manages Images embedded in Text nodes using Fresco. Since they are used only as a virtual nodes @@ -21,7 +21,7 @@ */ @ReactModule(name = FrescoBasedReactTextInlineImageViewManager.REACT_CLASS) public class FrescoBasedReactTextInlineImageViewManager - extends ViewManager { + extends BaseViewManager { public static final String REACT_CLASS = "RCTTextInlineImage"; diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ContentSizeWatcher.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ContentSizeWatcher.java index d4f426ed645e..73da55e7e30b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ContentSizeWatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ContentSizeWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactContentSizeChangedEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactContentSizeChangedEvent.java index 9d0d205a5f23..40d4b04c0487 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactContentSizeChangedEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactContentSizeChangedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java index 84d5942d2cfc..17ef123d0d20 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -114,7 +114,8 @@ public class ReactEditText extends AppCompatEditText private ReactViewBackgroundManager mReactBackgroundManager; - private final FabricViewStateManager mFabricViewStateManager = new FabricViewStateManager(); + private final @Nullable FabricViewStateManager mFabricViewStateManager = + new FabricViewStateManager(); protected boolean mDisableTextDiffing = false; protected boolean mIsSettingTextFromState = false; @@ -746,7 +747,9 @@ private void setIntrinsicContentSize() { // view, we don't need to construct one or apply it at all - it provides no use in Fabric. ReactContext reactContext = getReactContext(this); - if (!mFabricViewStateManager.hasStateWrapper() && !reactContext.isBridgeless()) { + if (mFabricViewStateManager != null + && !mFabricViewStateManager.hasStateWrapper() + && !reactContext.isBridgeless()) { final ReactTextInputLocalData localData = new ReactTextInputLocalData(this); UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class); if (uiManager != null) { @@ -978,7 +981,7 @@ public FabricViewStateManager getFabricViewStateManager() { */ private void updateCachedSpannable(boolean resetStyles) { // Noops in non-Fabric - if (!mFabricViewStateManager.hasStateWrapper()) { + if (mFabricViewStateManager != null && !mFabricViewStateManager.hasStateWrapper()) { return; } // If this view doesn't have an ID yet, we don't have a cache key, so bail here diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.java index aa2f9a6462e5..715765034cb7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditTextInputConnectionWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java index f2cce90c50f0..ac0568363fc1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextChangedEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputBlurEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputBlurEvent.java index cd6dfca8c39b..a2b6165391ee 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputBlurEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputBlurEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEndEditingEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEndEditingEvent.java index 1fca01b9fa55..ec9e2fa9cea0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEndEditingEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEndEditingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEvent.java index 2285fbfafb3e..e43499d61e95 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputFocusEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputFocusEvent.java index 61f7250e7cc7..62563b85f690 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputFocusEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputFocusEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputKeyPressEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputKeyPressEvent.java index 0b85f6180276..9236b348d9c3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputKeyPressEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputKeyPressEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputLocalData.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputLocalData.java index 98de3fd9501a..a85051068d29 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputLocalData.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputLocalData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java index 0b6298fdd1f4..df6cc09407b0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -202,48 +202,62 @@ public Class getShadowNodeClass() { @Nullable @Override public Map getExportedCustomBubblingEventTypeConstants() { - return MapBuilder.builder() - .put( - "topSubmitEditing", - MapBuilder.of( - "phasedRegistrationNames", - MapBuilder.of("bubbled", "onSubmitEditing", "captured", "onSubmitEditingCapture"))) - .put( - "topEndEditing", - MapBuilder.of( - "phasedRegistrationNames", - MapBuilder.of("bubbled", "onEndEditing", "captured", "onEndEditingCapture"))) - .put( - "topTextInput", - MapBuilder.of( - "phasedRegistrationNames", - MapBuilder.of("bubbled", "onTextInput", "captured", "onTextInputCapture"))) - .put( - "topFocus", - MapBuilder.of( - "phasedRegistrationNames", - MapBuilder.of("bubbled", "onFocus", "captured", "onFocusCapture"))) - .put( - "topBlur", - MapBuilder.of( - "phasedRegistrationNames", - MapBuilder.of("bubbled", "onBlur", "captured", "onBlurCapture"))) - .put( - "topKeyPress", - MapBuilder.of( - "phasedRegistrationNames", - MapBuilder.of("bubbled", "onKeyPress", "captured", "onKeyPressCapture"))) - .build(); + @Nullable + Map baseEventTypeConstants = + super.getExportedCustomBubblingEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.builder() + .put( + "topSubmitEditing", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of( + "bubbled", "onSubmitEditing", "captured", "onSubmitEditingCapture"))) + .put( + "topEndEditing", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of("bubbled", "onEndEditing", "captured", "onEndEditingCapture"))) + .put( + "topTextInput", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of("bubbled", "onTextInput", "captured", "onTextInputCapture"))) + .put( + "topFocus", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of("bubbled", "onFocus", "captured", "onFocusCapture"))) + .put( + "topBlur", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of("bubbled", "onBlur", "captured", "onBlurCapture"))) + .put( + "topKeyPress", + MapBuilder.of( + "phasedRegistrationNames", + MapBuilder.of("bubbled", "onKeyPress", "captured", "onKeyPressCapture"))) + .build()); + return eventTypeConstants; } @Nullable @Override public Map getExportedCustomDirectEventTypeConstants() { - return MapBuilder.builder() - .put( - ScrollEventType.getJSEventName(ScrollEventType.SCROLL), - MapBuilder.of("registrationName", "onScroll")) - .build(); + @Nullable + Map baseEventTypeConstants = super.getExportedCustomDirectEventTypeConstants(); + Map eventTypeConstants = + baseEventTypeConstants == null ? new HashMap() : baseEventTypeConstants; + eventTypeConstants.putAll( + MapBuilder.builder() + .put( + ScrollEventType.getJSEventName(ScrollEventType.SCROLL), + MapBuilder.of("registrationName", "onScroll")) + .build()); + return eventTypeConstants; } @Override @@ -288,16 +302,17 @@ public void receiveCommand( return; } - String text = args.getString(1); - int start = args.getInt(2); int end = args.getInt(3); if (end == UNSET) { end = start; } - reactEditText.maybeSetTextFromJS( - getReactTextUpdate(text, mostRecentEventCount, start, end)); + if (!args.isNull(1)) { + String text = args.getString(1); + reactEditText.maybeSetTextFromJS( + getReactTextUpdate(text, mostRecentEventCount, start, end)); + } reactEditText.maybeSetSelection(mostRecentEventCount, start, end); break; } diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSelectionEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSelectionEvent.java index a69ca8766c92..161a577f89a3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSelectionEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSelectionEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java index a9c3ff91d826..5cc8758654a0 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputShadowNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSubmitEditingEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSubmitEditingEvent.java index 0dee36ddfac7..9e1b5db2668a 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSubmitEditingEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputSubmitEditingEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ScrollWatcher.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ScrollWatcher.java index 946f0abc8566..a45d341c8858 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ScrollWatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ScrollWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/SelectionWatcher.java b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/SelectionWatcher.java index 4ba298b5f1fe..23b47c251bed 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/textinput/SelectionWatcher.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/textinput/SelectionWatcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedView.java b/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedView.java index 42fcacf62bae..f9695e8ce93b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedView.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedView.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedViewManager.java index 4cb5f3c3c277..80c4c1a37278 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview/ReactUnimplementedViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/CanvasUtil.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/CanvasUtil.java index f65353bb8dd9..e8c5460b127f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/CanvasUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/CanvasUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ColorUtil.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ColorUtil.java index b8bcb6965aee..cc804ef703ee 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ColorUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ColorUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/MeasureUtil.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/MeasureUtil.java index a8defa1b8d09..b20a9792ad02 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/MeasureUtil.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/MeasureUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.java index 8f5a436320f1..bb2a051bbb27 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactClippingViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.java index b4a3feb9418c..838823498234 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactDrawableHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java index 5d19b8713924..c6fdb1f6ee02 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundDrawable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java index 2d9f111ec585..c89b4e3ad0c8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewBackgroundManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java index 8aedfecf7723..79ac5dadcc5c 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -44,7 +44,7 @@ import com.facebook.react.uimanager.ReactClippingProhibitedView; import com.facebook.react.uimanager.ReactClippingViewGroup; import com.facebook.react.uimanager.ReactClippingViewGroupHelper; -import com.facebook.react.uimanager.ReactOverflowView; +import com.facebook.react.uimanager.ReactOverflowViewWithInset; import com.facebook.react.uimanager.ReactPointerEventsView; import com.facebook.react.uimanager.ReactZIndexedViewGroup; import com.facebook.react.uimanager.RootView; @@ -66,11 +66,12 @@ public class ReactViewGroup extends ViewGroup ReactPointerEventsView, ReactHitSlopView, ReactZIndexedViewGroup, - ReactOverflowView { + ReactOverflowViewWithInset { private static final int ARRAY_CAPACITY_INCREMENT = 12; private static final int DEFAULT_BACKGROUND_COLOR = Color.TRANSPARENT; private static final LayoutParams sDefaultLayoutParam = new ViewGroup.LayoutParams(0, 0); + private final Rect mOverflowInset = new Rect(); /* should only be used in {@link #updateClippingToRect} */ private static final Rect sHelperRect = new Rect(); @@ -726,6 +727,16 @@ public void setOverflow(String overflow) { return mOverflow; } + @Override + public void setOverflowInset(int left, int top, int right, int bottom) { + mOverflowInset.set(left, top, right, bottom); + } + + @Override + public Rect getOverflowInset() { + return mOverflowInset; + } + /** * Set the background for the view or remove the background. It calls {@link * #setBackground(Drawable)} or {@link #setBackgroundDrawable(Drawable)} based on the sdk version. diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java index 1192b50f2e4c..8ec0f5660ae7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,6 +13,7 @@ import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import com.facebook.react.bridge.Dynamic; import com.facebook.react.bridge.JSApplicationIllegalArgumentException; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.ReadableArray; @@ -30,7 +31,6 @@ import com.facebook.react.uimanager.annotations.ReactPropGroup; import com.facebook.react.uimanager.events.EventDispatcher; import com.facebook.yoga.YogaConstants; -import java.util.Locale; import java.util.Map; /** View manager for AndroidViews (plain React Views). */ @@ -126,34 +126,41 @@ public void setBorderStyle(ReactViewGroup view, @Nullable String borderStyle) { } @ReactProp(name = "hitSlop") - public void setHitSlop(final ReactViewGroup view, @Nullable ReadableMap hitSlop) { - if (hitSlop == null) { - view.setHitSlopRect(null); - } else { - view.setHitSlopRect( - new Rect( - hitSlop.hasKey("left") - ? (int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("left")) - : 0, - hitSlop.hasKey("top") ? (int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("top")) : 0, - hitSlop.hasKey("right") - ? (int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("right")) - : 0, - hitSlop.hasKey("bottom") - ? (int) PixelUtil.toPixelFromDIP(hitSlop.getDouble("bottom")) - : 0)); + public void setHitSlop(final ReactViewGroup view, Dynamic hitSlop) { + switch (hitSlop.getType()) { + case Null: + view.setHitSlopRect(null); + break; + case Map: + ReadableMap hitSlopMap = hitSlop.asMap(); + view.setHitSlopRect( + new Rect( + hitSlopMap.hasKey("left") + ? (int) PixelUtil.toPixelFromDIP(hitSlopMap.getDouble("left")) + : 0, + hitSlopMap.hasKey("top") + ? (int) PixelUtil.toPixelFromDIP(hitSlopMap.getDouble("top")) + : 0, + hitSlopMap.hasKey("right") + ? (int) PixelUtil.toPixelFromDIP(hitSlopMap.getDouble("right")) + : 0, + hitSlopMap.hasKey("bottom") + ? (int) PixelUtil.toPixelFromDIP(hitSlopMap.getDouble("bottom")) + : 0)); + break; + case Number: + int hitSlopValue = (int) PixelUtil.toPixelFromDIP(hitSlop.asDouble()); + view.setHitSlopRect(new Rect(hitSlopValue, hitSlopValue, hitSlopValue, hitSlopValue)); + break; + default: + throw new JSApplicationIllegalArgumentException( + "Invalid type for 'hitSlop' value " + hitSlop.getType()); } } @ReactProp(name = ViewProps.POINTER_EVENTS) public void setPointerEvents(ReactViewGroup view, @Nullable String pointerEventsStr) { - if (pointerEventsStr == null) { - view.setPointerEvents(PointerEvents.AUTO); - } else { - PointerEvents pointerEvents = - PointerEvents.valueOf(pointerEventsStr.toUpperCase(Locale.US).replace("-", "_")); - view.setPointerEvents(pointerEvents); - } + view.setPointerEvents(PointerEvents.parsePointerEvents(pointerEventsStr)); } @ReactProp(name = "nativeBackgroundAndroid") diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/view/ViewGroupClickEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/view/ViewGroupClickEvent.java index d7a380802fbb..a9bc7bc2109f 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/view/ViewGroupClickEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/view/ViewGroupClickEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java b/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java index 7da483cd2452..0754f9558418 100644 --- a/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java +++ b/ReactAndroid/src/main/java/com/facebook/systrace/Systrace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/systrace/SystraceMessage.java b/ReactAndroid/src/main/java/com/facebook/systrace/SystraceMessage.java index 22e096845f5d..0690f3ecea12 100644 --- a/ReactAndroid/src/main/java/com/facebook/systrace/SystraceMessage.java +++ b/ReactAndroid/src/main/java/com/facebook/systrace/SystraceMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/systrace/TraceListener.java b/ReactAndroid/src/main/java/com/facebook/systrace/TraceListener.java index 866202ea0f18..f9b736fd4e09 100644 --- a/ReactAndroid/src/main/java/com/facebook/systrace/TraceListener.java +++ b/ReactAndroid/src/main/java/com/facebook/systrace/TraceListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/LayoutPassReason.java b/ReactAndroid/src/main/java/com/facebook/yoga/LayoutPassReason.java index d04ea9df1f38..59046f05e8e7 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/LayoutPassReason.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/LayoutPassReason.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java index 82c6cbfbdcd0..5411e39f2efe 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaAlign.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaBaselineFunction.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaBaselineFunction.java index dbd405c6c776..d3444215c317 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaBaselineFunction.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaBaselineFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java index 8dd2ce8242a8..a91e51573b29 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfig.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigFactory.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigFactory.java index 0d9ed50d45cb..631545fac2c8 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.java index fdc351d87c11..b5820d8590a4 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIFinalizer.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIFinalizer.java index bb082e86f778..a9c3e5f38d07 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIFinalizer.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConfigJNIFinalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java index 48f39357ceeb..f8205fc60c64 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java index cebcdc47e0f8..eeecd85ed47c 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaDimension.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.java index 4e75d3035be3..344c0f8079e9 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaDirection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java index 76cbfd7749aa..aa94b0536a9e 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaDisplay.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java index cba1793452e5..929b3315b332 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaEdge.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java index 76525eab660a..f54c7b6e1cd2 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaExperimentalFeature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java index 83060e134eb0..c314c0cf03cd 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaFlexDirection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java index 3d39015e0eab..e19213f7e8b6 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaJustify.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLayoutType.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLayoutType.java index 13c707a90f47..8c861ff7d3f9 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLayoutType.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLayoutType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java index f6a84023365e..f105145aea42 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogLevel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java index d8420ad7b4ed..9d439ad31df3 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaLogger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureFunction.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureFunction.java index 8b8533ba1d92..21da35feadbf 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureFunction.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java index 848d4aa7989f..1750d2a1f431 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureMode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureOutput.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureOutput.java index 575129f92cf4..c7a77abaa7f1 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureOutput.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaMeasureOutput.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java index 3674b42f7c1a..1aca48216461 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNative.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java index 109172eefc35..cbba2f55e042 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeFactory.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeFactory.java index 042c2154f3ad..912083a7f81e 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeFactory.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java index 7efb8ce1dac2..87517b63ccf0 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.java index bffa5c832b72..424006e978d8 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeJNIFinalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java index 4386bf387908..1d90eec34c5b 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaNodeType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java index 90c978814e85..321d4e00a655 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaOverflow.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java index d61c3244fa20..6663a0ee66d4 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaPositionType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java index 9a7f02ec7f2e..8c1a34d95591 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaPrintOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java index 9faa520f98d9..398bc8f026a0 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaProps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaStyleInputs.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaStyleInputs.java index 21ca2803abed..405a2770043b 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaStyleInputs.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaStyleInputs.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java index 5a7e5e66c378..e2ab8bffb72f 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaUnit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java index a5679641d83e..2a266b02d90f 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java index 7ad005682350..e7e6014328ca 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaWrap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/Application.mk b/ReactAndroid/src/main/jni/Application.mk index f90f6b9418be..40ff08e84acb 100644 --- a/ReactAndroid/src/main/jni/Application.mk +++ b/ReactAndroid/src/main/jni/Application.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/Android.mk b/ReactAndroid/src/main/jni/first-party/fb/Android.mk index 63907ed47f29..b43c52c620b1 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/Android.mk +++ b/ReactAndroid/src/main/jni/first-party/fb/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/assert.cpp b/ReactAndroid/src/main/jni/first-party/fb/assert.cpp index c0ec5661e889..d560e33a80e1 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/assert.cpp +++ b/ReactAndroid/src/main/jni/first-party/fb/assert.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/ALog.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/ALog.h index 6c78fbff562d..7962ebbf9e0a 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/ALog.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/ALog.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/Build.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/Build.h index 812c4c89d18a..94916b1670d3 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/Build.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/Build.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/Countable.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/Countable.h index 0035d15285b0..6ba2439b9b91 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/Countable.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/Countable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/Environment.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/Environment.h index b2f390d91e90..b79f6911707f 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/Environment.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/Environment.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/ProgramLocation.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/ProgramLocation.h index dadf89ca15ab..ebfe450c0ecc 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/ProgramLocation.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/ProgramLocation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/RefPtr.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/RefPtr.h index 6b24554ede63..7cf38b454e5e 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/RefPtr.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/RefPtr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/StaticInitialized.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/StaticInitialized.h index d5c553423aa4..787c343e7a4d 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/StaticInitialized.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/StaticInitialized.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/ThreadLocal.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/ThreadLocal.h index 3182fe297dc3..7d7b8c274d8d 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/ThreadLocal.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/ThreadLocal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/assert.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/assert.h index fcd284b1b699..5866145a9344 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/assert.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/assert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/noncopyable.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/noncopyable.h index 48a3a004e979..411550444adb 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/noncopyable.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/noncopyable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/nonmovable.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/nonmovable.h index 7d483141f26e..936fe195c426 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/nonmovable.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/nonmovable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/include/fb/visibility.h b/ReactAndroid/src/main/jni/first-party/fb/include/fb/visibility.h index 098d5ddcaba1..f44ef6055260 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/include/fb/visibility.h +++ b/ReactAndroid/src/main/jni/first-party/fb/include/fb/visibility.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fb/log.cpp b/ReactAndroid/src/main/jni/first-party/fb/log.cpp index c2c5ae926873..510787e93b44 100644 --- a/ReactAndroid/src/main/jni/first-party/fb/log.cpp +++ b/ReactAndroid/src/main/jni/first-party/fb/log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fbgloginit/Android.mk b/ReactAndroid/src/main/jni/first-party/fbgloginit/Android.mk index ee9f3709cea6..357332be368b 100644 --- a/ReactAndroid/src/main/jni/first-party/fbgloginit/Android.mk +++ b/ReactAndroid/src/main/jni/first-party/fbgloginit/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fbgloginit/fb/glog_init.h b/ReactAndroid/src/main/jni/first-party/fbgloginit/fb/glog_init.h index d1762008b66b..4118360c505e 100644 --- a/ReactAndroid/src/main/jni/first-party/fbgloginit/fb/glog_init.h +++ b/ReactAndroid/src/main/jni/first-party/fbgloginit/fb/glog_init.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fbgloginit/glog_init.cpp b/ReactAndroid/src/main/jni/first-party/fbgloginit/glog_init.cpp index 8e781859e5d7..ebbd18c979c9 100644 --- a/ReactAndroid/src/main/jni/first-party/fbgloginit/glog_init.cpp +++ b/ReactAndroid/src/main/jni/first-party/fbgloginit/glog_init.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk b/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk index a55b822fa0fd..bc61e176b946 100644 --- a/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk +++ b/ReactAndroid/src/main/jni/first-party/fbjni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/hermes/Android.mk b/ReactAndroid/src/main/jni/first-party/hermes/Android.mk index ab60e9240c52..266532a91cbd 100644 --- a/ReactAndroid/src/main/jni/first-party/hermes/Android.mk +++ b/ReactAndroid/src/main/jni/first-party/hermes/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/jni-hack/BUCK b/ReactAndroid/src/main/jni/first-party/jni-hack/BUCK index a0144cc50f7e..d7f0b0fcab12 100644 --- a/ReactAndroid/src/main/jni/first-party/jni-hack/BUCK +++ b/ReactAndroid/src/main/jni/first-party/jni-hack/BUCK @@ -1,6 +1,6 @@ load("//tools/build_defs/oss:rn_defs.bzl", "cxx_library") -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/jni-hack/jni.h b/ReactAndroid/src/main/jni/first-party/jni-hack/jni.h index 813bcb961599..cd49dc598624 100644 --- a/ReactAndroid/src/main/jni/first-party/jni-hack/jni.h +++ b/ReactAndroid/src/main/jni/first-party/jni-hack/jni.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/Android.mk b/ReactAndroid/src/main/jni/first-party/yogajni/Android.mk index b2a8c5fdf61e..0203420a1fab 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/Android.mk +++ b/ReactAndroid/src/main/jni/first-party/yogajni/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := yoga LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jni/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/jni diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedGlobalRef.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedGlobalRef.h index fa98214af342..4d06a45930dc 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedGlobalRef.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedGlobalRef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedLocalRef.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedLocalRef.h index 2368ced2ba7e..bd046a279f93 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedLocalRef.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedLocalRef.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.h index dbff73f9eb4a..8001681c0845 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNI.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp index 71fe98f3e75e..6b6fb7f43ebd 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.h index 4179a488dcc4..77b8b11ba3c0 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJNIVanilla.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJTypesVanilla.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJTypesVanilla.h index d1202b755fa7..5cf406827cf9 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJTypesVanilla.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YGJTypesVanilla.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.cpp index 5d6bfbfe82e5..edc20986bb77 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.h index d333adf53cfd..b0378ab450ff 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/YogaJniException.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.cpp index 37b5677021cb..e8ece68a3638 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.h index fda1e06dc00c..d79c3e50ceb0 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.cpp index 8d5222893fdc..1f8c3f75c66e 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.h index 18736dbbb801..e6f2650e09fe 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/corefunctions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/macros.h b/ReactAndroid/src/main/jni/first-party/yogajni/jni/macros.h index ea7c554bd2f4..2e2632d52115 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/macros.h +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/macros.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/first-party/yogajni/jni/yogajni.cpp b/ReactAndroid/src/main/jni/first-party/yogajni/jni/yogajni.cpp index ee12649414c7..cab45a13b501 100644 --- a/ReactAndroid/src/main/jni/first-party/yogajni/jni/yogajni.cpp +++ b/ReactAndroid/src/main/jni/first-party/yogajni/jni/yogajni.cpp @@ -1,9 +1,10 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ + #include "YGJNIVanilla.h" #include "common.h" diff --git a/ReactAndroid/src/main/jni/react/jni/Android.mk b/ReactAndroid/src/main/jni/react/jni/Android.mk index af2077b5a663..054faa19bfb8 100644 --- a/ReactAndroid/src/main/jni/react/jni/Android.mk +++ b/ReactAndroid/src/main/jni/react/jni/Android.mk @@ -1,61 +1,10 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. - -########################## -### React Native Utils ### -########################## - LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -# Include . in the header search path for all source files in this module. -LOCAL_C_INCLUDES := $(LOCAL_PATH) - -# Include ./../../ in the header search path for modules that depend on -# reactnativejni. This will allow external modules to require this module's -# headers using #include .h>, assuming: -# . == jni -# ./../ == react -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../.. - -LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture - -LOCAL_LDLIBS += -landroid - -# The dynamic libraries (.so files) that this module depends on. -LOCAL_SHARED_LIBRARIES := libfolly_json libfb libfbjni libglog_init libyoga libreact_render_runtimescheduler - -# The static libraries (.a files) that this module depends on. -LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder libruntimeexecutor - -# Name of this module. -# -# Other modules can depend on this one by adding libreactnativejni to their -# LOCAL_SHARED_LIBRARIES variable. -LOCAL_MODULE := reactnativeutilsjni - -# Compile all local c++ files. -LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) - -ifeq ($(APP_OPTIM),debug) - # Keep symbols by overriding the strip command invoked by ndk-build. - # Note that this will apply to all shared libraries, - # i.e. shared libraries will NOT be stripped - # even though we override it in this Android.mk - cmd-strip := -endif - -# Build the files in this directory as a shared library -include $(BUILD_SHARED_LIBRARY) - - - - - ###################### ### reactnativejni ### ###################### @@ -77,10 +26,18 @@ LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture LOCAL_LDLIBS += -landroid # The dynamic libraries (.so files) that this module depends on. -LOCAL_SHARED_LIBRARIES := libreactnativeutilsjni libfolly_json libfb libfbjni libglog_init libyoga logger libreact_render_runtimescheduler +LOCAL_SHARED_LIBRARIES := \ + libfb \ + libfbjni \ + libfolly_json \ + libglog_init \ + libreact_render_runtimescheduler \ + libruntimeexecutor \ + libyoga \ + logger # The static libraries (.a files) that this module depends on. -LOCAL_STATIC_LIBRARIES := libreactnative libruntimeexecutor libcallinvokerholder +LOCAL_STATIC_LIBRARIES := libreactnative libcallinvokerholder # Name of this module. # @@ -89,7 +46,8 @@ LOCAL_STATIC_LIBRARIES := libreactnative libruntimeexecutor libcallinvokerholder LOCAL_MODULE := reactnativejni # Compile all local c++ files. -LOCAL_SRC_FILES := $(wildcard *.cpp) +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) ifeq ($(APP_OPTIM),debug) # Keep symbols by overriding the strip command invoked by ndk-build. @@ -114,7 +72,7 @@ include $(BUILD_SHARED_LIBRARY) # Whenever you encounter an include

//Android.mk, you # tell andorid-ndk to compile the module in / according # to the specification inside //Android.mk. -$(call import-module,better) +$(call import-module,butter) $(call import-module,folly) $(call import-module,fb) $(call import-module,fbjni) diff --git a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp index 00d947649afa..18abeb88b2f1 100644 --- a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +++ b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h index 219669714df8..fe635bf48250 100644 --- a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h +++ b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.cpp b/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.cpp index 1d183271f2e6..f712545de7d3 100644 --- a/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.cpp +++ b/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.h b/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.h index 2ffe575263da..656fd8ef0a6e 100644 --- a/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.h +++ b/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapperBase.h b/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapperBase.h index 9a364427f059..3b561522409b 100644 --- a/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapperBase.h +++ b/ReactAndroid/src/main/jni/react/jni/CxxModuleWrapperBase.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/CxxSharedModuleWrapper.h b/ReactAndroid/src/main/jni/react/jni/CxxSharedModuleWrapper.h index 19178ff8ccce..1a06300c2e6d 100644 --- a/ReactAndroid/src/main/jni/react/jni/CxxSharedModuleWrapper.h +++ b/ReactAndroid/src/main/jni/react/jni/CxxSharedModuleWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JCallback.h b/ReactAndroid/src/main/jni/react/jni/JCallback.h index 271cd595eb00..504ad92281f3 100644 --- a/ReactAndroid/src/main/jni/react/jni/JCallback.h +++ b/ReactAndroid/src/main/jni/react/jni/JCallback.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JInspector.cpp b/ReactAndroid/src/main/jni/react/jni/JInspector.cpp index 1fbe238b9e08..27eca48da219 100644 --- a/ReactAndroid/src/main/jni/react/jni/JInspector.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JInspector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JInspector.h b/ReactAndroid/src/main/jni/react/jni/JInspector.h index 9af8320dbeb1..4016365e589a 100644 --- a/ReactAndroid/src/main/jni/react/jni/JInspector.h +++ b/ReactAndroid/src/main/jni/react/jni/JInspector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp b/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp index badb136f4c22..5f4caf8051c8 100644 --- a/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -69,7 +69,7 @@ void JMessageQueueThread::runOnQueue(std::function &&runnable) { jni::ThreadScope guard; static auto method = JavaMessageQueueThread::javaClassStatic() - ->getMethod("runOnQueue"); + ->getMethod("runOnQueue"); method( m_jobj, JNativeRunnable::newObjectCxxArgs(wrapRunnable(std::move(runnable))) diff --git a/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h b/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h index ef76632dfa42..bc5334a3c503 100644 --- a/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h +++ b/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JNativeRunnable.h b/ReactAndroid/src/main/jni/react/jni/JNativeRunnable.h index 28c547384a88..cd1a022e4c57 100644 --- a/ReactAndroid/src/main/jni/react/jni/JNativeRunnable.h +++ b/ReactAndroid/src/main/jni/react/jni/JNativeRunnable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp b/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp index 5b3409eb1b47..8aff63d2d884 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h b/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h index 0ed379b9f139..45b2799f77fd 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h +++ b/ReactAndroid/src/main/jni/react/jni/JReactCxxErrorHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp index d80009141758..ecb87cd43980 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JReactMarker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,8 +18,8 @@ void JReactMarker::setLogPerfMarkerIfNeeded() { static std::once_flag flag{}; std::call_once(flag, []() { ReactMarker::logTaggedMarker = JReactMarker::logPerfMarker; - ReactMarker::logTaggedMarkerWithInstanceKey = - JReactMarker::logPerfMarkerWithInstanceKey; + ReactMarker::logTaggedMarkerBridgeless = + JReactMarker::logPerfMarkerBridgeless; }); } @@ -51,7 +51,15 @@ void JReactMarker::logMarker( void JReactMarker::logPerfMarker( const ReactMarker::ReactMarkerId markerId, const char *tag) { - logPerfMarkerWithInstanceKey(markerId, tag, 0); + const int bridgeInstanceKey = 0; + logPerfMarkerWithInstanceKey(markerId, tag, bridgeInstanceKey); +} + +void JReactMarker::logPerfMarkerBridgeless( + const ReactMarker::ReactMarkerId markerId, + const char *tag) { + const int bridgelessInstanceKey = 1; + logPerfMarkerWithInstanceKey(markerId, tag, bridgelessInstanceKey); } void JReactMarker::logPerfMarkerWithInstanceKey( diff --git a/ReactAndroid/src/main/jni/react/jni/JReactMarker.h b/ReactAndroid/src/main/jni/react/jni/JReactMarker.h index d495daf9ec6c..7ee91f0019aa 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactMarker.h +++ b/ReactAndroid/src/main/jni/react/jni/JReactMarker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -31,6 +31,9 @@ class JReactMarker : public facebook::jni::JavaClass { static void logPerfMarker( const ReactMarker::ReactMarkerId markerId, const char *tag); + static void logPerfMarkerBridgeless( + const ReactMarker::ReactMarkerId markerId, + const char *tag); static void logPerfMarkerWithInstanceKey( const ReactMarker::ReactMarkerId markerId, const char *tag, diff --git a/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.cpp b/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.cpp index 788de6f99abc..7f1cf1d1f46e 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.h b/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.h index 6a91ec709af9..fda4b85e3ebd 100644 --- a/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.h +++ b/ReactAndroid/src/main/jni/react/jni/JReactSoftExceptionLogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.cpp b/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.cpp index e8e6436c294f..70bda09416cc 100644 --- a/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.h b/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.h index 1a250d7a867b..03df73d1a446 100644 --- a/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.h +++ b/ReactAndroid/src/main/jni/react/jni/JRuntimeExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.cpp b/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.cpp index 1176d21f31c1..7a9b3f8efaf9 100644 --- a/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.h b/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.h index 3f3f7e857d6a..8bc42bf9d024 100644 --- a/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.h +++ b/ReactAndroid/src/main/jni/react/jni/JRuntimeScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp b/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp index c0833d94ac81..16fcc43d4fa5 100644 --- a/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JSLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,14 +9,9 @@ #include #include -#include +#include #include #include -#include -#include -#include -#include -#include #ifdef WITH_FBSYSTRACE #include @@ -28,6 +23,31 @@ using namespace facebook::jni; namespace facebook { namespace react { +class AssetManagerString : public JSBigString { + public: + AssetManagerString(AAsset *asset) : asset_(asset){}; + + virtual ~AssetManagerString() { + AAsset_close(asset_); + } + + bool isAscii() const override { + return false; + } + + const char *c_str() const override { + return (const char *)AAsset_getBuffer(asset_); + } + + // Length of the c_str without the NULL byte. + size_t size() const override { + return AAsset_getLength(asset_); + } + + private: + AAsset *asset_; +}; + __attribute__((visibility("default"))) AAssetManager *extractAssetManager( alias_ref assetManager) { auto env = Environment::current(); @@ -50,17 +70,21 @@ loadScriptFromAssets(AAssetManager *manager, const std::string &assetName) { AASSET_MODE_STREAMING); // Optimized for sequential read: see // AssetManager.java for docs if (asset) { - auto buf = std::make_unique(AAsset_getLength(asset)); - size_t offset = 0; - int readbytes; - while ((readbytes = AAsset_read( - asset, buf->data() + offset, buf->size() - offset)) > 0) { - offset += readbytes; - } - AAsset_close(asset); - if (offset == buf->size()) { - return std::move(buf); + auto script = std::make_unique(asset); + if (script->size() >= sizeof(BundleHeader)) { + // When using bytecode, it's safe for the underlying buffer to not be \0 + // terminated. In all other scenarios, we will force a copy of the + // script to ensure we have a terminator. + const BundleHeader *header = + reinterpret_cast(script->c_str()); + if (parseTypeFromHeader(*header) == ScriptTag::HBCBundle) { + return script; + } } + + auto buf = std::make_unique(script->size()); + memcpy(buf->data(), script->c_str(), script->size()); + return buf; } } diff --git a/ReactAndroid/src/main/jni/react/jni/JSLoader.h b/ReactAndroid/src/main/jni/react/jni/JSLoader.h index 925d4575f516..d16f2990276c 100644 --- a/ReactAndroid/src/main/jni/react/jni/JSLoader.h +++ b/ReactAndroid/src/main/jni/react/jni/JSLoader.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JSLogging.cpp b/ReactAndroid/src/main/jni/react/jni/JSLogging.cpp index 6a174e6634be..cf0a293688ab 100644 --- a/ReactAndroid/src/main/jni/react/jni/JSLogging.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JSLogging.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JSLogging.h b/ReactAndroid/src/main/jni/react/jni/JSLogging.h index 3d853200fb3a..0fd115bafa3c 100644 --- a/ReactAndroid/src/main/jni/react/jni/JSLogging.h +++ b/ReactAndroid/src/main/jni/react/jni/JSLogging.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.cpp b/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.cpp index 14aa1b54a57c..b737cd0d23e0 100644 --- a/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h b/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h index 414ee916e863..e4a56e453c4b 100644 --- a/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h +++ b/ReactAndroid/src/main/jni/react/jni/JavaModuleWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h b/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h index 02a1c8d12fd9..1a4fa1435c10 100644 --- a/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h +++ b/ReactAndroid/src/main/jni/react/jni/JavaScriptExecutorHolder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.cpp b/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.cpp index f99243200c23..40aab053c681 100644 --- a/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.cpp +++ b/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h b/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h index 68f41a3d698c..71187fd99aec 100644 --- a/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h +++ b/ReactAndroid/src/main/jni/react/jni/JniJSModulesUnbundle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp b/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp index 496a99cdca3a..b9009c1a5d07 100644 --- a/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp +++ b/ReactAndroid/src/main/jni/react/jni/MethodInvoker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h b/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h index 67f5fc06d637..f0ab0a168144 100644 --- a/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h +++ b/ReactAndroid/src/main/jni/react/jni/MethodInvoker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.cpp b/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.cpp index b239481e7c60..eeb248504aae 100644 --- a/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.cpp +++ b/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h b/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h index 16e7878ffffc..6f837b8f3bb1 100644 --- a/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h +++ b/ReactAndroid/src/main/jni/react/jni/ModuleRegistryBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeArray.cpp b/ReactAndroid/src/main/jni/react/jni/NativeArray.cpp index 7e168c29a733..09dd34c2652f 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeArray.cpp +++ b/ReactAndroid/src/main/jni/react/jni/NativeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeArray.h b/ReactAndroid/src/main/jni/react/jni/NativeArray.h index 8c7c879ac2b0..b42083083a6b 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeArray.h +++ b/ReactAndroid/src/main/jni/react/jni/NativeArray.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeCommon.cpp b/ReactAndroid/src/main/jni/react/jni/NativeCommon.cpp index b244d45655cf..3b604bd06e72 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeCommon.cpp +++ b/ReactAndroid/src/main/jni/react/jni/NativeCommon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeCommon.h b/ReactAndroid/src/main/jni/react/jni/NativeCommon.h index 26128141dc5b..d04c3b7bd460 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeCommon.h +++ b/ReactAndroid/src/main/jni/react/jni/NativeCommon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeMap.cpp b/ReactAndroid/src/main/jni/react/jni/NativeMap.cpp index 5f02cb98a9f7..9783ac15f4cb 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeMap.cpp +++ b/ReactAndroid/src/main/jni/react/jni/NativeMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeMap.h b/ReactAndroid/src/main/jni/react/jni/NativeMap.h index 375e4592fa42..2318ca28caeb 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeMap.h +++ b/ReactAndroid/src/main/jni/react/jni/NativeMap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp b/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp index 05eb72b49bc0..042805ff66da 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp +++ b/ReactAndroid/src/main/jni/react/jni/NativeTime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/NativeTime.h b/ReactAndroid/src/main/jni/react/jni/NativeTime.h index b4d028dd8829..bc943de23f7e 100644 --- a/ReactAndroid/src/main/jni/react/jni/NativeTime.h +++ b/ReactAndroid/src/main/jni/react/jni/NativeTime.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp index 46c825c87d05..cbcaa77eb1d6 100644 --- a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/OnLoad.h b/ReactAndroid/src/main/jni/react/jni/OnLoad.h index f0cad0feda37..b68b71bd2048 100644 --- a/ReactAndroid/src/main/jni/react/jni/OnLoad.h +++ b/ReactAndroid/src/main/jni/react/jni/OnLoad.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp index 17e324d11545..45217f71ecfb 100644 --- a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp +++ b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h index d4adbf6d7219..79d36e50f074 100644 --- a/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h +++ b/ReactAndroid/src/main/jni/react/jni/ProxyExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.cpp b/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.cpp index 90efc55ecdad..b9a5ddf15e3b 100644 --- a/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.cpp +++ b/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.h b/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.h index 2e89f954e09b..64bee2931d50 100644 --- a/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.h +++ b/ReactAndroid/src/main/jni/react/jni/ReadableNativeArray.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.cpp b/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.cpp index 61f686c44044..f85b5db943f4 100644 --- a/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.cpp +++ b/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.h b/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.h index 282082c39aa8..2c11d9572d3a 100644 --- a/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.h +++ b/ReactAndroid/src/main/jni/react/jni/ReadableNativeMap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.cpp b/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.cpp index 5040fead9bb5..14746a38f62e 100644 --- a/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.cpp +++ b/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #include "WritableNativeArray.h" -#include "WritableNativeMap.h" +#include "ReadableNativeMap.h" using namespace facebook::jni; @@ -17,6 +17,13 @@ namespace react { WritableNativeArray::WritableNativeArray() : HybridBase(folly::dynamic::array()) {} +WritableNativeArray::WritableNativeArray(folly::dynamic &&val) + : HybridBase(std::move(val)) { + if (!array_.isArray()) { + throw std::runtime_error("WritableNativeArray value must be an array."); + } +} + local_ref WritableNativeArray::initHybrid( alias_ref) { return makeCxxInstance(); @@ -51,7 +58,7 @@ void WritableNativeArray::pushString(jstring value) { array_.push_back(wrap_alias(value)->toStdString()); } -void WritableNativeArray::pushNativeArray(WritableNativeArray *otherArray) { +void WritableNativeArray::pushNativeArray(ReadableNativeArray *otherArray) { if (otherArray == NULL) { pushNull(); return; @@ -60,7 +67,7 @@ void WritableNativeArray::pushNativeArray(WritableNativeArray *otherArray) { array_.push_back(otherArray->consume()); } -void WritableNativeArray::pushNativeMap(WritableNativeMap *map) { +void WritableNativeArray::pushNativeMap(ReadableNativeMap *map) { if (map == NULL) { pushNull(); return; diff --git a/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.h b/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.h index 7b9ba7cc9598..fe5d8ad2e4e4 100644 --- a/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.h +++ b/ReactAndroid/src/main/jni/react/jni/WritableNativeArray.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,7 +16,7 @@ namespace facebook { namespace react { -struct WritableNativeMap; +struct ReadableNativeMap; struct WritableArray : jni::JavaClass { static auto constexpr kJavaDescriptor = @@ -29,6 +29,8 @@ struct WritableNativeArray "Lcom/facebook/react/bridge/WritableNativeArray;"; WritableNativeArray(); + WritableNativeArray(folly::dynamic &&val); + static jni::local_ref initHybrid(jni::alias_ref); void pushNull(); @@ -36,8 +38,8 @@ struct WritableNativeArray void pushDouble(jdouble value); void pushInt(jint value); void pushString(jstring value); - void pushNativeArray(WritableNativeArray *otherArray); - void pushNativeMap(WritableNativeMap *map); + void pushNativeArray(ReadableNativeArray *otherArray); + void pushNativeMap(ReadableNativeMap *map); static void registerNatives(); }; diff --git a/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.cpp b/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.cpp index 70c41a447698..ddb0a8334373 100644 --- a/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.cpp +++ b/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -57,7 +57,7 @@ void WritableNativeMap::putString(std::string key, alias_ref val) { void WritableNativeMap::putNativeArray( std::string key, - WritableNativeArray *otherArray) { + ReadableNativeArray *otherArray) { if (!otherArray) { putNull(std::move(key)); return; @@ -68,7 +68,7 @@ void WritableNativeMap::putNativeArray( void WritableNativeMap::putNativeMap( std::string key, - WritableNativeMap *otherMap) { + ReadableNativeMap *otherMap) { if (!otherMap) { putNull(std::move(key)); return; diff --git a/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.h b/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.h index c5c5057f2152..093759658cb4 100644 --- a/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.h +++ b/ReactAndroid/src/main/jni/react/jni/WritableNativeMap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,8 +11,8 @@ #include #include +#include "ReadableNativeArray.h" #include "ReadableNativeMap.h" -#include "WritableNativeArray.h" namespace facebook { namespace react { @@ -37,8 +37,8 @@ struct WritableNativeMap void putDouble(std::string key, double val); void putInt(std::string key, int val); void putString(std::string key, jni::alias_ref val); - void putNativeArray(std::string key, WritableNativeArray *val); - void putNativeMap(std::string key, WritableNativeMap *val); + void putNativeArray(std::string key, ReadableNativeArray *val); + void putNativeMap(std::string key, ReadableNativeMap *val); void mergeNativeMap(ReadableNativeMap *other); static void registerNatives(); diff --git a/ReactAndroid/src/main/jni/react/perftests/OnLoad.cpp b/ReactAndroid/src/main/jni/react/perftests/OnLoad.cpp index 8e0f5be466ae..06b828439d2b 100644 --- a/ReactAndroid/src/main/jni/react/perftests/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/react/perftests/OnLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/main/jni/third-party/boost/Android.mk b/ReactAndroid/src/main/jni/third-party/boost/Android.mk index 6092d28c5d93..d7810a2837a5 100644 --- a/ReactAndroid/src/main/jni/third-party/boost/Android.mk +++ b/ReactAndroid/src/main/jni/third-party/boost/Android.mk @@ -5,6 +5,7 @@ include $(CLEAR_VARS) # because the react native version does not include anything outside of headers. # They are required for Folly futures to compile successfully. LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/asm/$(TARGET_ARCH)/*.S) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/boost_1_63_0 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/boost_1_63_0 diff --git a/ReactAndroid/src/main/libraries/soloader/java/com/facebook/soloader/BUCK b/ReactAndroid/src/main/libraries/soloader/java/com/facebook/soloader/BUCK index 61fc9b193d3c..d12db6807ad7 100644 --- a/ReactAndroid/src/main/libraries/soloader/java/com/facebook/soloader/BUCK +++ b/ReactAndroid/src/main/libraries/soloader/java/com/facebook/soloader/BUCK @@ -28,17 +28,17 @@ fb_native.android_prebuilt_aar( fb_native.remote_file( name = "annotation-binary.jar", sha1 = "dc58463712cb3e5f03d8ee5ac9743b9ced9afa77", - url = "mvn:com.facebook.soloader:annotation:jar:0.10.1", + url = "mvn:com.facebook.soloader:annotation:jar:0.10.3", ) fb_native.remote_file( name = "nativeloader-binary.jar", - sha1 = "ba1b31b4b9f65494a90de7c2728b57155344a858", - url = "mvn:com.facebook.soloader:nativeloader:jar:0.10.1", + sha1 = "171783d0f3f525fb9e18eb3af758c0b3aaeaed69", + url = "mvn:com.facebook.soloader:nativeloader:jar:0.10.3", ) fb_native.remote_file( name = "soloader-binary-aar", - sha1 = "78e5537c0cdf7c190f6cad9a2490f9f84ee8f041", - url = "mvn:com.facebook.soloader:soloader:aar:0.10.1", + sha1 = "7f5d7fb7dd272fd016e32c278e6950258ebb8e22", + url = "mvn:com.facebook.soloader:soloader:aar:0.10.3", ) diff --git a/ReactAndroid/src/main/res/views/uimanager/values/ids.xml b/ReactAndroid/src/main/res/views/uimanager/values/ids.xml index 6886defd4692..5c6c6d354d51 100644 --- a/ReactAndroid/src/main/res/views/uimanager/values/ids.xml +++ b/ReactAndroid/src/main/res/views/uimanager/values/ids.xml @@ -27,4 +27,15 @@ + + + + + + + + + + + diff --git a/ReactAndroid/src/main/third-party/java/assertj/BUCK b/ReactAndroid/src/main/third-party/java/assertj/BUCK new file mode 100644 index 000000000000..41dd6918984c --- /dev/null +++ b/ReactAndroid/src/main/third-party/java/assertj/BUCK @@ -0,0 +1,14 @@ +load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native") +load("//tools/build_defs/oss:rn_defs.bzl", "rn_prebuilt_jar") + +rn_prebuilt_jar( + name = "assertj-core", + binary_jar = ":assertj-core.jar", + visibility = ["//ReactAndroid/..."], +) + +fb_native.remote_file( + name = "assertj-core.jar", + sha1 = "27a14d6d22c4e3d58f799fb2a5ca8eaf53e6942a", + url = "mvn:org.assertj:assertj-core:jar:3.21.0", +) diff --git a/ReactAndroid/src/main/third-party/java/fest/BUCK b/ReactAndroid/src/main/third-party/java/fest/BUCK deleted file mode 100644 index 50285d715060..000000000000 --- a/ReactAndroid/src/main/third-party/java/fest/BUCK +++ /dev/null @@ -1,36 +0,0 @@ -load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native") -load("//tools/build_defs/oss:rn_defs.bzl", "rn_android_library", "rn_prebuilt_jar") - -rn_android_library( - name = "fest", - autoglob = False, - visibility = ["//ReactAndroid/..."], - exported_deps = [ - ":fest-core", - ":fest-util", - ], -) - -rn_prebuilt_jar( - name = "fest-core", - binary_jar = ":fest-binary.jar", - visibility = ["//ReactAndroid/..."], -) - -fb_native.remote_file( - name = "fest-binary.jar", - sha1 = "cb7c91cf614901928ae405f19d9bcdedf82781db", - url = "mvn:org.easytesting:fest-assert-core:jar:2.0M10", -) - -rn_prebuilt_jar( - name = "fest-util", - binary_jar = ":fest-util-binary.jar", - visibility = ["//ReactAndroid/..."], -) - -fb_native.remote_file( - name = "fest-util-binary.jar", - sha1 = "c4a8d7305b23b8d043be12c979813b096df11f44", - url = "mvn:org.easytesting:fest-util:jar:1.2.5", -) diff --git a/ReactAndroid/src/main/third-party/java/okhttp/BUCK b/ReactAndroid/src/main/third-party/java/okhttp/BUCK index 62813049874d..f9fb068058c3 100644 --- a/ReactAndroid/src/main/third-party/java/okhttp/BUCK +++ b/ReactAndroid/src/main/third-party/java/okhttp/BUCK @@ -30,8 +30,8 @@ rn_prebuilt_jar( fb_native.remote_file( name = "okhttp3-binary.jar", - sha1 = "51215279c3fe472c59b6b7dd7491e6ac2e28a81b", - url = "mvn:com.squareup.okhttp3:okhttp:jar:4.9.1", + sha1 = "5302714ee9320b64cf65ed865e5f65981ef9ba46", + url = "mvn:com.squareup.okhttp3:okhttp:jar:4.9.2", ) rn_prebuilt_jar( @@ -41,6 +41,6 @@ rn_prebuilt_jar( fb_native.remote_file( name = "okhttp3-urlconnection-binary.jar", - sha1 = "f45e809215bd0961350148cf5b78707865084e6f", - url = "mvn:com.squareup.okhttp3:okhttp-urlconnection:jar:4.9.1", + sha1 = "3b9e64d3d56370bc7488ed8b336d17a8013cb336", + url = "mvn:com.squareup.okhttp3:okhttp-urlconnection:jar:4.9.2", ) diff --git a/ReactAndroid/src/test/java/com/facebook/common/logging/FakeLoggingDelegate.java b/ReactAndroid/src/test/java/com/facebook/common/logging/FakeLoggingDelegate.java index 1508886d3850..abfc9546daf1 100644 --- a/ReactAndroid/src/test/java/com/facebook/common/logging/FakeLoggingDelegate.java +++ b/ReactAndroid/src/test/java/com/facebook/common/logging/FakeLoggingDelegate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/BUCK b/ReactAndroid/src/test/java/com/facebook/react/BUCK index 036fe8a98d8b..9e854d003507 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/BUCK @@ -11,7 +11,7 @@ rn_robolectric_test( react_native_dep("third-party/android/androidx:fragment"), react_native_dep("third-party/android/androidx:legacy-support-core-ui"), react_native_dep("third-party/android/androidx:legacy-support-core-utils"), - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/okhttp:okhttp3"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.java b/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.java index 266fda794d1d..e641e254e3f0 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/CompositeReactPackageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java b/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java index 6389c29d7179..f4a57fe1663d 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/RootViewTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/test/java/com/facebook/react/animated/BUCK b/ReactAndroid/src/test/java/com/facebook/react/animated/BUCK index c25e292d64b3..ab2f4e81c502 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/animated/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/animated/BUCK @@ -8,7 +8,7 @@ rn_robolectric_test( "PUBLIC", ], deps = [ - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_target("java/com/facebook/react:react"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.java b/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.java index c06e763a8ce3..4bf4cb3d332d 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedInterpolationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.animated; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.java b/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.java index 8c624bb62a71..4a77639eec14 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/animated/NativeAnimatedNodeTraversalTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.animated; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.eq; diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/BUCK b/ReactAndroid/src/test/java/com/facebook/react/bridge/BUCK index c89522bca2fc..78203f3ac890 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/BUCK @@ -33,7 +33,7 @@ rn_robolectric_test( deps = [ ":testhelpers", react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"), - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_target("java/com/facebook/react/bridge:bridge"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/BaseJavaModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/bridge/BaseJavaModuleTest.java index d5b89b246514..27537562e590 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/BaseJavaModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/BaseJavaModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/FallbackJSBundleLoaderTest.java b/ReactAndroid/src/test/java/com/facebook/react/bridge/FallbackJSBundleLoaderTest.java index 3778d3844c08..7c877bff8423 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/FallbackJSBundleLoaderTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/FallbackJSBundleLoaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ package com.facebook.react.bridge; -import static org.fest.assertions.api.Assertions.assertThat; -import static org.fest.assertions.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/InstanceHandleHelper.java b/ReactAndroid/src/test/java/com/facebook/react/bridge/InstanceHandleHelper.java index bfa603245b79..1b56926b2dc3 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/InstanceHandleHelper.java +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/InstanceHandleHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaOnlyArrayTest.java b/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaOnlyArrayTest.java index ce9fa5c35524..6421ae2a5985 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaOnlyArrayTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaOnlyArrayTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.bridge; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaScriptModuleRegistryTest.java b/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaScriptModuleRegistryTest.java index 47b8614c3091..79abb47f6ac9 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaScriptModuleRegistryTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/JavaScriptModuleRegistryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java b/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java index d3ab1b7fe70e..717b689a2b04 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java +++ b/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/devsupport/BUCK b/ReactAndroid/src/test/java/com/facebook/react/devsupport/BUCK index 6fd2c2c49f56..7a7b12e9cdea 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/devsupport/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/devsupport/BUCK @@ -8,7 +8,7 @@ rn_robolectric_test( "PUBLIC", ], deps = [ - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/okhttp:okhttp3"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java b/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java index 53a134033091..ba1511ee9ae6 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/devsupport/JSDebuggerWebSocketClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.java b/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.java index 03ab628fbe79..63612bc66d5f 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.devsupport; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.io.IOException; import java.util.Map; diff --git a/ReactAndroid/src/test/java/com/facebook/react/devsupport/StackTraceHelperTest.java b/ReactAndroid/src/test/java/com/facebook/react/devsupport/StackTraceHelperTest.java index b91f6bc3d89d..a0e260873363 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/devsupport/StackTraceHelperTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/devsupport/StackTraceHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.devsupport; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import com.facebook.react.devsupport.interfaces.StackFrame; import org.junit.Test; diff --git a/ReactAndroid/src/test/java/com/facebook/react/fabric/events/BUCK b/ReactAndroid/src/test/java/com/facebook/react/fabric/events/BUCK new file mode 100644 index 000000000000..f1cf0a0ff95f --- /dev/null +++ b/ReactAndroid/src/test/java/com/facebook/react/fabric/events/BUCK @@ -0,0 +1,16 @@ +load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_robolectric_test") + +rn_robolectric_test( + name = "events", + srcs = glob(["*.java"]), + contacts = ["oncall+react_native@xmail.facebook.com"], + deps = [ + react_native_dep("third-party/java/jsr-305:jsr-305"), + react_native_dep("third-party/java/junit:junit"), + react_native_target("java/com/facebook/react:react"), + react_native_target("java/com/facebook/react/bridge:bridge"), + react_native_target("java/com/facebook/react/common:common"), + react_native_target("java/com/facebook/react/touch:touch"), + react_native_target("java/com/facebook/react/fabric:fabric"), + ], +) diff --git a/ReactAndroid/src/test/java/com/facebook/react/fabric/events/TouchEventDispatchTest.java b/ReactAndroid/src/test/java/com/facebook/react/fabric/events/TouchEventDispatchTest.java new file mode 100644 index 000000000000..eb748ea20892 --- /dev/null +++ b/ReactAndroid/src/test/java/com/facebook/react/fabric/events/TouchEventDispatchTest.java @@ -0,0 +1,616 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.fabric.events; + +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.powermock.api.mockito.PowerMockito.doAnswer; +import static org.powermock.api.mockito.PowerMockito.mock; + +import android.util.DisplayMetrics; +import android.view.MotionEvent; +import android.view.MotionEvent.PointerCoords; +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.JavaOnlyArray; +import com.facebook.react.bridge.JavaOnlyMap; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.bridge.WritableMap; +import com.facebook.react.fabric.FabricUIManager; +import com.facebook.react.uimanager.DisplayMetricsHolder; +import com.facebook.react.uimanager.events.TouchEvent; +import com.facebook.react.uimanager.events.TouchEventCoalescingKeyHelper; +import com.facebook.react.uimanager.events.TouchEventType; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentMatchers; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PowerMockIgnore; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.core.classloader.annotations.SuppressStaticInitializationFor; +import org.powermock.modules.junit4.rule.PowerMockRule; +import org.robolectric.RobolectricTestRunner; + +@PrepareForTest({Arguments.class, FabricUIManager.class}) +@SuppressStaticInitializationFor("com.facebook.react.fabric.FabricUIManager") +@RunWith(RobolectricTestRunner.class) +@PowerMockIgnore({"org.mockito.*", "org.robolectric.*", "androidx.*", "android.*"}) +public class TouchEventDispatchTest { + + private static final int SURFACE_ID = 121; + private static final int TARGET_VIEW_ID = 42; + private static final int GESTURE_START_TIME = 1; + + @Rule public PowerMockRule rule = new PowerMockRule(); + + private final TouchEventCoalescingKeyHelper mTouchEventCoalescingKeyHelper = + new TouchEventCoalescingKeyHelper(); + + /** Events (1 pointer): START -> MOVE -> MOVE -> UP */ + private final TouchEvent[] mStartMoveEndSequence = + new TouchEvent[] { + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_DOWN, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_MOVE, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 2f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_MOVE, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 3f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_UP, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 3f)}) + }; + + /** Expected values for {@link #mStartMoveEndSequence} */ + private final List mStartMoveEndExpectedSequence = + listOf( + /* + * START event for touch 1: + * { + * touches: [touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 1f, + GESTURE_START_TIME, + 0, + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0))), + /* + * MOVE event for touch 1: + * { + * touches: [touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 2f, + GESTURE_START_TIME, + 0, + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0))), + /* + * MOVE event for touch 1: + * { + * touches: [touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 3f, + GESTURE_START_TIME, + 0, + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 3f, GESTURE_START_TIME, 0)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 3f, GESTURE_START_TIME, 0))), + /* + * END event for touch 1: + * { + * touches: [], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 3f, + GESTURE_START_TIME, + 0, + Collections.emptyList(), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 3f, GESTURE_START_TIME, 0)))); + + /** Events (2 pointer): START 1st -> START 2nd -> MOVE 1st -> UP 2st -> UP 1st */ + private final TouchEvent[] mStartPointerMoveUpSequence = + new TouchEvent[] { + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_DOWN, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_POINTER_DOWN, + 1, + new int[] {0, 1}, + new PointerCoords[] {pointerCoords(1f, 1f), pointerCoords(2f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_MOVE, + 0, + new int[] {0, 1}, + new PointerCoords[] {pointerCoords(1f, 2f), pointerCoords(2f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_POINTER_UP, + 1, + new int[] {0, 1}, + new PointerCoords[] {pointerCoords(1f, 2f), pointerCoords(2f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_POINTER_UP, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 2f)}) + }; + + /** Expected values for {@link #mStartPointerMoveUpSequence} */ + private final List mStartPointerMoveUpExpectedSequence = + listOf( + /* + * START event for touch 1: + * { + * touch: 0, + * touches: [touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 1f, + GESTURE_START_TIME, + 0, + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0))), + /* + * START event for touch 2: + * { + * touch: 1, + * touches: [touch0, touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 2f, + 1f, + GESTURE_START_TIME, + 1, + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + /* + * MOVE event for touch 1: + * { + * touch: 0, + * touches: [touch0, touch1], + * changed: [touch0, touch1] + * } + * { + * touch: 1, + * touches: [touch0, touch1], + * changed: [touch0, touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 2f, + GESTURE_START_TIME, + 0, + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)), + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 2f, + 1f, + GESTURE_START_TIME, + 1, + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)), + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + /* + * UP event pointer 1: + * { + * touch: 1, + * touches: [touch0], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 2f, + 1f, + GESTURE_START_TIME, + 1, + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + /* + * UP event pointer 0: + * { + * touch: 0, + * touches: [], + * changed: [touch0] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 2f, + GESTURE_START_TIME, + 0, + Collections.emptyList(), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0)))); + + /** Events (2 pointer): START 1st -> START 2nd -> MOVE 1st -> CANCEL */ + private final TouchEvent[] mStartMoveCancelSequence = + new TouchEvent[] { + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_DOWN, + 0, + new int[] {0}, + new PointerCoords[] {pointerCoords(1f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_POINTER_DOWN, + 1, + new int[] {0, 1}, + new PointerCoords[] {pointerCoords(1f, 1f), pointerCoords(2f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_MOVE, + 0, + new int[] {0, 1}, + new PointerCoords[] {pointerCoords(1f, 2f), pointerCoords(2f, 1f)}), + createTouchEvent( + GESTURE_START_TIME, + MotionEvent.ACTION_CANCEL, + 0, + new int[] {0, 1}, + new PointerCoords[] {pointerCoords(1f, 3f), pointerCoords(2f, 1f)}) + }; + + /** Expected values for {@link #mStartMoveCancelSequence} */ + private final List mStartMoveCancelExpectedSequence = + listOf( + /* + * START event for touch 1: + * { + * touch: 0, + * touches: [touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 1f, + GESTURE_START_TIME, + 0, + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0))), + /* + * START event for touch 2: + * { + * touch: 1, + * touches: [touch0, touch1], + * changed: [touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 2f, + 1f, + GESTURE_START_TIME, + 1, + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 1f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)), + listOf(buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + /* + * MOVE event for touch 1: + * { + * touch: 0, + * touches: [touch0, touch1], + * changed: [touch0, touch1] + * } + * { + * touch: 1, + * touches: [touch0, touch1], + * changed: [touch0, touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 2f, + GESTURE_START_TIME, + 0, + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)), + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 2f, + 1f, + GESTURE_START_TIME, + 1, + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)), + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 2f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + /* + * CANCEL event: + * { + * touch: 0, + * touches: [], + * changed: [touch0, touch1] + * } + * { + * touch: 1, + * touches: [], + * changed: [touch0, touch1] + * } + */ + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 1f, + 3f, + GESTURE_START_TIME, + 0, + Collections.emptyList(), + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 3f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1))), + buildGestureEvent( + SURFACE_ID, + TARGET_VIEW_ID, + 2f, + 1f, + GESTURE_START_TIME, + 1, + Collections.emptyList(), + listOf( + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 1f, 3f, GESTURE_START_TIME, 0), + buildGesture(SURFACE_ID, TARGET_VIEW_ID, 2f, 1f, GESTURE_START_TIME, 1)))); + + List mDispatchedEvents; + FabricEventEmitter mEventEmitter; + + @Before + public void setUp() { + PowerMockito.mockStatic(Arguments.class); + PowerMockito.mockStatic(FabricUIManager.class); + PowerMockito.when(Arguments.createArray()) + .thenAnswer( + new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + return new JavaOnlyArray(); + } + }); + PowerMockito.when(Arguments.createMap()) + .thenAnswer( + new Answer() { + @Override + public Object answer(InvocationOnMock invocation) { + return new JavaOnlyMap(); + } + }); + + DisplayMetrics metrics = new DisplayMetrics(); + metrics.xdpi = 1f; + metrics.ydpi = 1f; + metrics.density = 1f; + DisplayMetricsHolder.setWindowDisplayMetrics(metrics); + + FabricUIManager fabricUIManager = mock(FabricUIManager.class); + mDispatchedEvents = new ArrayList<>(); + doAnswer( + new Answer() { + @Override + public Void answer(InvocationOnMock invocation) { + mDispatchedEvents.add(invocation.getArgument(5)); + return null; + } + }) + .when(fabricUIManager) + .receiveEvent( + anyInt(), + anyInt(), + anyString(), + anyBoolean(), + anyInt(), + ArgumentMatchers.any(), + anyInt()); + mEventEmitter = new FabricEventEmitter(fabricUIManager); + } + + @Test + public void testFabric_startMoveEnd() { + for (TouchEvent event : mStartMoveEndSequence) { + event.dispatchModern(mEventEmitter); + } + + assertEquals(mStartMoveEndExpectedSequence, mDispatchedEvents); + } + + @Test + public void testFabric_startMoveCancel() { + for (TouchEvent event : mStartMoveCancelSequence) { + event.dispatchModern(mEventEmitter); + } + + assertEquals(mStartMoveCancelExpectedSequence, mDispatchedEvents); + } + + @Test + public void testFabric_startPointerUpCancel() { + for (TouchEvent event : mStartPointerMoveUpSequence) { + event.dispatchModern(mEventEmitter); + } + + assertEquals(mStartPointerMoveUpExpectedSequence, mDispatchedEvents); + } + + private TouchEvent createTouchEvent( + int gestureTime, int action, int pointerId, int[] pointerIds, PointerCoords[] pointerCoords) { + mTouchEventCoalescingKeyHelper.addCoalescingKey(gestureTime); + action |= pointerId << MotionEvent.ACTION_POINTER_INDEX_SHIFT; + return TouchEvent.obtain( + SURFACE_ID, + TARGET_VIEW_ID, + getType(action), + MotionEvent.obtain( + gestureTime, + gestureTime, + action, + pointerIds.length, + pointerIds, + pointerCoords, + 0, + 0f, + 0f, + 0, + 0, + 0, + 0), + gestureTime, + pointerCoords[0].x, + pointerCoords[0].y, + mTouchEventCoalescingKeyHelper); + } + + private static TouchEventType getType(int action) { + action &= ~MotionEvent.ACTION_POINTER_INDEX_MASK; + switch (action) { + case MotionEvent.ACTION_DOWN: + case MotionEvent.ACTION_POINTER_DOWN: + return TouchEventType.START; + case MotionEvent.ACTION_UP: + case MotionEvent.ACTION_POINTER_UP: + return TouchEventType.END; + case MotionEvent.ACTION_MOVE: + return TouchEventType.MOVE; + case MotionEvent.ACTION_CANCEL: + return TouchEventType.CANCEL; + } + + return TouchEventType.START; + } + + private static ReadableMap buildGestureEvent( + int surfaceId, + int viewTag, + float locationX, + float locationY, + int time, + int pointerId, + List touches, + List changedTouches) { + WritableMap gesture = buildGesture(surfaceId, viewTag, locationX, locationY, time, pointerId); + gesture.putArray("changedTouches", JavaOnlyArray.from(changedTouches)); + gesture.putArray("touches", JavaOnlyArray.from(touches)); + return gesture; + } + + private static WritableMap buildGesture( + int surfaceId, int viewTag, float locationX, float locationY, int time, int pointerId) { + WritableMap map = new JavaOnlyMap(); + map.putInt("targetSurface", surfaceId); + map.putInt("target", viewTag); + map.putDouble("locationX", locationX); + map.putDouble("locationY", locationY); + map.putDouble("pageX", locationX); + map.putDouble("pageY", locationY); + map.putDouble("identifier", pointerId); + map.putDouble("timestamp", time); + return map; + } + + @SafeVarargs + private static List listOf(E... args) { + return Arrays.asList(args); + } + + private static PointerCoords pointerCoords(float x, float y) { + PointerCoords pointerCoords = new PointerCoords(); + pointerCoords.x = x; + pointerCoords.y = y; + return pointerCoords; + } +} diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK b/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK index f50c34f262d1..4401dd0570d9 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/BUCK @@ -14,7 +14,7 @@ rn_robolectric_test( react_native_dep("third-party/android/androidx:fragment"), react_native_dep("third-party/android/androidx:legacy-support-core-ui"), react_native_dep("third-party/android/androidx:legacy-support-core-utils"), - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/okhttp:okhttp3"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.java index 9eff51186515..39606f804c94 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/blob/BlobModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/camera/ImageStoreManagerTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/camera/ImageStoreManagerTest.java index 605b34c487a5..63540fc74528 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/camera/ImageStoreManagerTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/camera/ImageStoreManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/clipboard/ClipboardModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/clipboard/ClipboardModuleTest.java index 21ab31a27b83..4f5e3223f0b3 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/clipboard/ClipboardModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/clipboard/ClipboardModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java index 6ed814abb534..1d9644db98d5 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.modules.deviceinfo; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/dialog/DialogModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/dialog/DialogModuleTest.java index 6f12eee70cec..2bde2d61bc4f 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/dialog/DialogModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/dialog/DialogModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/network/HeaderUtilTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/network/HeaderUtilTest.java index b2a7b1974b6f..35c17cfbc21e 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/network/HeaderUtilTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/network/HeaderUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.java index eb09e6dee01f..1e353f8f23e8 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/network/NetworkingModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.modules.network; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.any; import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/network/ProgressiveStringDecoderTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/network/ProgressiveStringDecoderTest.java index cdd897e4a6fa..a714df574b63 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/network/ProgressiveStringDecoderTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/network/ProgressiveStringDecoderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/network/ReactCookieJarContainerTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/network/ReactCookieJarContainerTest.java index ef21b78fe940..3acb9a0af8dc 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/network/ReactCookieJarContainerTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/network/ReactCookieJarContainerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.modules.network; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.java index 2260bc47dde6..2ca9110d5a4c 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/share/ShareModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/storage/AsyncStorageModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/storage/AsyncStorageModuleTest.java index bc5d9bc33264..d4b2ee2c4c45 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/storage/AsyncStorageModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/storage/AsyncStorageModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.modules.storage; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import com.facebook.react.bridge.Arguments; diff --git a/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java index 7164b8489af4..79b45b2faaeb 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/modules/timing/TimingModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.modules.timing; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.*; import com.facebook.react.bridge.Arguments; diff --git a/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/BUCK b/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/BUCK index 18d466c38e3c..571abc580185 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/BUCK @@ -8,7 +8,7 @@ rn_robolectric_test( "PUBLIC", ], deps = [ - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/okhttp:okhttp3"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.java b/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.java index 2d843d13abeb..3ba3bb27a02f 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/packagerconnection/JSPackagerClientTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/BUCK b/ReactAndroid/src/test/java/com/facebook/react/uimanager/BUCK index 21a1e32104a6..29b05e0ff75b 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/BUCK @@ -21,7 +21,7 @@ rn_robolectric_test( react_native_dep("third-party/android/androidx:fragment"), react_native_dep("third-party/android/androidx:legacy-support-core-ui"), react_native_dep("third-party/android/androidx:legacy-support-core-utils"), - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/okhttp:okhttp3"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerTest.java index 28208b8f8aae..b922a06cd239 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/BaseViewManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import com.facebook.react.R; import com.facebook.react.bridge.Arguments; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/LayoutPropertyApplicatorTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/LayoutPropertyApplicatorTest.java index aad83907a1cb..d089f565fbc3 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/LayoutPropertyApplicatorTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/LayoutPropertyApplicatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/MatrixMathHelperTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/MatrixMathHelperTest.java index 047e6541db3d..319586c3c34a 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/MatrixMathHelperTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/MatrixMathHelperTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.java index 5dba53965794..7c088e9bb931 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterSpecTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterTest.java index 44834866d288..9739dcb69759 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropAnnotationSetterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.fail; +import static org.assertj.core.api.Assertions.fail; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.verify; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.java index 97e074481ec6..62e9497380ff 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropConstantsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.assertThat; -import static org.fest.assertions.api.Assertions.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import android.view.View; import com.facebook.react.bridge.ReactApplicationContext; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSetterTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSetterTest.java index 6a59d00cff89..8dd914535a12 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSetterTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSetterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.java index 0153ed615987..545b891a2ddf 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/ReactPropForShadowNodeSpecTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/SimpleViewPropertyTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/SimpleViewPropertyTest.java index 91be74945d9c..e031f7c80014 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/SimpleViewPropertyTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/SimpleViewPropertyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.assertThat; -import static org.fest.assertions.api.Assertions.offset; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.offset; import android.graphics.drawable.ColorDrawable; import android.view.View; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.java index 48f287850d5d..4a8ce0c8dd4a 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleConstantsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -16,7 +16,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; -import org.fest.assertions.data.MapEntry; +import org.assertj.core.data.MapEntry; import org.junit.Before; import org.junit.Rule; import org.junit.Test; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleTest.java index 745f6dc905db..2a7881975911 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/UIManagerModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.uimanager; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK index 3124e8db3469..e1c7089f44ba 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/BUCK @@ -9,7 +9,7 @@ rn_robolectric_test( ], deps = [ YOGA_TARGET, - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/junit:junit"), react_native_target("java/com/facebook/react/uimanager:uimanager"), ], diff --git a/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java index 57587beb36ef..0bb667110156 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/uimanager/layoutanimation/InterpolatorTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.uimanager.layoutanimation; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Locale; import org.junit.Test; diff --git a/ReactAndroid/src/test/java/com/facebook/react/util/BUCK b/ReactAndroid/src/test/java/com/facebook/react/util/BUCK index 039b88cc4e8d..de6374007d14 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/util/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/util/BUCK @@ -8,7 +8,7 @@ rn_robolectric_test( "PUBLIC", ], deps = [ - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_target("java/com/facebook/react/util:util"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.java b/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.java index 5c4b73243f84..d2657ad80d41 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/util/JSStackTraceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/BUCK b/ReactAndroid/src/test/java/com/facebook/react/views/BUCK index 318274a05f08..29dc6d734de0 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/BUCK +++ b/ReactAndroid/src/test/java/com/facebook/react/views/BUCK @@ -17,7 +17,7 @@ rn_robolectric_test( react_native_dep("third-party/android/androidx:fragment"), react_native_dep("third-party/android/androidx:legacy-support-core-ui"), react_native_dep("third-party/android/androidx:legacy-support-core-utils"), - react_native_dep("third-party/java/fest:fest"), + react_native_dep("third-party/java/assertj:assertj-core"), react_native_dep("third-party/java/jsr-305:jsr-305"), react_native_dep("third-party/java/junit:junit"), react_native_dep("third-party/java/okhttp:okhttp3"), diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/image/ImageResizeModeTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/image/ImageResizeModeTest.java index 870be9df2172..21ce26fb140b 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/image/ImageResizeModeTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/image/ImageResizeModeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.views.image; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import com.facebook.drawee.drawable.ScalingUtils; import org.junit.Rule; diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/image/ReactImagePropertyTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/image/ReactImagePropertyTest.java index e172c90a3c79..99788ecb6d79 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/image/ReactImagePropertyTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/image/ReactImagePropertyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/slider/ReactSliderPropertyTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/slider/ReactSliderPropertyTest.java index 7320dc7f25d7..71453966cb46 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/slider/ReactSliderPropertyTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/slider/ReactSliderPropertyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.views.slider; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import android.widget.SeekBar; import com.facebook.react.bridge.CatalystInstance; diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.java index ad79e3bcf140..1bb4ee2c4f4e 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/text/CustomLineHeightSpanTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.views.text; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import android.graphics.Paint; import org.junit.Test; diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/text/ReactTextTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/text/ReactTextTest.java index 2af226ff6389..5c6790bcfb4b 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/text/ReactTextTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/text/ReactTextTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.views.text; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java index b908654deb6d..a817b810d416 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/textinput/ReactTextInputPropertyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.views.textinput; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import android.content.res.ColorStateList; import android.graphics.Color; diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/textinput/TextInputTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/textinput/TextInputTest.java index 1db56837f951..b029e5160f0b 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/textinput/TextInputTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/textinput/TextInputTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.views.textinput; -import static org.fest.assertions.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; diff --git a/ReactAndroid/src/test/java/com/facebook/react/views/view/ColorUtilTest.java b/ReactAndroid/src/test/java/com/facebook/react/views/view/ColorUtilTest.java index 92a5212d5d20..5bb2bd71e05f 100644 --- a/ReactAndroid/src/test/java/com/facebook/react/views/view/ColorUtilTest.java +++ b/ReactAndroid/src/test/java/com/facebook/react/views/view/ColorUtilTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/java/org/mockito/configuration/MockitoConfiguration.java b/ReactAndroid/src/test/java/org/mockito/configuration/MockitoConfiguration.java index 152fb90f5096..ab68d427ceb0 100644 --- a/ReactAndroid/src/test/java/org/mockito/configuration/MockitoConfiguration.java +++ b/ReactAndroid/src/test/java/org/mockito/configuration/MockitoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactAndroid/src/test/resources/BUCK b/ReactAndroid/src/test/resources/BUCK index af94e7bada4f..4d2bf53b205a 100644 --- a/ReactAndroid/src/test/resources/BUCK +++ b/ReactAndroid/src/test/resources/BUCK @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/React-Fabric.podspec b/ReactCommon/React-Fabric.podspec index 742040c57d40..096254395cc8 100644 --- a/ReactCommon/React-Fabric.podspec +++ b/ReactCommon/React-Fabric.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -61,12 +61,12 @@ Pod::Spec.new do |s| ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } end - s.subspec "better" do |ss| + s.subspec "butter" do |ss| ss.dependency folly_dep_name, folly_version ss.compiler_flags = folly_compiler_flags - ss.source_files = "better/**/*.{m,mm,cpp,h}" - ss.exclude_files = "better/tests" - ss.header_dir = "better" + ss.source_files = "butter/**/*.{m,mm,cpp,h}" + ss.exclude_files = "butter/tests" + ss.header_dir = "butter" ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } end @@ -147,15 +147,6 @@ Pod::Spec.new do |s| sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } end - ss.subspec "rncore" do |sss| - sss.dependency folly_dep_name, folly_version - sss.compiler_flags = folly_compiler_flags - sss.source_files = "react/renderer/components/rncore/**/*.{m,mm,cpp,h}" - sss.exclude_files = "react/renderer/components/rncore/tests" - sss.header_dir = "react/renderer/components/rncore" - sss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } - end - ss.subspec "root" do |sss| sss.dependency folly_dep_name, folly_version sss.compiler_flags = folly_compiler_flags @@ -342,11 +333,4 @@ Pod::Spec.new do |s| ss.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/RCT-Folly\"" } end - use_react_native_codegen!(s, { - :react_native_path => react_native_path, - :js_srcs_dir => "#{react_native_path}/Libraries", - :library_name => "rncore", - :library_type => "components", - :output_dir => "#{react_native_path}/ReactCommon", - }) end diff --git a/ReactCommon/React-rncore.podspec b/ReactCommon/React-rncore.podspec new file mode 100644 index 000000000000..73c6f713a9db --- /dev/null +++ b/ReactCommon/React-rncore.podspec @@ -0,0 +1,41 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "..", "package.json"))) +version = package['version'] + +source = { :git => 'https://github.com/facebook/react-native.git' } +if version == '1000.0.0' + # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. + source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") +else + source[:tag] = "v#{version}" +end + +react_native_path = ".." + +Pod::Spec.new do |s| + s.name = "React-rncore" + s.version = version + s.summary = "Fabric for React Native." + s.homepage = "https://reactnative.dev/" + s.license = package["license"] + s.author = "Facebook, Inc. and its affiliates" + s.platforms = { :ios => "11.0" } + s.source = source + s.source_files = "dummyFile.cpp" + s.pod_target_xcconfig = { "USE_HEADERMAP" => "YES", + "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" } + + + use_react_native_codegen!(s, { + :react_native_path => react_native_path, + :js_srcs_dir => "#{react_native_path}/Libraries", + :library_name => "rncore", + :library_type => "components", + }) +end diff --git a/ReactCommon/ReactCommon.podspec b/ReactCommon/ReactCommon.podspec index a9176cbb5b80..7df9578b7f0a 100644 --- a/ReactCommon/ReactCommon.podspec +++ b/ReactCommon/ReactCommon.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/better/.clang-tidy b/ReactCommon/butter/.clang-tidy similarity index 61% rename from ReactCommon/better/.clang-tidy rename to ReactCommon/butter/.clang-tidy index c98fd78ff64b..8edbbc799e94 100644 --- a/ReactCommon/better/.clang-tidy +++ b/ReactCommon/butter/.clang-tidy @@ -1,4 +1,5 @@ --- +InheritParentConfig: true Checks: '> clang-diagnostic-*, ' diff --git a/ReactCommon/better/Android.mk b/ReactCommon/butter/Android.mk similarity index 75% rename from ReactCommon/better/Android.mk rename to ReactCommon/butter/Android.mk index fed79b0fbbc1..fc8d3b38d1cc 100644 --- a/ReactCommon/better/Android.mk +++ b/ReactCommon/butter/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -7,15 +7,16 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := better +LOCAL_MODULE := butter LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_CFLAGS := \ - -DLOG_TAG=\"Better\" + -DLOG_TAG=\"Butter\" LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall diff --git a/ReactCommon/better/BUCK b/ReactCommon/butter/BUCK similarity index 96% rename from ReactCommon/better/BUCK rename to ReactCommon/butter/BUCK index c287ec796522..fa584cee8ebc 100644 --- a/ReactCommon/better/BUCK +++ b/ReactCommon/butter/BUCK @@ -13,7 +13,7 @@ load( APPLE_COMPILER_FLAGS = get_apple_compiler_flags() rn_xplat_cxx_library( - name = "better", + name = "butter", srcs = glob( ["**/*.cpp"], exclude = glob(["tests/**/*.cpp"]), @@ -27,7 +27,7 @@ rn_xplat_cxx_library( [ ("", "*.h"), ], - prefix = "better", + prefix = "butter", ), fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), diff --git a/ReactCommon/better/better.h b/ReactCommon/butter/butter.h similarity index 65% rename from ReactCommon/better/better.h rename to ReactCommon/butter/butter.h index 0d300bd1ec1f..69cfb534f22b 100644 --- a/ReactCommon/better/better.h +++ b/ReactCommon/butter/butter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,28 +8,37 @@ #pragma once namespace facebook { -namespace better { +namespace butter { /* - * `Better` is a trivial collection of basic tools borrowed from other low-level + * `Butter` is a minimal collection of basic tools borrowed from other low-level * general purpose libraries (like Folly, Abseil or Boost). The main goals of - * Better: + * Butter: * - Make the codebase more portable; * - Make the dependency list explicit (by decoupling it as a dependency list of - * Better); + * Butter); * - Make relying on modern C++ patterns and tools in code simple and easy. * - Make executing experiments with different dependencies easier. + * - Limit reliance on third-party libraries eventually. * - * What should be part of Better and what should not? Should I add some piece of - * functionality in the Better? Here is a quick checklist. + * Target C++ Version + * ------------------ + * Currently, Butter targets C++17. + * + * The Scope + * --------- + * What should be part of Butter and what should not? Should I add some piece of + * functionality in the Butter? Here is a quick checklist. + * + * As of now, Butter is relatively permissive per the guidance below: * * If one of the following is true, yes, go for it: * - If some feature is already in some future C++ standard (possibly in draft * stage) and it's already implemented in some 3rd party library. * - If some standardized feature of C++ is implemented in the standard not in - * the most efficient way (because the standard enforces some tricky constraints - * (like always-valid iterators) which nobody uses and should use), but you have - * a library that does it right providing exact same interface. + * the most efficient way (because the standard enforces some tricky + * constraints, like always-valid iterators, which nobody uses and should use), + * but you have a library that does it right providing exact same interface. * * If one of the following is true, please do *NOT* do it (at least as part of * the library): @@ -41,6 +50,11 @@ namespace better { * faster than the standard one, so You want to use that in the code base. That * container does not have compatible API though (because it's a clear trade-off * with efficiency, of course). + * + * Note that eventually Butter will restrict the API collection to reduce + * reliance on non-standard C++ builtin libraries. That way, the API footprint + * stays small and is limited to just the essential APIs. This restriction is + * currently a work in progress. */ /* @@ -55,8 +69,8 @@ namespace better { * introspections mechanisms. */ #ifndef DEBUG -#define BETTER_USE_FOLLY_CONTAINERS +#define BUTTER_USE_FOLLY_CONTAINERS #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/map.h b/ReactCommon/butter/map.h similarity index 67% rename from ReactCommon/better/map.h rename to ReactCommon/butter/map.h index 9fe72bd5e897..09e87ae3a5ce 100644 --- a/ReactCommon/better/map.h +++ b/ReactCommon/butter/map.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,9 +7,9 @@ #pragma once -#include +#include -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS #include @@ -20,16 +20,16 @@ #endif namespace facebook { -namespace better { +namespace butter { /* - * Note: In Better, `map` aliases to `unorderd_map` because everyone agrees that + * Note: In Butter, `map` aliases to `unorderd_map` because everyone agrees that * an *ordered* map is nonsense and was a huge mistake for standardization. If * you need an *ordered* map, feel free to introduce that as - * `better::ordered_map`. + * `butter::ordered_map`. */ -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS template using map = folly::F14FastMap; @@ -41,5 +41,5 @@ using map = std::unordered_map; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/mutex.h b/ReactCommon/butter/mutex.h similarity index 76% rename from ReactCommon/better/mutex.h rename to ReactCommon/butter/mutex.h index e8451f818b71..9071356eba16 100644 --- a/ReactCommon/better/mutex.h +++ b/ReactCommon/butter/mutex.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,9 +12,9 @@ #include namespace facebook { -namespace better { +namespace butter { using shared_mutex = folly::SharedMutex; -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/optional.h b/ReactCommon/butter/optional.h similarity index 62% rename from ReactCommon/better/optional.h rename to ReactCommon/butter/optional.h index f788d487822c..e887918f19df 100644 --- a/ReactCommon/better/optional.h +++ b/ReactCommon/butter/optional.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,9 +7,9 @@ #pragma once -#include +#include -#if defined(BETTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L +#if defined(BUTTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L #include @@ -20,9 +20,9 @@ #endif namespace facebook { -namespace better { +namespace butter { -#if defined(BETTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L +#if defined(BUTTER_USE_FOLLY_CONTAINERS) || __cplusplus < 202000L template using optional = folly::Optional; @@ -34,5 +34,5 @@ using optional = std::optional; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/set.h b/ReactCommon/butter/set.h similarity index 68% rename from ReactCommon/better/set.h rename to ReactCommon/butter/set.h index 2e41ce91eb0a..254bf88e47c3 100644 --- a/ReactCommon/better/set.h +++ b/ReactCommon/butter/set.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,9 +7,9 @@ #pragma once -#include +#include -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS #include @@ -20,9 +20,9 @@ #endif namespace facebook { -namespace better { +namespace butter { -#ifdef BETTER_USE_FOLLY_CONTAINERS +#ifdef BUTTER_USE_FOLLY_CONTAINERS template using set = folly::F14FastSet; @@ -34,5 +34,5 @@ using set = std::unordered_set; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/better/small_vector.h b/ReactCommon/butter/small_vector.h similarity index 69% rename from ReactCommon/better/small_vector.h rename to ReactCommon/butter/small_vector.h index 54af50472b10..002ec65f9644 100644 --- a/ReactCommon/better/small_vector.h +++ b/ReactCommon/butter/small_vector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,10 +7,10 @@ #pragma once -#include +#include // `folly::small_vector` is broken on some versions of Android. -#if defined(BETTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) +#if defined(BUTTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) #include @@ -21,9 +21,9 @@ #endif namespace facebook { -namespace better { +namespace butter { -#if defined(BETTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) +#if defined(BUTTER_USE_FOLLY_CONTAINERS) && !defined(ANDROID) template using small_vector = folly::small_vector; @@ -35,5 +35,5 @@ using small_vector = std::vector; #endif -} // namespace better +} // namespace butter } // namespace facebook diff --git a/ReactCommon/callinvoker/Android.mk b/ReactCommon/callinvoker/Android.mk index 3cef3d750c87..0d6b90955f41 100644 --- a/ReactCommon/callinvoker/Android.mk +++ b/ReactCommon/callinvoker/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/callinvoker/React-callinvoker.podspec b/ReactCommon/callinvoker/React-callinvoker.podspec index b05fad87c432..f6076050d9cc 100644 --- a/ReactCommon/callinvoker/React-callinvoker.podspec +++ b/ReactCommon/callinvoker/React-callinvoker.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/callinvoker/ReactCommon/CallInvoker.h b/ReactCommon/callinvoker/ReactCommon/CallInvoker.h index 37bb2037ecda..ccca8b97d154 100644 --- a/ReactCommon/callinvoker/ReactCommon/CallInvoker.h +++ b/ReactCommon/callinvoker/ReactCommon/CallInvoker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/common.mk b/ReactCommon/common.mk index a7b873a689d7..d752edce3e8e 100644 --- a/ReactCommon/common.mk +++ b/ReactCommon/common.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/Android.mk b/ReactCommon/cxxreact/Android.mk index 392c33b730a4..ef7343e28344 100644 --- a/ReactCommon/cxxreact/Android.mk +++ b/ReactCommon/cxxreact/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := reactnative LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) @@ -19,8 +20,18 @@ LOCAL_CFLAGS := \ LOCAL_CFLAGS += -fexceptions -frtti -Wno-unused-lambda-capture -LOCAL_STATIC_LIBRARIES := boost jsi callinvoker reactperflogger runtimeexecutor -LOCAL_SHARED_LIBRARIES := jsinspector libfolly_json glog logger +LOCAL_STATIC_LIBRARIES := \ + boost \ + callinvoker \ + jsi \ + reactperflogger + +LOCAL_SHARED_LIBRARIES := \ + glog \ + jsinspector \ + libfolly_json \ + libruntimeexecutor \ + logger include $(BUILD_STATIC_LIBRARY) diff --git a/ReactCommon/cxxreact/CxxModule.h b/ReactCommon/cxxreact/CxxModule.h index 64b7db642595..a5a89f79423a 100644 --- a/ReactCommon/cxxreact/CxxModule.h +++ b/ReactCommon/cxxreact/CxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/CxxNativeModule.cpp b/ReactCommon/cxxreact/CxxNativeModule.cpp index 0bcf13657eed..fbfdaa0aeb41 100644 --- a/ReactCommon/cxxreact/CxxNativeModule.cpp +++ b/ReactCommon/cxxreact/CxxNativeModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -244,8 +244,8 @@ void CxxNativeModule::lazyInit() { module_ = provider_(); provider_ = nullptr; if (module_) { - methods_ = module_->getMethods(); module_->setInstance(instance_); + methods_ = module_->getMethods(); } } diff --git a/ReactCommon/cxxreact/CxxNativeModule.h b/ReactCommon/cxxreact/CxxNativeModule.h index a10f0ec5cb0a..e9902132000e 100644 --- a/ReactCommon/cxxreact/CxxNativeModule.h +++ b/ReactCommon/cxxreact/CxxNativeModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/ErrorUtils.h b/ReactCommon/cxxreact/ErrorUtils.h index 3ab715b2efb0..d9e42f7d221f 100644 --- a/ReactCommon/cxxreact/ErrorUtils.h +++ b/ReactCommon/cxxreact/ErrorUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/Instance.cpp b/ReactCommon/cxxreact/Instance.cpp index f1150821a965..a48d5930ecfe 100644 --- a/ReactCommon/cxxreact/Instance.cpp +++ b/ReactCommon/cxxreact/Instance.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/Instance.h b/ReactCommon/cxxreact/Instance.h index 7cd11f9bdf50..8b2263679a05 100644 --- a/ReactCommon/cxxreact/Instance.h +++ b/ReactCommon/cxxreact/Instance.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSBigString.cpp b/ReactCommon/cxxreact/JSBigString.cpp index 77e22800fd8e..59e117c0818e 100644 --- a/ReactCommon/cxxreact/JSBigString.cpp +++ b/ReactCommon/cxxreact/JSBigString.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -50,65 +50,6 @@ JSBigFileString::~JSBigFileString() { close(m_fd); } -#ifdef WITH_FBREMAP -// Read and advance the pointer. -static uint16_t read16(char *&data) { - uint16_t result; - ::memcpy(&result, data, sizeof(result)); - data += sizeof(result); - return result; -} - -// If the given file has a remapping table header, remap its pages accordingly -// and return the byte offset from the beginning to the unwrapped payload. -static off_t maybeRemap(char *data, size_t size, int fd) { - // A remapped file's size must be a multiple of its page size, so quickly - // filter out files with incorrect size, without touching any pages. - static const size_t kMinPageSize = 4096; - if (size < kMinPageSize || size % kMinPageSize != 0) { - return 0; - } - const auto begin = data; - static const uint8_t kRemapMagic[] = { - 0xc6, 0x1f, 0xbc, 0x03, 0xc1, 0x03, 0x19, 0x1f, 0xa1, 0xd0, 0xeb, 0x73}; - if (::memcmp(data, kRemapMagic, sizeof(kRemapMagic)) != 0) { - return 0; - } - data += sizeof(kRemapMagic); - const size_t filePS = static_cast(1) << read16(data); - if (size & (filePS - 1)) { - return 0; - } - { - // System page size must be at least as granular as the remapping. - // TODO: Consider fallback that reads entire file into memory. - const size_t systemPS = sysconf(_SC_PAGESIZE); - CHECK(filePS >= systemPS) - << "filePS: " << filePS << "systemPS: " << systemPS; - } - const off_t headerPages = read16(data); - uint16_t numMappings = read16(data); - size_t curFilePage = headerPages; - while (numMappings--) { - auto memPage = read16(data) + headerPages; - auto numPages = read16(data); - if (mmap( - begin + memPage * filePS, - numPages * filePS, - PROT_READ, - MAP_FILE | MAP_PRIVATE | MAP_FIXED, - fd, - curFilePage * filePS) == MAP_FAILED) { - CHECK(false) << " memPage: " << memPage << " numPages: " << numPages - << " curFilePage: " << curFilePage << " size: " << size - << " error: " << std::strerror(errno); - } - curFilePage += numPages; - } - return headerPages * filePS; -} -#endif // WITH_FBREMAP - const char *JSBigFileString::c_str() const { if (m_size == 0) { return ""; @@ -119,12 +60,6 @@ const char *JSBigFileString::c_str() const { CHECK(m_data != MAP_FAILED) << " fd: " << m_fd << " size: " << m_size << " offset: " << m_mapOff << " error: " << std::strerror(errno); -#ifdef WITH_FBREMAP - // Remapping is only attempted when the entire file was requested. - if (m_mapOff == 0 && m_pageOff == 0) { - m_pageOff = maybeRemap(const_cast(m_data), m_size, m_fd); - } -#endif // WITH_FBREMAP } static const size_t kMinPageSize = 4096; CHECK(!(reinterpret_cast(m_data) & (kMinPageSize - 1))) diff --git a/ReactCommon/cxxreact/JSBigString.h b/ReactCommon/cxxreact/JSBigString.h index c4996c47cffb..14ce3464c4d6 100644 --- a/ReactCommon/cxxreact/JSBigString.h +++ b/ReactCommon/cxxreact/JSBigString.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSBundleType.cpp b/ReactCommon/cxxreact/JSBundleType.cpp index f76610d461a9..8a7c38af9c22 100644 --- a/ReactCommon/cxxreact/JSBundleType.cpp +++ b/ReactCommon/cxxreact/JSBundleType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSBundleType.h b/ReactCommon/cxxreact/JSBundleType.h index be39711dd8d6..f6c0d7a3fbb2 100644 --- a/ReactCommon/cxxreact/JSBundleType.h +++ b/ReactCommon/cxxreact/JSBundleType.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSExecutor.cpp b/ReactCommon/cxxreact/JSExecutor.cpp index f303ef161b86..471d54ca5ecf 100644 --- a/ReactCommon/cxxreact/JSExecutor.cpp +++ b/ReactCommon/cxxreact/JSExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSExecutor.h b/ReactCommon/cxxreact/JSExecutor.h index b3b29d1b3265..c66ff32d14b2 100644 --- a/ReactCommon/cxxreact/JSExecutor.h +++ b/ReactCommon/cxxreact/JSExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp b/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp index 9c775d06a17e..5be7c1b446d1 100644 --- a/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp +++ b/ReactCommon/cxxreact/JSIndexedRAMBundle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSIndexedRAMBundle.h b/ReactCommon/cxxreact/JSIndexedRAMBundle.h index 3045eb6a2847..a8aa34166ada 100644 --- a/ReactCommon/cxxreact/JSIndexedRAMBundle.h +++ b/ReactCommon/cxxreact/JSIndexedRAMBundle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JSModulesUnbundle.h b/ReactCommon/cxxreact/JSModulesUnbundle.h index 52103f7a58d2..56376758292f 100644 --- a/ReactCommon/cxxreact/JSModulesUnbundle.h +++ b/ReactCommon/cxxreact/JSModulesUnbundle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JsArgumentHelpers-inl.h b/ReactCommon/cxxreact/JsArgumentHelpers-inl.h index fa76074d0712..22bd10a4d607 100644 --- a/ReactCommon/cxxreact/JsArgumentHelpers-inl.h +++ b/ReactCommon/cxxreact/JsArgumentHelpers-inl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/JsArgumentHelpers.h b/ReactCommon/cxxreact/JsArgumentHelpers.h index 25702ba845e5..9c6973e0da97 100644 --- a/ReactCommon/cxxreact/JsArgumentHelpers.h +++ b/ReactCommon/cxxreact/JsArgumentHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/MessageQueueThread.h b/ReactCommon/cxxreact/MessageQueueThread.h index 9026a0ba8701..3313b1a0fd05 100644 --- a/ReactCommon/cxxreact/MessageQueueThread.h +++ b/ReactCommon/cxxreact/MessageQueueThread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/MethodCall.cpp b/ReactCommon/cxxreact/MethodCall.cpp index 3a22b8994b9c..d3e84330075f 100644 --- a/ReactCommon/cxxreact/MethodCall.cpp +++ b/ReactCommon/cxxreact/MethodCall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/MethodCall.h b/ReactCommon/cxxreact/MethodCall.h index 665cd70f8318..f2fad2f02569 100644 --- a/ReactCommon/cxxreact/MethodCall.h +++ b/ReactCommon/cxxreact/MethodCall.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/ModuleRegistry.cpp b/ReactCommon/cxxreact/ModuleRegistry.cpp index 741d97073d36..ecc88c2ef5d5 100644 --- a/ReactCommon/cxxreact/ModuleRegistry.cpp +++ b/ReactCommon/cxxreact/ModuleRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/ModuleRegistry.h b/ReactCommon/cxxreact/ModuleRegistry.h index fba4496a6217..20e30677d40b 100644 --- a/ReactCommon/cxxreact/ModuleRegistry.h +++ b/ReactCommon/cxxreact/ModuleRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/NativeModule.h b/ReactCommon/cxxreact/NativeModule.h index 2441953b4a04..a088f5b7d3a7 100644 --- a/ReactCommon/cxxreact/NativeModule.h +++ b/ReactCommon/cxxreact/NativeModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/NativeToJsBridge.cpp b/ReactCommon/cxxreact/NativeToJsBridge.cpp index 3a695201057b..d59f4ff98ae7 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.cpp +++ b/ReactCommon/cxxreact/NativeToJsBridge.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/NativeToJsBridge.h b/ReactCommon/cxxreact/NativeToJsBridge.h index f9548c59509d..b8ba6a69c331 100644 --- a/ReactCommon/cxxreact/NativeToJsBridge.h +++ b/ReactCommon/cxxreact/NativeToJsBridge.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/RAMBundleRegistry.cpp b/ReactCommon/cxxreact/RAMBundleRegistry.cpp index c19110c9ce12..7946334dcdb1 100644 --- a/ReactCommon/cxxreact/RAMBundleRegistry.cpp +++ b/ReactCommon/cxxreact/RAMBundleRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/RAMBundleRegistry.h b/ReactCommon/cxxreact/RAMBundleRegistry.h index 9dcb210c990d..d310ef1f42c1 100644 --- a/ReactCommon/cxxreact/RAMBundleRegistry.h +++ b/ReactCommon/cxxreact/RAMBundleRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/React-cxxreact.podspec b/ReactCommon/cxxreact/React-cxxreact.podspec index 14bd5eed723c..977d260a8b6f 100644 --- a/ReactCommon/cxxreact/React-cxxreact.podspec +++ b/ReactCommon/cxxreact/React-cxxreact.podspec @@ -1,5 +1,5 @@ # coding: utf-8 -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/ReactMarker.cpp b/ReactCommon/cxxreact/ReactMarker.cpp index 1f9ce2bb5f9a..8746a19eb83f 100644 --- a/ReactCommon/cxxreact/ReactMarker.cpp +++ b/ReactCommon/cxxreact/ReactMarker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,7 @@ namespace ReactMarker { #endif LogTaggedMarker logTaggedMarker = nullptr; -LogTaggedMarkerWithInstanceKey logTaggedMarkerWithInstanceKey = nullptr; +LogTaggedMarker logTaggedMarkerBridgeless = nullptr; #if __clang__ #pragma clang diagnostic pop @@ -27,6 +27,10 @@ void logMarker(const ReactMarkerId markerId) { logTaggedMarker(markerId, nullptr); } +void logMarkerBridgeless(const ReactMarkerId markerId) { + logTaggedMarkerBridgeless(markerId, nullptr); +} + } // namespace ReactMarker } // namespace react } // namespace facebook diff --git a/ReactCommon/cxxreact/ReactMarker.h b/ReactCommon/cxxreact/ReactMarker.h index 875f7b29d398..21d8c2a705bc 100644 --- a/ReactCommon/cxxreact/ReactMarker.h +++ b/ReactCommon/cxxreact/ReactMarker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,25 +33,24 @@ enum ReactMarkerId { #ifdef __APPLE__ using LogTaggedMarker = + std::function; // Bridge only +using LogTaggedMarkerBridgeless = std::function; -using LogTaggedMarkerWithInstanceKey = std::function< - void(const ReactMarkerId, const char *tag, const int instanceKey)>; #else -typedef void (*LogTaggedMarker)(const ReactMarkerId, const char *tag); -typedef void (*LogTaggedMarkerWithInstanceKey)( - const ReactMarkerId, - const char *tag, - const int instanceKey); +typedef void ( + *LogTaggedMarker)(const ReactMarkerId, const char *tag); // Bridge only +typedef void (*LogTaggedMarkerBridgeless)(const ReactMarkerId, const char *tag); #endif #ifndef RN_EXPORT #define RN_EXPORT __attribute__((visibility("default"))) #endif -extern RN_EXPORT LogTaggedMarker logTaggedMarker; -extern RN_EXPORT LogTaggedMarkerWithInstanceKey logTaggedMarkerWithInstanceKey; +extern RN_EXPORT LogTaggedMarker logTaggedMarker; // Bridge only +extern RN_EXPORT LogTaggedMarker logTaggedMarkerBridgeless; -extern RN_EXPORT void logMarker(const ReactMarkerId markerId); +extern RN_EXPORT void logMarker(const ReactMarkerId markerId); // Bridge only +extern RN_EXPORT void logMarkerBridgeless(const ReactMarkerId markerId); } // namespace ReactMarker } // namespace react diff --git a/ReactCommon/cxxreact/ReactNativeVersion.h b/ReactCommon/cxxreact/ReactNativeVersion.h index d6cbbcd82a9c..57b7fbca4935 100644 --- a/ReactCommon/cxxreact/ReactNativeVersion.h +++ b/ReactCommon/cxxreact/ReactNativeVersion.h @@ -1,10 +1,10 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated by scripts/bump-oss-version.js + * @generated by scripts/set-rn-version.js */ #pragma once @@ -16,8 +16,8 @@ namespace facebook::react { constexpr struct { int32_t Major = 0; - int32_t Minor = 0; - int32_t Patch = 0; + int32_t Minor = 68; + int32_t Patch = 3; std::string_view Prerelease = ""; } ReactNativeVersion; diff --git a/ReactCommon/cxxreact/RecoverableError.h b/ReactCommon/cxxreact/RecoverableError.h index 362fea222244..4ea9fa9f91ff 100644 --- a/ReactCommon/cxxreact/RecoverableError.h +++ b/ReactCommon/cxxreact/RecoverableError.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/SampleCxxModule.cpp b/ReactCommon/cxxreact/SampleCxxModule.cpp index 31acd0beac7d..c84aa1594ec4 100644 --- a/ReactCommon/cxxreact/SampleCxxModule.cpp +++ b/ReactCommon/cxxreact/SampleCxxModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/SampleCxxModule.h b/ReactCommon/cxxreact/SampleCxxModule.h index e669989645f1..58452827501c 100644 --- a/ReactCommon/cxxreact/SampleCxxModule.h +++ b/ReactCommon/cxxreact/SampleCxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/SharedProxyCxxModule.h b/ReactCommon/cxxreact/SharedProxyCxxModule.h index 97d67ddf0db1..cb607d3ca5b9 100644 --- a/ReactCommon/cxxreact/SharedProxyCxxModule.h +++ b/ReactCommon/cxxreact/SharedProxyCxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/SystraceSection.h b/ReactCommon/cxxreact/SystraceSection.h index 3a59f0ed6118..3527f09fe7eb 100644 --- a/ReactCommon/cxxreact/SystraceSection.h +++ b/ReactCommon/cxxreact/SystraceSection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp b/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp index cba8d16f70eb..004859cce727 100644 --- a/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp +++ b/ReactCommon/cxxreact/tests/RecoverableErrorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/tests/jsarg_helpers.cpp b/ReactCommon/cxxreact/tests/jsarg_helpers.cpp index c49a65b47d7f..9ad9a7d56d5d 100644 --- a/ReactCommon/cxxreact/tests/jsarg_helpers.cpp +++ b/ReactCommon/cxxreact/tests/jsarg_helpers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/tests/jsbigstring.cpp b/ReactCommon/cxxreact/tests/jsbigstring.cpp index de5aaad38ab6..1c6c7b886848 100644 --- a/ReactCommon/cxxreact/tests/jsbigstring.cpp +++ b/ReactCommon/cxxreact/tests/jsbigstring.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/cxxreact/tests/methodcall.cpp b/ReactCommon/cxxreact/tests/methodcall.cpp index 3035548d417e..9c5485d2bb17 100644 --- a/ReactCommon/cxxreact/tests/methodcall.cpp +++ b/ReactCommon/cxxreact/tests/methodcall.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/React-hermes.podspec b/ReactCommon/hermes/React-hermes.podspec index 50eaa2ad3fb3..695c6afdc7c5 100644 --- a/ReactCommon/hermes/React-hermes.podspec +++ b/ReactCommon/hermes/React-hermes.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/executor/Android.mk b/ReactCommon/hermes/executor/Android.mk index 52b4d25085f7..9deb72dd72da 100644 --- a/ReactCommon/hermes/executor/Android.mk +++ b/ReactCommon/hermes/executor/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,6 +12,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := hermes-executor-common-release LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) @@ -19,7 +20,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_STATIC_LIBRARIES := libjsireact LOCAL_SHARED_LIBRARIES := libhermes libjsi -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) @@ -27,6 +28,7 @@ LOCAL_MODULE := hermes-executor-common-debug LOCAL_CFLAGS := -DHERMES_ENABLE_DEBUGGER=1 LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) @@ -34,4 +36,4 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_STATIC_LIBRARIES := libjsireact libhermes-inspector LOCAL_SHARED_LIBRARIES := libhermes libjsi -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_STATIC_LIBRARY) diff --git a/ReactCommon/hermes/executor/HermesExecutorFactory.cpp b/ReactCommon/hermes/executor/HermesExecutorFactory.cpp index 693a9a1bd73c..bab34bf3805d 100644 --- a/ReactCommon/hermes/executor/HermesExecutorFactory.cpp +++ b/ReactCommon/hermes/executor/HermesExecutorFactory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/executor/HermesExecutorFactory.h b/ReactCommon/hermes/executor/HermesExecutorFactory.h index 99d3eb34f4e5..5d4468e3668b 100644 --- a/ReactCommon/hermes/executor/HermesExecutorFactory.h +++ b/ReactCommon/hermes/executor/HermesExecutorFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/executor/JSITracing.cpp b/ReactCommon/hermes/executor/JSITracing.cpp index 58f910f2826c..3c013cf94e42 100644 --- a/ReactCommon/hermes/executor/JSITracing.cpp +++ b/ReactCommon/hermes/executor/JSITracing.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/executor/JSITracing.h b/ReactCommon/hermes/executor/JSITracing.h index e018144be4e0..13505637c1c0 100644 --- a/ReactCommon/hermes/executor/JSITracing.h +++ b/ReactCommon/hermes/executor/JSITracing.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/Android.mk b/ReactCommon/hermes/inspector/Android.mk index 461b10aaac33..cddc17dc166e 100644 --- a/ReactCommon/hermes/inspector/Android.mk +++ b/ReactCommon/hermes/inspector/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,6 +12,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := hermes-inspector LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/detail/*.cpp $(LOCAL_PATH)/chrome/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_ROOT := $(LOCAL_PATH)/../.. @@ -21,6 +22,14 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_ROOT) LOCAL_CPP_FEATURES := exceptions -LOCAL_SHARED_LIBRARIES := jsinspector libfb libfbjni libfolly_futures libfolly_json libhermes libjsi libglog - -include $(BUILD_SHARED_LIBRARY) +LOCAL_SHARED_LIBRARIES := \ + jsinspector \ + libfb \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog \ + libhermes \ + libjsi + +include $(BUILD_STATIC_LIBRARY) diff --git a/ReactCommon/hermes/inspector/AsyncPauseState.h b/ReactCommon/hermes/inspector/AsyncPauseState.h index 757605785929..b040780f5c90 100644 --- a/ReactCommon/hermes/inspector/AsyncPauseState.h +++ b/ReactCommon/hermes/inspector/AsyncPauseState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/BUCK b/ReactCommon/hermes/inspector/BUCK index 0ff039ceb1e3..4a76c62471d8 100644 --- a/ReactCommon/hermes/inspector/BUCK +++ b/ReactCommon/hermes/inspector/BUCK @@ -1,5 +1,3 @@ -# Copyright 2004-present Facebook. All Rights Reserved. - load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary") load("@fbsource//tools/build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library") load("@fbsource//tools/build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test") diff --git a/ReactCommon/hermes/inspector/Exceptions.h b/ReactCommon/hermes/inspector/Exceptions.h index b47f45c83f93..134fe282919e 100644 --- a/ReactCommon/hermes/inspector/Exceptions.h +++ b/ReactCommon/hermes/inspector/Exceptions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/Inspector.cpp b/ReactCommon/hermes/inspector/Inspector.cpp index 1b5a09d35635..efdba70c6b2d 100644 --- a/ReactCommon/hermes/inspector/Inspector.cpp +++ b/ReactCommon/hermes/inspector/Inspector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/Inspector.h b/ReactCommon/hermes/inspector/Inspector.h index a55f1c45b9cf..dc85d90d6469 100644 --- a/ReactCommon/hermes/inspector/Inspector.h +++ b/ReactCommon/hermes/inspector/Inspector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/InspectorState.cpp b/ReactCommon/hermes/inspector/InspectorState.cpp index a52e2ac25f0b..a318180a435c 100644 --- a/ReactCommon/hermes/inspector/InspectorState.cpp +++ b/ReactCommon/hermes/inspector/InspectorState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/InspectorState.h b/ReactCommon/hermes/inspector/InspectorState.h index 67a8fbede474..f5fac9ea006a 100644 --- a/ReactCommon/hermes/inspector/InspectorState.h +++ b/ReactCommon/hermes/inspector/InspectorState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/RuntimeAdapter.cpp b/ReactCommon/hermes/inspector/RuntimeAdapter.cpp index ce0baa79ada7..d88ff8256b9b 100644 --- a/ReactCommon/hermes/inspector/RuntimeAdapter.cpp +++ b/ReactCommon/hermes/inspector/RuntimeAdapter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/RuntimeAdapter.h b/ReactCommon/hermes/inspector/RuntimeAdapter.h index dcf8a008b88a..361c54c62f72 100644 --- a/ReactCommon/hermes/inspector/RuntimeAdapter.h +++ b/ReactCommon/hermes/inspector/RuntimeAdapter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.cpp b/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.cpp index 70d7e5ebcd56..6b787aa51052 100644 --- a/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.cpp +++ b/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.h b/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.h index cb501e68e5a8..8fe0710380b2 100644 --- a/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.h +++ b/ReactCommon/hermes/inspector/chrome/AutoAttachUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/Connection.cpp b/ReactCommon/hermes/inspector/chrome/Connection.cpp index 572a07cc2826..7101eb22473b 100644 --- a/ReactCommon/hermes/inspector/chrome/Connection.cpp +++ b/ReactCommon/hermes/inspector/chrome/Connection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/Connection.h b/ReactCommon/hermes/inspector/chrome/Connection.h index 0e49e69e0b0d..92dbbdf4a3a6 100644 --- a/ReactCommon/hermes/inspector/chrome/Connection.h +++ b/ReactCommon/hermes/inspector/chrome/Connection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp b/ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp index 62675f336b11..9aaee2ca13a5 100644 --- a/ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp +++ b/ReactCommon/hermes/inspector/chrome/ConnectionDemux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/ConnectionDemux.h b/ReactCommon/hermes/inspector/chrome/ConnectionDemux.h index cf07d23a2958..d7697bc6b4f2 100644 --- a/ReactCommon/hermes/inspector/chrome/ConnectionDemux.h +++ b/ReactCommon/hermes/inspector/chrome/ConnectionDemux.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/MessageConverters.cpp b/ReactCommon/hermes/inspector/chrome/MessageConverters.cpp index 711a05cdced6..3ffc17d0b5aa 100644 --- a/ReactCommon/hermes/inspector/chrome/MessageConverters.cpp +++ b/ReactCommon/hermes/inspector/chrome/MessageConverters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/MessageConverters.h b/ReactCommon/hermes/inspector/chrome/MessageConverters.h index 3622568ae3f9..d2f90a482acd 100644 --- a/ReactCommon/hermes/inspector/chrome/MessageConverters.h +++ b/ReactCommon/hermes/inspector/chrome/MessageConverters.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/MessageInterfaces.h b/ReactCommon/hermes/inspector/chrome/MessageInterfaces.h index 4ad37dc3b80a..46cdd7388bde 100644 --- a/ReactCommon/hermes/inspector/chrome/MessageInterfaces.h +++ b/ReactCommon/hermes/inspector/chrome/MessageInterfaces.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/MessageTypesInlines.h b/ReactCommon/hermes/inspector/chrome/MessageTypesInlines.h index 641034f0af79..2f6bff4f28a8 100644 --- a/ReactCommon/hermes/inspector/chrome/MessageTypesInlines.h +++ b/ReactCommon/hermes/inspector/chrome/MessageTypesInlines.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/Registration.cpp b/ReactCommon/hermes/inspector/chrome/Registration.cpp index 9ba0dbbf8401..d64a08ebbfc6 100644 --- a/ReactCommon/hermes/inspector/chrome/Registration.cpp +++ b/ReactCommon/hermes/inspector/chrome/Registration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/Registration.h b/ReactCommon/hermes/inspector/chrome/Registration.h index b6601478f1e2..9acff574df84 100644 --- a/ReactCommon/hermes/inspector/chrome/Registration.h +++ b/ReactCommon/hermes/inspector/chrome/Registration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.cpp b/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.cpp index ffab5d9721b3..28f9f79193e6 100644 --- a/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.cpp +++ b/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.h b/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.h index 468db2f6307e..97c0c38bc396 100644 --- a/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.h +++ b/ReactCommon/hermes/inspector/chrome/RemoteObjectsTable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/cli/main.cpp b/ReactCommon/hermes/inspector/chrome/cli/main.cpp index 3e687be4f361..8071bcc11aab 100644 --- a/ReactCommon/hermes/inspector/chrome/cli/main.cpp +++ b/ReactCommon/hermes/inspector/chrome/cli/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.cpp b/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.cpp index c19a53365824..ae490a9553af 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.h b/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.h index 60a63147fc38..645e43726bb7 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.h +++ b/ReactCommon/hermes/inspector/chrome/tests/AsyncHermesRuntime.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/ConnectionDemuxTests.cpp b/ReactCommon/hermes/inspector/chrome/tests/ConnectionDemuxTests.cpp index 52173027ea68..4250ee3ac7e7 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/ConnectionDemuxTests.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/ConnectionDemuxTests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp b/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp index f579799bbae5..1338337779ec 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/ConnectionTests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp b/ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp index 2b2484b00e3b..1bd85d669e1b 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/MessageTests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/RemoteObjectsTableTest.cpp b/ReactCommon/hermes/inspector/chrome/tests/RemoteObjectsTableTest.cpp index 0ee9e973d3a1..834a8e727066 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/RemoteObjectsTableTest.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/RemoteObjectsTableTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.cpp b/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.cpp index 0514db17fe9c..60aff01ad0c9 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.cpp +++ b/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.h b/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.h index 97da2ec8657b..d50018a3d24e 100644 --- a/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.h +++ b/ReactCommon/hermes/inspector/chrome/tests/SyncConnection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/CallbackOStream.cpp b/ReactCommon/hermes/inspector/detail/CallbackOStream.cpp index ed0c5b7cffae..a04524e7b142 100644 --- a/ReactCommon/hermes/inspector/detail/CallbackOStream.cpp +++ b/ReactCommon/hermes/inspector/detail/CallbackOStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/CallbackOStream.h b/ReactCommon/hermes/inspector/detail/CallbackOStream.h index 5085743c8624..44a1ab7cdf63 100644 --- a/ReactCommon/hermes/inspector/detail/CallbackOStream.h +++ b/ReactCommon/hermes/inspector/detail/CallbackOStream.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/SerialExecutor.cpp b/ReactCommon/hermes/inspector/detail/SerialExecutor.cpp index d9c32797dd91..dbd89dff98fa 100644 --- a/ReactCommon/hermes/inspector/detail/SerialExecutor.cpp +++ b/ReactCommon/hermes/inspector/detail/SerialExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/SerialExecutor.h b/ReactCommon/hermes/inspector/detail/SerialExecutor.h index c4b7226f4b55..e8e52f131000 100644 --- a/ReactCommon/hermes/inspector/detail/SerialExecutor.h +++ b/ReactCommon/hermes/inspector/detail/SerialExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/Thread.cpp b/ReactCommon/hermes/inspector/detail/Thread.cpp index 09a50db7c94b..adfb6330efba 100644 --- a/ReactCommon/hermes/inspector/detail/Thread.cpp +++ b/ReactCommon/hermes/inspector/detail/Thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/Thread.h b/ReactCommon/hermes/inspector/detail/Thread.h index c4e832e28e3c..e4bbc03e6e23 100644 --- a/ReactCommon/hermes/inspector/detail/Thread.h +++ b/ReactCommon/hermes/inspector/detail/Thread.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/tests/CallbackOStreamTests.cpp b/ReactCommon/hermes/inspector/detail/tests/CallbackOStreamTests.cpp index 03f0aadc919d..3b37d4465b86 100644 --- a/ReactCommon/hermes/inspector/detail/tests/CallbackOStreamTests.cpp +++ b/ReactCommon/hermes/inspector/detail/tests/CallbackOStreamTests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/detail/tests/SerialExecutorTests.cpp b/ReactCommon/hermes/inspector/detail/tests/SerialExecutorTests.cpp index f6d44d4302a0..4a74de467b6a 100644 --- a/ReactCommon/hermes/inspector/detail/tests/SerialExecutorTests.cpp +++ b/ReactCommon/hermes/inspector/detail/tests/SerialExecutorTests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/docs/GenerateInspectorFSM.sh b/ReactCommon/hermes/inspector/docs/GenerateInspectorFSM.sh index 83530976c8f4..6218d33d6ea3 100755 --- a/ReactCommon/hermes/inspector/docs/GenerateInspectorFSM.sh +++ b/ReactCommon/hermes/inspector/docs/GenerateInspectorFSM.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tests/InspectorTests.cpp b/ReactCommon/hermes/inspector/tests/InspectorTests.cpp index 680625844bfb..6aa9608cb53d 100644 --- a/ReactCommon/hermes/inspector/tests/InspectorTests.cpp +++ b/ReactCommon/hermes/inspector/tests/InspectorTests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/CommandTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/CommandTest.js index 5be283814000..b409e81cced7 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/CommandTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/CommandTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/EventTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/EventTest.js index 00cdcb7e42fe..8ebb1ecb6e91 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/EventTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/EventTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/GraphTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/GraphTest.js index 5f443e47903c..b890c050ea89 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/GraphTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/GraphTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/HeaderWriterTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/HeaderWriterTest.js index 44bd13aac1a8..1c9da38f7b99 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/HeaderWriterTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/HeaderWriterTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/ImplementationWriterTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/ImplementationWriterTest.js index 4437bb144dcc..6ad01e08231a 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/ImplementationWriterTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/ImplementationWriterTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/PropertyTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/PropertyTest.js index 583fcdf737b8..f1f1c8a5be7e 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/PropertyTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/PropertyTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/__tests__/TypeTest.js b/ReactCommon/hermes/inspector/tools/msggen/__tests__/TypeTest.js index 6f5a8649ba14..14fc860e1e2d 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/__tests__/TypeTest.js +++ b/ReactCommon/hermes/inspector/tools/msggen/__tests__/TypeTest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Command.js b/ReactCommon/hermes/inspector/tools/msggen/src/Command.js index 08b74abcb73a..b7b60d4aeac1 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Command.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Command.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js b/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js index 2eb43df111b0..8061ef1a41aa 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Converters.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Event.js b/ReactCommon/hermes/inspector/tools/msggen/src/Event.js index 7e04311a6867..9edfe7f8f2be 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Event.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Event.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/GeneratedHeader.js b/ReactCommon/hermes/inspector/tools/msggen/src/GeneratedHeader.js index dbf43749213a..7375312ee788 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/GeneratedHeader.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/GeneratedHeader.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Graph.js b/ReactCommon/hermes/inspector/tools/msggen/src/Graph.js index 98fc5e926dad..d14760ce93d0 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Graph.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Graph.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js b/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js index d217c2e86b4f..b8f5cdb32e8a 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/HeaderWriter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -70,7 +70,7 @@ export class HeaderWriter { this.stream.write('struct UnknownRequest;\n\n'); const namespaceMap: Map> = new Map(); - const addToMap = function(type) { + const addToMap = function (type) { const domain = type.domain; let types = namespaceMap.get(domain); if (!types) { diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/ImplementationWriter.js b/ReactCommon/hermes/inspector/tools/msggen/src/ImplementationWriter.js index 7dea2bb04d3b..5e2b69077140 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/ImplementationWriter.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/ImplementationWriter.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Property.js b/ReactCommon/hermes/inspector/tools/msggen/src/Property.js index bfcf5d1a2376..681ccaf36767 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Property.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Property.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/TestHelpers.js b/ReactCommon/hermes/inspector/tools/msggen/src/TestHelpers.js index 476dc195734c..c53ab4c94678 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/TestHelpers.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/TestHelpers.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/Type.js b/ReactCommon/hermes/inspector/tools/msggen/src/Type.js index d91432f45693..18f9ac11cf5e 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/Type.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/Type.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/msggen/src/index.js b/ReactCommon/hermes/inspector/tools/msggen/src/index.js index b1452d509f91..cf6f3d881ec6 100644 --- a/ReactCommon/hermes/inspector/tools/msggen/src/index.js +++ b/ReactCommon/hermes/inspector/tools/msggen/src/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -83,7 +83,7 @@ function buildGraph(desc: Descriptor): Graph { const commands = desc.commands; const events = desc.events; - const maybeAddPropEdges = function(nodeId: string, props: ?Array) { + const maybeAddPropEdges = function (nodeId: string, props: ?Array) { if (props) { for (const prop of props) { const refId = prop.getRefDebuggerName(); diff --git a/ReactCommon/hermes/inspector/tools/sandcastle/build_and_test.sh b/ReactCommon/hermes/inspector/tools/sandcastle/build_and_test.sh index 12c603ffe55b..dab7ee09b674 100755 --- a/ReactCommon/hermes/inspector/tools/sandcastle/build_and_test.sh +++ b/ReactCommon/hermes/inspector/tools/sandcastle/build_and_test.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/hermes/inspector/tools/sandcastle/setup.sh b/ReactCommon/hermes/inspector/tools/sandcastle/setup.sh index fafba7ad3a40..eb6c194f5952 100755 --- a/ReactCommon/hermes/inspector/tools/sandcastle/setup.sh +++ b/ReactCommon/hermes/inspector/tools/sandcastle/setup.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -15,10 +15,6 @@ set -o pipefail THIS_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) ROOT_DIR=$(cd "$THIS_DIR" && hg root) -# Buck by default uses clang-3.6 from /opt/local/bin. -# Override it to use system clang. -export PATH="/usr/bin:$PATH" - # Enter xplat cd "$ROOT_DIR"/xplat || exit 1 diff --git a/ReactCommon/jsi/Android.mk b/ReactCommon/jsi/Android.mk index 3fce2059e2d7..ec9a3e0ba890 100644 --- a/ReactCommon/jsi/Android.mk +++ b/ReactCommon/jsi/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := jsi LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jsi/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) @@ -25,6 +26,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := jscruntime LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) diff --git a/ReactCommon/jsi/JSCRuntime.cpp b/ReactCommon/jsi/JSCRuntime.cpp index c9465b33dff5..58804af17398 100644 --- a/ReactCommon/jsi/JSCRuntime.cpp +++ b/ReactCommon/jsi/JSCRuntime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/JSCRuntime.h b/ReactCommon/jsi/JSCRuntime.h index 54554230f049..1d6b2259fcdb 100644 --- a/ReactCommon/jsi/JSCRuntime.h +++ b/ReactCommon/jsi/JSCRuntime.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/React-jsi.podspec b/ReactCommon/jsi/React-jsi.podspec index 92bc7f92d07c..10c82d199e35 100644 --- a/ReactCommon/jsi/React-jsi.podspec +++ b/ReactCommon/jsi/React-jsi.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/CMakeLists.txt b/ReactCommon/jsi/jsi/CMakeLists.txt index acfa48395e51..3d2959e54914 100644 --- a/ReactCommon/jsi/jsi/CMakeLists.txt +++ b/ReactCommon/jsi/jsi/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/JSIDynamic.cpp b/ReactCommon/jsi/jsi/JSIDynamic.cpp index acac7a3a0472..4464cc3b62f9 100644 --- a/ReactCommon/jsi/jsi/JSIDynamic.cpp +++ b/ReactCommon/jsi/jsi/JSIDynamic.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/JSIDynamic.h b/ReactCommon/jsi/jsi/JSIDynamic.h index 41f9d9f8f333..110dd13999f4 100644 --- a/ReactCommon/jsi/jsi/JSIDynamic.h +++ b/ReactCommon/jsi/jsi/JSIDynamic.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/decorator.h b/ReactCommon/jsi/jsi/decorator.h index be6f4f568b68..a36195444597 100644 --- a/ReactCommon/jsi/jsi/decorator.h +++ b/ReactCommon/jsi/jsi/decorator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/instrumentation.h b/ReactCommon/jsi/jsi/instrumentation.h index a337a7a84151..e841af07df8f 100644 --- a/ReactCommon/jsi/jsi/instrumentation.h +++ b/ReactCommon/jsi/jsi/instrumentation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/jsi-inl.h b/ReactCommon/jsi/jsi/jsi-inl.h index 63d4a2f5868d..c30b78a16a1d 100644 --- a/ReactCommon/jsi/jsi/jsi-inl.h +++ b/ReactCommon/jsi/jsi/jsi-inl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/jsi.cpp b/ReactCommon/jsi/jsi/jsi.cpp index be38c9787ecd..4127a7bc709e 100644 --- a/ReactCommon/jsi/jsi/jsi.cpp +++ b/ReactCommon/jsi/jsi/jsi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/jsi.h b/ReactCommon/jsi/jsi/jsi.h index ae64498f03f9..852577ab8986 100644 --- a/ReactCommon/jsi/jsi/jsi.h +++ b/ReactCommon/jsi/jsi/jsi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -200,13 +200,13 @@ class JSI_EXPORT Runtime { /// Hosts may call this function again to resume the draining if it was /// suspended due to either exceptions or the \p maxMicrotasksHint bound. /// E.g. a host may repetitively invoke this function until the queue is - /// drained to implement the "microtask checkpint" defined in WHATWG HTML + /// drained to implement the "microtask checkpoint" defined in WHATWG HTML /// event loop: https://html.spec.whatwg.org/C#perform-a-microtask-checkpoint. /// /// Note that error propagation is only a concern if a host needs to implement - /// `queueMicrotask`, a recent API that allows enqueueing aribitary functions + /// `queueMicrotask`, a recent API that allows enqueueing arbitrary functions /// (hence may throw) as microtasks. Exceptions from ECMA-262 Promise Jobs are - /// handled internally to VMs and are never propagrated to hosts. + /// handled internally to VMs and are never propagated to hosts. /// /// This API offers some queue management to hosts at its best effort due to /// different behaviors and limitations imposed by different VMs and APIs. By @@ -680,7 +680,7 @@ class JSI_EXPORT Object : public Pointer { std::shared_ptr getHostObject(Runtime& runtime) const; /// \return a shared_ptr which refers to the same underlying - /// \c HostObject that was used to crete this object. If \c isHostObject + /// \c HostObject that was used to create this object. If \c isHostObject /// is false, this will throw. template std::shared_ptr asHostObject(Runtime& runtime) const; diff --git a/ReactCommon/jsi/jsi/jsilib-posix.cpp b/ReactCommon/jsi/jsi/jsilib-posix.cpp index 87b1bdf364d3..b47d0d4ab81b 100644 --- a/ReactCommon/jsi/jsi/jsilib-posix.cpp +++ b/ReactCommon/jsi/jsi/jsilib-posix.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/jsilib-windows.cpp b/ReactCommon/jsi/jsi/jsilib-windows.cpp index 8db80e72fafa..98de15e65af8 100644 --- a/ReactCommon/jsi/jsi/jsilib-windows.cpp +++ b/ReactCommon/jsi/jsi/jsilib-windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/jsilib.h b/ReactCommon/jsi/jsi/jsilib.h index d99b66dc9406..5c791003d2c1 100644 --- a/ReactCommon/jsi/jsi/jsilib.h +++ b/ReactCommon/jsi/jsi/jsilib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/test/testlib.cpp b/ReactCommon/jsi/jsi/test/testlib.cpp index e605b6acead9..87dffaa56deb 100644 --- a/ReactCommon/jsi/jsi/test/testlib.cpp +++ b/ReactCommon/jsi/jsi/test/testlib.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/test/testlib.h b/ReactCommon/jsi/jsi/test/testlib.h index 8d9392694005..9f30fb2d77de 100644 --- a/ReactCommon/jsi/jsi/test/testlib.h +++ b/ReactCommon/jsi/jsi/test/testlib.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsi/jsi/threadsafe.h b/ReactCommon/jsi/jsi/threadsafe.h index eddbce403d60..cb10a335f6c3 100644 --- a/ReactCommon/jsi/jsi/threadsafe.h +++ b/ReactCommon/jsi/jsi/threadsafe.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsiexecutor/Android.mk b/ReactCommon/jsiexecutor/Android.mk index e0661538e666..9f8d79ffcc78 100644 --- a/ReactCommon/jsiexecutor/Android.mk +++ b/ReactCommon/jsiexecutor/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := jsireact LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/jsireact/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) diff --git a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec index 1151d99ad2e3..637ac644a0ce 100644 --- a/ReactCommon/jsiexecutor/React-jsiexecutor.podspec +++ b/ReactCommon/jsiexecutor/React-jsiexecutor.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp index f1d16bacb399..b6f3f26ad132 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h index 615172ed711c..f06d0d32fd09 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h +++ b/ReactCommon/jsiexecutor/jsireact/JSIExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp index 0bf27d402e9e..2dadd43e2876 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp +++ b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h index a1dff88ec9f4..c6aaacfa41cc 100644 --- a/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h +++ b/ReactCommon/jsiexecutor/jsireact/JSINativeModules.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsinspector/Android.mk b/ReactCommon/jsinspector/Android.mk index 4ac555362365..023fed0910ed 100644 --- a/ReactCommon/jsinspector/Android.mk +++ b/ReactCommon/jsinspector/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := jsinspector LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) diff --git a/ReactCommon/jsinspector/BUCK b/ReactCommon/jsinspector/BUCK index c298131a299c..7fde000686f7 100644 --- a/ReactCommon/jsinspector/BUCK +++ b/ReactCommon/jsinspector/BUCK @@ -32,4 +32,5 @@ rn_xplat_cxx_library( visibility = [ "PUBLIC", ], + windows_compiler_flags = ["/WX-"], # Do not treat all warnings as errors ) diff --git a/ReactCommon/jsinspector/InspectorInterfaces.cpp b/ReactCommon/jsinspector/InspectorInterfaces.cpp index ed918c97db65..fbd38e13e3df 100644 --- a/ReactCommon/jsinspector/InspectorInterfaces.cpp +++ b/ReactCommon/jsinspector/InspectorInterfaces.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsinspector/InspectorInterfaces.h b/ReactCommon/jsinspector/InspectorInterfaces.h index 345434be2f67..77fd6e1d546a 100644 --- a/ReactCommon/jsinspector/InspectorInterfaces.h +++ b/ReactCommon/jsinspector/InspectorInterfaces.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/jsinspector/React-jsinspector.podspec b/ReactCommon/jsinspector/React-jsinspector.podspec index a29430de12e9..a518b6880016 100644 --- a/ReactCommon/jsinspector/React-jsinspector.podspec +++ b/ReactCommon/jsinspector/React-jsinspector.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/logger/Android.mk b/ReactCommon/logger/Android.mk index 09a29bd3e158..ca78f12e42ac 100644 --- a/ReactCommon/logger/Android.mk +++ b/ReactCommon/logger/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := logger LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) diff --git a/ReactCommon/logger/React-logger.podspec b/ReactCommon/logger/React-logger.podspec index 39ae857e5e36..94faa21cfd97 100644 --- a/ReactCommon/logger/React-logger.podspec +++ b/ReactCommon/logger/React-logger.podspec @@ -1,5 +1,5 @@ # coding: utf-8 -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/logger/react_native_log.cpp b/ReactCommon/logger/react_native_log.cpp index 3b0310432c07..ba89efcd1fd1 100644 --- a/ReactCommon/logger/react_native_log.cpp +++ b/ReactCommon/logger/react_native_log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/logger/react_native_log.h b/ReactCommon/logger/react_native_log.h index c64f20255598..9ac23eeaacae 100644 --- a/ReactCommon/logger/react_native_log.h +++ b/ReactCommon/logger/react_native_log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/microprofiler/MicroProfiler.cpp b/ReactCommon/microprofiler/MicroProfiler.cpp index 15fd01646039..6c4f8cf35ab4 100644 --- a/ReactCommon/microprofiler/MicroProfiler.cpp +++ b/ReactCommon/microprofiler/MicroProfiler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/microprofiler/MicroProfiler.h b/ReactCommon/microprofiler/MicroProfiler.h index 3c6861173a72..511c1b8a3580 100644 --- a/ReactCommon/microprofiler/MicroProfiler.h +++ b/ReactCommon/microprofiler/MicroProfiler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/config/Android.mk b/ReactCommon/react/config/Android.mk index c7b63c9699eb..c4c2a409c709 100644 --- a/ReactCommon/react/config/Android.mk +++ b/ReactCommon/react/config/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -7,9 +7,10 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_MODULE := reactconfig +LOCAL_MODULE := react_config LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../ diff --git a/ReactCommon/react/config/BUCK b/ReactCommon/react/config/BUCK index 3fec8b7c1d5d..1d81785820c4 100644 --- a/ReactCommon/react/config/BUCK +++ b/ReactCommon/react/config/BUCK @@ -18,6 +18,8 @@ rn_xplat_cxx_library( ], prefix = "react/config", ), + compiler_flags_enable_exceptions = True, + compiler_flags_enable_rtti = True, # for ReactNativeConfig fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), force_static = True, diff --git a/ReactCommon/react/config/ReactNativeConfig.cpp b/ReactCommon/react/config/ReactNativeConfig.cpp index 5bf8f145da26..abb33118d310 100644 --- a/ReactCommon/react/config/ReactNativeConfig.cpp +++ b/ReactCommon/react/config/ReactNativeConfig.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/config/ReactNativeConfig.h b/ReactCommon/react/config/ReactNativeConfig.h index 328dc54a3bfb..63a8f2fe4363 100644 --- a/ReactCommon/react/config/ReactNativeConfig.h +++ b/ReactCommon/react/config/ReactNativeConfig.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/debug/Android.mk b/ReactCommon/react/debug/Android.mk index 8dcbe4f224a8..fad744417a77 100644 --- a/ReactCommon/react/debug/Android.mk +++ b/ReactCommon/react/debug/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,6 +12,7 @@ LOCAL_MODULE := react_debug LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -24,8 +25,6 @@ LOCAL_CFLAGS := \ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall -llog -LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog - include $(BUILD_SHARED_LIBRARY) $(call import-module,folly) diff --git a/ReactCommon/react/debug/flags.h b/ReactCommon/react/debug/flags.h index dc09ab36d40a..62d1cc445746 100644 --- a/ReactCommon/react/debug/flags.h +++ b/ReactCommon/react/debug/flags.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/debug/react_native_assert.cpp b/ReactCommon/react/debug/react_native_assert.cpp index a72b91aecc61..abcdc5e8fbc0 100644 --- a/ReactCommon/react/debug/react_native_assert.cpp +++ b/ReactCommon/react/debug/react_native_assert.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,7 +22,7 @@ extern "C" void react_native_assert_fail( const char *file, int line, const char *expr) { - // Print as an error so it shows up in logcat before crash.... + // Print as an error so it shows up in logcat before crash... __android_log_print( ANDROID_LOG_ERROR, "ReactNative", @@ -31,9 +31,9 @@ extern "C" void react_native_assert_fail( line, func, expr); - // Print as a fatal so it crashes and shows up in uploaded logs - __android_log_print( - ANDROID_LOG_FATAL, + // ...and trigger an abort so it crashes and shows up in uploaded logs. + __android_log_assert( + nullptr, "ReactNative", "%s:%d: function %s: assertion failed (%s)", file, diff --git a/ReactCommon/react/debug/react_native_assert.h b/ReactCommon/react/debug/react_native_assert.h index fc3f97b7bbfc..014329c5a935 100644 --- a/ReactCommon/react/debug/react_native_assert.h +++ b/ReactCommon/react/debug/react_native_assert.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/Android.mk b/ReactCommon/react/nativemodule/core/Android.mk index bb2a0d79c774..3f097e17f1c3 100644 --- a/ReactCommon/react/nativemodule/core/Android.mk +++ b/ReactCommon/react/nativemodule/core/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,10 +12,16 @@ LOCAL_MODULE := react_nativemodule_core LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ $(LOCAL_PATH)/ReactCommon $(LOCAL_PATH)/platform/android/ReactCommon LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/ReactCommon/*.cpp) $(wildcard $(LOCAL_PATH)/platform/android/ReactCommon/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/platform/android/ -LOCAL_SHARED_LIBRARIES := libfbjni libfolly_json libreactnativejni libreact_debug libjsi +LOCAL_SHARED_LIBRARIES := \ + libfbjni \ + libfolly_json \ + libjsi \ + libreact_debug \ + libreactnativejni LOCAL_STATIC_LIBRARIES := libreactperflogger diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.cpp b/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.cpp index 40908d3c07ec..c449e7d180cc 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.cpp +++ b/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.h b/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.h index 5173b73d0162..332dccb16594 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.h +++ b/ReactCommon/react/nativemodule/core/ReactCommon/LongLivedObject.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp b/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp index 77dedb3665b6..f02345b294de 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.h b/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.h index e419553aa5f8..4df47aa8b734 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.h +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboCxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.cpp b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.cpp index f7045b3c89f5..fd6d501145ed 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.cpp +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h index 0772986a76ab..17acda2cf330 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp index 9c339edf36b9..61c21a076e95 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h index 87679af06bf2..148d4d24f078 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.cpp b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.cpp index a55e632ffca7..fc030ab94d69 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.cpp +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.h b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.h index 2f7fcf8c8b2d..e0b1b013f859 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.h +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModulePerfLogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.cpp b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.cpp index 871bff431ddf..cf9726aa020a 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.cpp +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h index 0dc08136a610..dd223f297291 100644 --- a/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h +++ b/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp b/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp index 18abcc3085b3..b427dcbfba02 100644 --- a/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +++ b/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h b/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h index 4c5975844763..47a682b24a61 100644 --- a/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h +++ b/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.h b/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.h index 38dbd2bee4b7..a4bbb8b6e6c9 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.h +++ b/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.mm b/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.mm index 54a856a25a76..c88429c67a8c 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.mm +++ b/ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.h b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.h index 1cc512c992c2..c143aceb5f32 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.h +++ b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm index c6e53547a65e..b4df4ba406b4 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm +++ b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.h b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.h index 2b9c47319401..8ac86f431c24 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.h +++ b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm index a63c805609de..67227a0a9305 100644 --- a/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm +++ b/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModuleManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -437,10 +437,15 @@ - (TurboModuleHolder *)_getOrCreateTurboModuleHolder:(const char *)moduleName __block id module = nil; if ([moduleClass conformsToProtocol:@protocol(RCTTurboModule)]) { + __weak __typeof(self) weakSelf = self; dispatch_block_t work = ^{ - module = [self _createAndSetUpRCTTurboModule:moduleClass - moduleName:moduleName - moduleId:moduleHolder->getModuleId()]; + auto strongSelf = weakSelf; + if (!strongSelf) { + return; + } + module = [strongSelf _createAndSetUpRCTTurboModule:moduleClass + moduleName:moduleName + moduleId:moduleHolder->getModuleId()]; }; if ([self _requiresMainQueueSetup:moduleClass]) { diff --git a/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.cpp b/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.cpp index a9267d59a530..d45de55ac6a8 100644 --- a/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.cpp +++ b/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.h b/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.h index 3255b45005c1..400ee7e3d692 100644 --- a/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.h +++ b/ReactCommon/react/nativemodule/samples/ReactCommon/NativeSampleTurboCxxModuleSpecJSI.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.cpp b/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.cpp index 5d56c59d7ece..a3d04f9438df 100644 --- a/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.cpp +++ b/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.h b/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.h index c1ebb682362c..5c41f71ae4f9 100644 --- a/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.h +++ b/ReactCommon/react/nativemodule/samples/ReactCommon/SampleTurboCxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/android/Android.mk b/ReactCommon/react/nativemodule/samples/platform/android/Android.mk index a000332e34c3..5c4458ec82a8 100644 --- a/ReactCommon/react/nativemodule/samples/platform/android/Android.mk +++ b/ReactCommon/react/nativemodule/samples/platform/android/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -9,8 +9,13 @@ include $(CLEAR_VARS) LOCAL_MODULE := sampleturbomodule LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/ReactCommon/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) -LOCAL_SHARED_LIBRARIES := libfbjni libreact_nativemodule_core libjsi +LOCAL_SHARED_LIBRARIES := \ + libfbjni \ + libjsi \ + libreact_nativemodule_core + LOCAL_CFLAGS := \ -DLOG_TAG=\"ReactNative\" LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall diff --git a/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java b/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java index f992e5d6ae1c..1dd66decb687 100644 --- a/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java +++ b/ReactCommon/react/nativemodule/samples/platform/android/NativeSampleTurboModuleSpec.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp b/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp index 676a79ee5e76..88070dad57ba 100644 --- a/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp +++ b/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.h b/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.h index 6baefae6d890..695cb8764a5e 100644 --- a/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.h +++ b/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java b/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java index f919eb5bd2dd..84a0f6dd0869 100644 --- a/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java +++ b/ReactCommon/react/nativemodule/samples/platform/android/SampleTurboModule.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.h b/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.h index b14289e1cd1b..ab91dbeaf893 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.h +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.mm b/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.mm index 7337f63d5181..d3edbda68132 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.mm +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTNativeSampleTurboModuleSpec.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.h b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.h index b39a9f8170af..318ba46aadfd 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.h +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.mm b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.mm index 8306c561744e..72162e1c656b 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.mm +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboCxxModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.h b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.h index 7f66c69c314e..76e080b0197e 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.h +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm index fc742b492fa6..11e57479cf6d 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm +++ b/ReactCommon/react/nativemodule/samples/platform/ios/RCTSampleTurboModule.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.cpp b/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.cpp index a66b01ef2c16..e46412e86b61 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.cpp +++ b/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.h b/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.h index a3aa44062f57..d09e688b2cdd 100644 --- a/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.h +++ b/ReactCommon/react/nativemodule/samples/platform/ios/SampleTurboCxxModuleLegacyImpl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/.clang-tidy b/ReactCommon/react/renderer/.clang-tidy index c98fd78ff64b..f413d1fc8587 100644 --- a/ReactCommon/react/renderer/.clang-tidy +++ b/ReactCommon/react/renderer/.clang-tidy @@ -1,5 +1,44 @@ --- +InheritParentConfig: true Checks: '> clang-diagnostic-*, +modernize-avoid-bind, +modernize-avoid-c-arrays, +modernize-deprecated-headers, +modernize-deprecated-ios-base-aliases, +modernize-loop-convert, +modernize-make-shared, +modernize-redundant-void-arg, +modernize-return-braced-init-list, +modernize-use-auto, +modernize-make-unique, +modernize-pass-by-value, +modernize-raw-string-literal, +modernize-replace-auto-ptr, +modernize-use-bool-literals, +modernize-replace-random-shuffle, +modernize-unary-static-assert, +modernize-use-emplace, +modernize-shrink-to-fit, +modernize-use-equals-default, +modernize-use-default-member-init, +modernize-use-nullptr, +modernize-use-noexcept, +modernize-use-equals-delete, +modernize-use-override, +modernize-use-using, +modernize-use-transparent-functors, +performance-faster-string-find, +performance-for-range-copy, +performance-implicit-conversion-in-loop, +performance-inefficient-algorithm, +performance-inefficient-string-concatenation, +performance-inefficient-vector-operation, +performance-move-const-arg, +performance-move-constructor-init, +performance-noexcept-move-constructor, +performance-type-promotion-in-math-fn, +performance-unnecessary-copy-initialization, +performance-unnecessary-value-param, ' ... diff --git a/ReactCommon/react/renderer/animations/Android.mk b/ReactCommon/react/renderer/animations/Android.mk index c637dbb0d600..8d1d931e1c9b 100644 --- a/ReactCommon/react/renderer/animations/Android.mk +++ b/ReactCommon/react/renderer/animations/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_animations LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,7 +22,23 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libreact_render_graphics libglog_init glog libruntimeexecutor libyoga librrc_view libreact_render_uimanager libfolly_futures libreact_render_componentregistry libreactconfig libfolly_json libjsi libreact_render_core libreact_render_debug libreact_render_mounting libreact_debug +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mounting \ + libreact_render_uimanager \ + libreact_config \ + librrc_view \ + libruntimeexecutor \ + libyoga include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationCallbackWrapper.h b/ReactCommon/react/renderer/animations/LayoutAnimationCallbackWrapper.h index 2b0b6c167b6b..f4e1ebf0ac41 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationCallbackWrapper.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationCallbackWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp index 8933bbe2c508..8ff9569a845e 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -47,10 +47,10 @@ void LayoutAnimationDriver::animationMutationsForFrame( : layoutAnimationConfig.updateConfig)); // Interpolate - std::pair progress = + auto progress = calculateAnimationProgress(now, animation, mutationConfig); - double animationTimeProgressLinear = progress.first; - double animationInterpolationFactor = progress.second; + auto animationTimeProgressLinear = progress.first; + auto animationInterpolationFactor = progress.second; auto mutatedShadowView = createInterpolatedShadowView( animationInterpolationFactor, baselineShadowView, finalShadowView); diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h index 428eb08ecad9..b495413042fa 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationDriver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp index 13e2f11155fe..dc815408e8c9 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ #include "LayoutAnimationKeyFrameManager.h" #include +#include #include #include @@ -85,8 +86,8 @@ void PrintMutationInstructionRelative( } #endif -static inline float -interpolateFloats(float coefficient, float oldValue, float newValue) { +static inline Float +interpolateFloats(Float coefficient, Float oldValue, Float newValue) { return oldValue + (newValue - oldValue) * coefficient; } @@ -96,7 +97,7 @@ LayoutAnimationKeyFrameManager::LayoutAnimationKeyFrameManager( RuntimeExecutor runtimeExecutor, ContextContainer::Shared &contextContainer, LayoutAnimationStatusDelegate *delegate) - : runtimeExecutor_(runtimeExecutor), + : runtimeExecutor_(std::move(runtimeExecutor)), contextContainer_(contextContainer), layoutAnimationStatusDelegate_(delegate), now_([]() { @@ -172,7 +173,7 @@ bool LayoutAnimationKeyFrameManager::shouldOverridePullTransaction() const { return shouldAnimateFrame(); } -better::optional +butter::optional LayoutAnimationKeyFrameManager::pullTransaction( SurfaceId surfaceId, MountingTransaction::Number transactionNumber, @@ -250,7 +251,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( surfaceId, mutations, conflictingAnimations); // Are we animating this list of mutations? - better::optional currentAnimation{}; + butter::optional currentAnimation{}; { std::lock_guard lock(currentAnimationMutex_); if (currentAnimation_) { @@ -271,9 +272,9 @@ LayoutAnimationKeyFrameManager::pullTransaction( // TODO: to prevent this step we could tag Remove/Insert mutations as // being moves on the Differ level, since we know that there? We could use // TinyMap here, but it's not exposed by Differentiator (yet). - better::set insertedTags; - better::set deletedTags; - better::set reparentedTags; // tags that are deleted and recreated + butter::set insertedTags; + butter::set deletedTags; + butter::set reparentedTags; // tags that are deleted and recreated std::unordered_map movedTags; for (const auto &mutation : mutations) { if (mutation.type == ShadowViewMutation::Type::Insert) { @@ -320,7 +321,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( continue; } - better::optional executeMutationImmediately{}; + butter::optional executeMutationImmediately{}; bool isRemoveReinserted = mutation.type == ShadowViewMutation::Type::Remove && @@ -1063,7 +1064,7 @@ LayoutAnimationKeyFrameManager::pullTransaction( void LayoutAnimationKeyFrameManager::uiManagerDidConfigureNextLayoutAnimation( LayoutAnimation layoutAnimation) const { - currentAnimation_ = better::optional{layoutAnimation}; + currentAnimation_ = butter::optional{layoutAnimation}; } void LayoutAnimationKeyFrameManager::setLayoutAnimationStatusDelegate( @@ -1074,7 +1075,7 @@ void LayoutAnimationKeyFrameManager::setLayoutAnimationStatusDelegate( void LayoutAnimationKeyFrameManager::setClockNow( std::function now) { - now_ = now; + now_ = std::move(now); } void LayoutAnimationKeyFrameManager::enableSkipInvalidatedKeyFrames() { @@ -1114,7 +1115,7 @@ LayoutAnimationKeyFrameManager::getComponentDescriptorForShadowView( } ShadowView LayoutAnimationKeyFrameManager::createInterpolatedShadowView( - double progress, + Float progress, ShadowView const &startingView, ShadowView const &finalView) const { react_native_assert(startingView.tag > 0); @@ -1308,7 +1309,7 @@ void LayoutAnimationKeyFrameManager:: // First, collect all final mutations that could impact this immediate // mutation. - std::vector candidateMutations{}; + std::vector candidateMutations{}; for (auto inflightAnimationIt = inflightAnimations_.rbegin() + (skipLastAnimation ? 1 : 0); @@ -1322,11 +1323,7 @@ void LayoutAnimationKeyFrameManager:: continue; } - for (auto it = inflightAnimation.keyFrames.begin(); - it != inflightAnimation.keyFrames.end(); - it++) { - auto &animatedKeyFrame = *it; - + for (auto const &animatedKeyFrame : inflightAnimation.keyFrames) { if (animatedKeyFrame.invalidated) { continue; } @@ -1337,7 +1334,8 @@ void LayoutAnimationKeyFrameManager:: continue; } - for (auto &delayedMutation : animatedKeyFrame.finalMutationsForKeyFrame) { + for (auto const &delayedMutation : + animatedKeyFrame.finalMutationsForKeyFrame) { if (delayedMutation.type != ShadowViewMutation::Type::Remove) { continue; } @@ -1375,7 +1373,7 @@ void LayoutAnimationKeyFrameManager:: candidateMutations.begin(), candidateMutations.end(), [&changed, &mutation, &adjustedDelta, &isRemoveMutation]( - ShadowViewMutation *candidateMutation) { + ShadowViewMutation const *candidateMutation) { bool indexConflicts = (candidateMutation->index < mutation.index || (isRemoveMutation && @@ -1430,11 +1428,7 @@ void LayoutAnimationKeyFrameManager::adjustDelayedMutationIndicesForMutation( continue; } - for (auto it = inflightAnimation.keyFrames.begin(); - it != inflightAnimation.keyFrames.end(); - it++) { - auto &animatedKeyFrame = *it; - + for (auto &animatedKeyFrame : inflightAnimation.keyFrames) { if (animatedKeyFrame.invalidated) { continue; } @@ -1616,7 +1610,7 @@ void LayoutAnimationKeyFrameManager::deleteAnimationsForStoppedSurfaces() // Execute stopSurface on any ongoing animations if (inflightAnimationsExistInitially) { - better::set surfaceIdsToStop{}; + butter::set surfaceIdsToStop{}; { std::lock_guard lock(surfaceIdsToStopMutex_); surfaceIdsToStop = surfaceIdsToStop_; diff --git a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h index 528fe052dad1..9998b3cc1473 100644 --- a/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h +++ b/ReactCommon/react/renderer/animations/LayoutAnimationKeyFrameManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,8 +8,8 @@ #pragma once #include -#include -#include +#include +#include #include #include #include @@ -67,7 +67,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, // This is used to "hijack" the diffing process to figure out which mutations // should be animated. The mutations returned by this function will be // executed immediately. - better::optional pullTransaction( + butter::optional pullTransaction( SurfaceId surfaceId, MountingTransaction::Number number, TransactionTelemetry const &telemetry, @@ -95,7 +95,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, protected: SharedComponentDescriptorRegistry componentDescriptorRegistry_; - mutable better::optional currentAnimation_{}; + mutable butter::optional currentAnimation_{}; mutable std::mutex currentAnimationMutex_; /** @@ -120,7 +120,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, * @return */ ShadowView createInterpolatedShadowView( - double progress, + Float progress, ShadowView const &startingView, ShadowView const &finalView) const; @@ -148,7 +148,7 @@ class LayoutAnimationKeyFrameManager : public UIManagerAnimationDelegate, mutable std::mutex layoutAnimationStatusDelegateMutex_; mutable LayoutAnimationStatusDelegate *layoutAnimationStatusDelegate_{}; mutable std::mutex surfaceIdsToStopMutex_; - mutable better::set surfaceIdsToStop_{}; + mutable butter::set surfaceIdsToStop_{}; bool skipInvalidatedKeyFrames_{false}; /* diff --git a/ReactCommon/react/renderer/animations/conversions.h b/ReactCommon/react/renderer/animations/conversions.h index 9fdb7a5e08a6..e9c3275e3d8d 100644 --- a/ReactCommon/react/renderer/animations/conversions.h +++ b/ReactCommon/react/renderer/animations/conversions.h @@ -1,11 +1,11 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ -#include +#include #include #include @@ -13,7 +13,7 @@ namespace facebook { namespace react { -static inline better::optional parseAnimationType( +static inline butter::optional parseAnimationType( std::string param) { if (param == "spring") { return AnimationType::Spring; @@ -38,7 +38,7 @@ static inline better::optional parseAnimationType( return {}; } -static inline better::optional parseAnimationProperty( +static inline butter::optional parseAnimationProperty( std::string param) { if (param == "opacity") { return AnimationProperty::Opacity; @@ -57,7 +57,7 @@ static inline better::optional parseAnimationProperty( return {}; } -static inline better::optional parseAnimationConfig( +static inline butter::optional parseAnimationConfig( folly::dynamic const &config, double defaultDuration, bool parsePropertyType) { @@ -115,8 +115,8 @@ static inline better::optional parseAnimationConfig( double duration = defaultDuration; double delay = 0; - double springDamping = 0.5; - double initialVelocity = 0; + Float springDamping = 0.5; + Float initialVelocity = 0; auto const durationIt = config.find("duration"); if (durationIt != config.items().end()) { @@ -144,7 +144,7 @@ static inline better::optional parseAnimationConfig( if (springDampingIt != config.items().end() && springDampingIt->second.isDouble()) { if (springDampingIt->second.isDouble()) { - springDamping = springDampingIt->second.asDouble(); + springDamping = (Float)springDampingIt->second.asDouble(); } else { LOG(ERROR) << "Error parsing animation config: field `springDamping` must be a number"; @@ -155,7 +155,7 @@ static inline better::optional parseAnimationConfig( auto const initialVelocityIt = config.find("initialVelocity"); if (initialVelocityIt != config.items().end()) { if (initialVelocityIt->second.isDouble()) { - initialVelocity = initialVelocityIt->second.asDouble(); + initialVelocity = (Float)initialVelocityIt->second.asDouble(); } else { LOG(ERROR) << "Error parsing animation config: field `initialVelocity` must be a number"; @@ -163,7 +163,7 @@ static inline better::optional parseAnimationConfig( } } - return better::optional(AnimationConfig{ + return butter::optional(AnimationConfig{ *animationType, animationProperty, duration, @@ -173,7 +173,7 @@ static inline better::optional parseAnimationConfig( } // Parse animation config from JS -static inline better::optional +static inline butter::optional parseLayoutAnimationConfig(folly::dynamic const &config) { if (config.empty() || !config.isObject()) { return {}; @@ -187,17 +187,17 @@ parseLayoutAnimationConfig(folly::dynamic const &config) { const auto createConfigIt = config.find("create"); const auto createConfig = createConfigIt == config.items().end() - ? better::optional(AnimationConfig{}) + ? butter::optional(AnimationConfig{}) : parseAnimationConfig(createConfigIt->second, duration, true); const auto updateConfigIt = config.find("update"); const auto updateConfig = updateConfigIt == config.items().end() - ? better::optional(AnimationConfig{}) + ? butter::optional(AnimationConfig{}) : parseAnimationConfig(updateConfigIt->second, duration, false); const auto deleteConfigIt = config.find("delete"); const auto deleteConfig = deleteConfigIt == config.items().end() - ? better::optional(AnimationConfig{}) + ? butter::optional(AnimationConfig{}) : parseAnimationConfig(deleteConfigIt->second, duration, true); if (!createConfig || !updateConfig || !deleteConfig) { diff --git a/ReactCommon/react/renderer/animations/primitives.h b/ReactCommon/react/renderer/animations/primitives.h index 757c72c466ba..91cd7e324901 100644 --- a/ReactCommon/react/renderer/animations/primitives.h +++ b/ReactCommon/react/renderer/animations/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,7 @@ #include #include +#include #include #include #include @@ -43,8 +44,8 @@ struct AnimationConfig { 0; // these are perhaps better represented as uint64_t, but they // come from JS as doubles double delay = 0; - double springDamping = 0; - double initialVelocity = 0; + Float springDamping = 0; + Float initialVelocity = 0; }; // This corresponds exactly with JS. diff --git a/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp b/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp index 33e72268f1f6..e5eef16ba078 100644 --- a/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp +++ b/ReactCommon/react/renderer/animations/tests/LayoutAnimationTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -65,7 +65,7 @@ static void testShadowNodeTreeLifeCycleLayoutAnimations( // Create a RuntimeExecutor RuntimeExecutor runtimeExecutor = - [](std::function fn) {}; + [](std::function const &) {}; // Create component descriptor registry for animation driver auto providerRegistry = diff --git a/ReactCommon/react/renderer/animations/utils.cpp b/ReactCommon/react/renderer/animations/utils.cpp index 4d12eeab969c..36b2307e0241 100644 --- a/ReactCommon/react/renderer/animations/utils.cpp +++ b/ReactCommon/react/renderer/animations/utils.cpp @@ -1,17 +1,17 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "utils.h" -#include +#include namespace facebook { namespace react { -std::pair calculateAnimationProgress( +std::pair calculateAnimationProgress( uint64_t now, LayoutAnimation const &animation, AnimationConfig const &mutationConfig) { @@ -20,8 +20,8 @@ std::pair calculateAnimationProgress( } uint64_t startTime = animation.startTime; - uint64_t delay = mutationConfig.delay; - uint64_t endTime = startTime + delay + mutationConfig.duration; + auto delay = (uint64_t)mutationConfig.delay; + uint64_t endTime = startTime + delay + (uint64_t)mutationConfig.duration; if (now >= endTime) { return {1, 1}; diff --git a/ReactCommon/react/renderer/animations/utils.h b/ReactCommon/react/renderer/animations/utils.h index 8654cea0a4ae..752025ae1376 100644 --- a/ReactCommon/react/renderer/animations/utils.h +++ b/ReactCommon/react/renderer/animations/utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ #pragma once #include +#include #include namespace facebook { @@ -71,7 +72,7 @@ static inline bool shouldFirstComeBeforeSecondMutation( return false; } -std::pair calculateAnimationProgress( +std::pair calculateAnimationProgress( uint64_t now, LayoutAnimation const &animation, AnimationConfig const &mutationConfig); diff --git a/ReactCommon/react/renderer/attributedstring/Android.mk b/ReactCommon/react/renderer/attributedstring/Android.mk index c693f05d16ff..ac7a97f7d0cc 100644 --- a/ReactCommon/react/renderer/attributedstring/Android.mk +++ b/ReactCommon/react/renderer/attributedstring/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_attributedstring LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,11 +22,24 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libbetter libreact_render_graphics libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug librrc_view libreact_utils libreact_debug libreact_render_mapbuffer +LOCAL_SHARED_LIBRARIES := \ + glog \ + libbutter \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mapbuffer \ + libreact_utils \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) -$(call import-module,better) +$(call import-module,butter) $(call import-module,glog) $(call import-module,folly) $(call import-module,fbgloginit) diff --git a/ReactCommon/react/renderer/attributedstring/AttributedString.cpp b/ReactCommon/react/renderer/attributedstring/AttributedString.cpp index e04c041dbd2f..d2139c3a5270 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedString.cpp +++ b/ReactCommon/react/renderer/attributedstring/AttributedString.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/attributedstring/AttributedString.h b/ReactCommon/react/renderer/attributedstring/AttributedString.h index a1058c510bb2..22e205d002e6 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedString.h +++ b/ReactCommon/react/renderer/attributedstring/AttributedString.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -56,7 +56,7 @@ class AttributedString : public Sealable, public DebugStringConvertible { int length{0}; }; - using Fragments = better::small_vector; + using Fragments = butter::small_vector; /* * Appends and prepends a `fragment` to the string. diff --git a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp index a73131c9f545..d644a5164d34 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp +++ b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,8 @@ #include +#include + namespace facebook { namespace react { @@ -22,9 +24,10 @@ AttributedStringBox::AttributedStringBox(AttributedString const &value) value_(std::make_shared(value)), opaquePointer_({}){}; -AttributedStringBox::AttributedStringBox( - std::shared_ptr const &opaquePointer) - : mode_(Mode::OpaquePointer), value_({}), opaquePointer_(opaquePointer) {} +AttributedStringBox::AttributedStringBox(std::shared_ptr opaquePointer) + : mode_(Mode::OpaquePointer), + value_({}), + opaquePointer_(std::move(opaquePointer)) {} AttributedStringBox::AttributedStringBox(AttributedStringBox &&other) noexcept : mode_(other.mode_), @@ -51,7 +54,7 @@ std::shared_ptr AttributedStringBox::getOpaquePointer() const { } AttributedStringBox &AttributedStringBox::operator=( - AttributedStringBox &&other) { + AttributedStringBox &&other) noexcept { if (this != &other) { mode_ = other.mode_; value_ = std::move(other.value_); diff --git a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h index b8bd96c9caeb..770386aef31a 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h +++ b/ReactCommon/react/renderer/attributedstring/AttributedStringBox.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,7 +35,7 @@ class AttributedStringBox final { * Custom explicit constructors. */ explicit AttributedStringBox(AttributedString const &value); - explicit AttributedStringBox(std::shared_ptr const &opaquePointer); + explicit AttributedStringBox(std::shared_ptr opaquePointer); /* * Movable, Copyable, Assignable. @@ -43,7 +43,7 @@ class AttributedStringBox final { AttributedStringBox(AttributedStringBox const &other) = default; AttributedStringBox(AttributedStringBox &&other) noexcept; AttributedStringBox &operator=(AttributedStringBox const &other) = default; - AttributedStringBox &operator=(AttributedStringBox &&other); + AttributedStringBox &operator=(AttributedStringBox &&other) noexcept; /* * Getters. diff --git a/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp index d5251fa907b9..773c8d6a38aa 100644 --- a/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp +++ b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h index 22f65af3ea4d..c71909b89ad1 100644 --- a/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h +++ b/ReactCommon/react/renderer/attributedstring/ParagraphAttributes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp b/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp index 9aaea5aec5a9..b947137be63e 100644 --- a/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -71,13 +71,9 @@ void TextAttributes::apply(TextAttributes textAttributes) { textDecorationLineType = textAttributes.textDecorationLineType.hasValue() ? textAttributes.textDecorationLineType : textDecorationLineType; - textDecorationLineStyle = textAttributes.textDecorationLineStyle.hasValue() - ? textAttributes.textDecorationLineStyle - : textDecorationLineStyle; - textDecorationLinePattern = - textAttributes.textDecorationLinePattern.hasValue() - ? textAttributes.textDecorationLinePattern - : textDecorationLinePattern; + textDecorationStyle = textAttributes.textDecorationStyle.hasValue() + ? textAttributes.textDecorationStyle + : textDecorationStyle; // Shadow textShadowOffset = textAttributes.textShadowOffset.hasValue() @@ -117,8 +113,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const { baseWritingDirection, textDecorationColor, textDecorationLineType, - textDecorationLineStyle, - textDecorationLinePattern, + textDecorationStyle, textShadowOffset, textShadowColor, isHighlighted, @@ -137,8 +132,7 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const { rhs.baseWritingDirection, rhs.textDecorationColor, rhs.textDecorationLineType, - rhs.textDecorationLineStyle, - rhs.textDecorationLinePattern, + rhs.textDecorationStyle, rhs.textShadowOffset, rhs.textShadowColor, rhs.isHighlighted, @@ -199,10 +193,7 @@ SharedDebugStringConvertibleList TextAttributes::getDebugProps() const { debugStringConvertibleItem("textDecorationColor", textDecorationColor), debugStringConvertibleItem( "textDecorationLineType", textDecorationLineType), - debugStringConvertibleItem( - "textDecorationLineStyle", textDecorationLineStyle), - debugStringConvertibleItem( - "textDecorationLinePattern", textDecorationLinePattern), + debugStringConvertibleItem("textDecorationStyle", textDecorationStyle), // Shadow debugStringConvertibleItem("textShadowOffset", textShadowOffset), diff --git a/ReactCommon/react/renderer/attributedstring/TextAttributes.h b/ReactCommon/react/renderer/attributedstring/TextAttributes.h index b7f07b962dae..8a86d01f3b6b 100644 --- a/ReactCommon/react/renderer/attributedstring/TextAttributes.h +++ b/ReactCommon/react/renderer/attributedstring/TextAttributes.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include #include @@ -46,39 +46,38 @@ class TextAttributes : public DebugStringConvertible { std::string fontFamily{""}; Float fontSize{std::numeric_limits::quiet_NaN()}; Float fontSizeMultiplier{std::numeric_limits::quiet_NaN()}; - better::optional fontWeight{}; - better::optional fontStyle{}; - better::optional fontVariant{}; - better::optional allowFontScaling{}; + butter::optional fontWeight{}; + butter::optional fontStyle{}; + butter::optional fontVariant{}; + butter::optional allowFontScaling{}; Float letterSpacing{std::numeric_limits::quiet_NaN()}; - better::optional textTransform{}; + butter::optional textTransform{}; // Paragraph Styles Float lineHeight{std::numeric_limits::quiet_NaN()}; - better::optional alignment{}; - better::optional baseWritingDirection{}; + butter::optional alignment{}; + butter::optional baseWritingDirection{}; // Decoration SharedColor textDecorationColor{}; - better::optional textDecorationLineType{}; - better::optional textDecorationLineStyle{}; - better::optional textDecorationLinePattern{}; + butter::optional textDecorationLineType{}; + butter::optional textDecorationStyle{}; // Shadow // TODO: Use `Point` type instead of `Size` for `textShadowOffset` attribute. - better::optional textShadowOffset{}; + butter::optional textShadowOffset{}; Float textShadowRadius{std::numeric_limits::quiet_NaN()}; SharedColor textShadowColor{}; // Special - better::optional isHighlighted{}; + butter::optional isHighlighted{}; // TODO T59221129: document where this value comes from and how it is set. // It's not clear if this is being used properly, or if it's being set at all. // Currently, it is intentionally *not* being set as part of BaseTextProps // construction. - better::optional layoutDirection{}; - better::optional accessibilityRole{}; + butter::optional layoutDirection{}; + butter::optional accessibilityRole{}; #pragma mark - Operations @@ -124,8 +123,7 @@ struct hash { textAttributes.baseWritingDirection, textAttributes.textDecorationColor, textAttributes.textDecorationLineType, - textAttributes.textDecorationLineStyle, - textAttributes.textDecorationLinePattern, + textAttributes.textDecorationStyle, textAttributes.textShadowOffset, textAttributes.textShadowRadius, textAttributes.textShadowColor, diff --git a/ReactCommon/react/renderer/attributedstring/conversions.h b/ReactCommon/react/renderer/attributedstring/conversions.h index 56ab6bdef943..24efffb2a602 100644 --- a/ReactCommon/react/renderer/attributedstring/conversions.h +++ b/ReactCommon/react/renderer/attributedstring/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -475,94 +475,45 @@ inline std::string toString( inline void fromRawValue( const PropsParserContext &context, const RawValue &value, - TextDecorationLineStyle &result) { - react_native_assert(value.hasType()); - if (value.hasType()) { - auto string = (std::string)value; - if (string == "single") { - result = TextDecorationLineStyle::Single; - } else if (string == "thick") { - result = TextDecorationLineStyle::Thick; - } else if (string == "double") { - result = TextDecorationLineStyle::Double; - } else { - LOG(ERROR) << "Unsupported TextDecorationLineStyle value: " << string; - react_native_assert(false); - // sane default for prod - result = TextDecorationLineStyle::Single; - } - return; - } - - LOG(ERROR) << "Unsupported TextDecorationLineStyle type"; - // sane default for prod - result = TextDecorationLineStyle::Single; -} - -inline std::string toString( - const TextDecorationLineStyle &textDecorationLineStyle) { - switch (textDecorationLineStyle) { - case TextDecorationLineStyle::Single: - return "single"; - case TextDecorationLineStyle::Thick: - return "thick"; - case TextDecorationLineStyle::Double: - return "double"; - } - - LOG(ERROR) << "Unsupported TextDecorationLineStyle value"; - react_native_assert(false); - // sane default for prod - return "single"; -} - -inline void fromRawValue( - const PropsParserContext &context, - const RawValue &value, - TextDecorationLinePattern &result) { + TextDecorationStyle &result) { react_native_assert(value.hasType()); if (value.hasType()) { auto string = (std::string)value; if (string == "solid") { - result = TextDecorationLinePattern::Solid; - } else if (string == "dot") { - result = TextDecorationLinePattern::Dot; - } else if (string == "dash") { - result = TextDecorationLinePattern::Dash; - } else if (string == "dash-dot") { - result = TextDecorationLinePattern::DashDot; - } else if (string == "dash-dot-dot") { - result = TextDecorationLinePattern::DashDotDot; + result = TextDecorationStyle::Solid; + } else if (string == "double") { + result = TextDecorationStyle::Double; + } else if (string == "dotted") { + result = TextDecorationStyle::Dotted; + } else if (string == "dashed") { + result = TextDecorationStyle::Dashed; } else { - LOG(ERROR) << "Unsupported TextDecorationLinePattern value: " << string; + LOG(ERROR) << "Unsupported TextDecorationStyle value: " << string; react_native_assert(false); // sane default for prod - result = TextDecorationLinePattern::Solid; + result = TextDecorationStyle::Solid; } return; } - LOG(ERROR) << "Unsupported TextDecorationLineStyle type"; + LOG(ERROR) << "Unsupported TextDecorationStyle type"; // sane default for prod - result = TextDecorationLinePattern::Solid; + result = TextDecorationStyle::Solid; } -inline std::string toString( - const TextDecorationLinePattern &textDecorationLinePattern) { - switch (textDecorationLinePattern) { - case TextDecorationLinePattern::Solid: +inline std::string toString(const TextDecorationStyle &textDecorationStyle) { + switch (textDecorationStyle) { + case TextDecorationStyle::Solid: return "solid"; - case TextDecorationLinePattern::Dot: - return "dot"; - case TextDecorationLinePattern::Dash: - return "dash"; - case TextDecorationLinePattern::DashDot: - return "dash-dot"; - case TextDecorationLinePattern::DashDotDot: - return "dash-dot-dot"; + case TextDecorationStyle::Double: + return "double"; + case TextDecorationStyle::Dotted: + return "dotted"; + case TextDecorationStyle::Dashed: + return "dashed"; } - LOG(ERROR) << "Unsupported TextDecorationLinePattern value"; + LOG(ERROR) << "Unsupported TextDecorationStyle value"; react_native_assert(false); // sane default for prod return "solid"; @@ -817,7 +768,7 @@ inline void fromRawValue( const PropsParserContext &context, RawValue const &value, AttributedString::Range &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto start = map.find("start"); if (start != map.end()) { @@ -931,15 +882,9 @@ inline folly::dynamic toDynamic(const TextAttributes &textAttributes) { _textAttributes( "textDecorationLine", toString(*textAttributes.textDecorationLineType)); } - if (textAttributes.textDecorationLineStyle.has_value()) { - _textAttributes( - "textDecorationLineStyle", - toString(*textAttributes.textDecorationLineStyle)); - } - if (textAttributes.textDecorationLinePattern.has_value()) { + if (textAttributes.textDecorationStyle.has_value()) { _textAttributes( - "textDecorationLinePattern", - toString(*textAttributes.textDecorationLinePattern)); + "textDecorationStyle", toString(*textAttributes.textDecorationStyle)); } // Shadow // textShadowOffset = textAttributes.textShadowOffset.has_value() ? @@ -1000,51 +945,50 @@ inline folly::dynamic toDynamic(AttributedString::Range const &range) { } // constants for AttributedString serialization -constexpr static Key AS_KEY_HASH = 0; -constexpr static Key AS_KEY_STRING = 1; -constexpr static Key AS_KEY_FRAGMENTS = 2; -constexpr static Key AS_KEY_CACHE_ID = 3; +constexpr static MapBuffer::Key AS_KEY_HASH = 0; +constexpr static MapBuffer::Key AS_KEY_STRING = 1; +constexpr static MapBuffer::Key AS_KEY_FRAGMENTS = 2; +constexpr static MapBuffer::Key AS_KEY_CACHE_ID = 3; // constants for Fragment serialization -constexpr static Key FR_KEY_STRING = 0; -constexpr static Key FR_KEY_REACT_TAG = 1; -constexpr static Key FR_KEY_IS_ATTACHMENT = 2; -constexpr static Key FR_KEY_WIDTH = 3; -constexpr static Key FR_KEY_HEIGHT = 4; -constexpr static Key FR_KEY_TEXT_ATTRIBUTES = 5; +constexpr static MapBuffer::Key FR_KEY_STRING = 0; +constexpr static MapBuffer::Key FR_KEY_REACT_TAG = 1; +constexpr static MapBuffer::Key FR_KEY_IS_ATTACHMENT = 2; +constexpr static MapBuffer::Key FR_KEY_WIDTH = 3; +constexpr static MapBuffer::Key FR_KEY_HEIGHT = 4; +constexpr static MapBuffer::Key FR_KEY_TEXT_ATTRIBUTES = 5; // constants for Text Attributes serialization -constexpr static Key TA_KEY_FOREGROUND_COLOR = 0; -constexpr static Key TA_KEY_BACKGROUND_COLOR = 1; -constexpr static Key TA_KEY_OPACITY = 2; -constexpr static Key TA_KEY_FONT_FAMILY = 3; -constexpr static Key TA_KEY_FONT_SIZE = 4; -constexpr static Key TA_KEY_FONT_SIZE_MULTIPLIER = 5; -constexpr static Key TA_KEY_FONT_WEIGHT = 6; -constexpr static Key TA_KEY_FONT_STYLE = 7; -constexpr static Key TA_KEY_FONT_VARIANT = 8; -constexpr static Key TA_KEY_ALLOW_FONT_SCALING = 9; -constexpr static Key TA_KEY_LETTER_SPACING = 10; -constexpr static Key TA_KEY_LINE_HEIGHT = 11; -constexpr static Key TA_KEY_ALIGNMENT = 12; -constexpr static Key TA_KEY_BEST_WRITING_DIRECTION = 13; -constexpr static Key TA_KEY_TEXT_DECORATION_COLOR = 14; -constexpr static Key TA_KEY_TEXT_DECORATION_LINE = 15; -constexpr static Key TA_KEY_TEXT_DECORATION_LINE_STYLE = 16; -constexpr static Key TA_KEY_TEXT_DECORATION_LINE_PATTERN = 17; -constexpr static Key TA_KEY_TEXT_SHADOW_RAIDUS = 18; -constexpr static Key TA_KEY_TEXT_SHADOW_COLOR = 19; -constexpr static Key TA_KEY_IS_HIGHLIGHTED = 20; -constexpr static Key TA_KEY_LAYOUT_DIRECTION = 21; -constexpr static Key TA_KEY_ACCESSIBILITY_ROLE = 22; +constexpr static MapBuffer::Key TA_KEY_FOREGROUND_COLOR = 0; +constexpr static MapBuffer::Key TA_KEY_BACKGROUND_COLOR = 1; +constexpr static MapBuffer::Key TA_KEY_OPACITY = 2; +constexpr static MapBuffer::Key TA_KEY_FONT_FAMILY = 3; +constexpr static MapBuffer::Key TA_KEY_FONT_SIZE = 4; +constexpr static MapBuffer::Key TA_KEY_FONT_SIZE_MULTIPLIER = 5; +constexpr static MapBuffer::Key TA_KEY_FONT_WEIGHT = 6; +constexpr static MapBuffer::Key TA_KEY_FONT_STYLE = 7; +constexpr static MapBuffer::Key TA_KEY_FONT_VARIANT = 8; +constexpr static MapBuffer::Key TA_KEY_ALLOW_FONT_SCALING = 9; +constexpr static MapBuffer::Key TA_KEY_LETTER_SPACING = 10; +constexpr static MapBuffer::Key TA_KEY_LINE_HEIGHT = 11; +constexpr static MapBuffer::Key TA_KEY_ALIGNMENT = 12; +constexpr static MapBuffer::Key TA_KEY_BEST_WRITING_DIRECTION = 13; +constexpr static MapBuffer::Key TA_KEY_TEXT_DECORATION_COLOR = 14; +constexpr static MapBuffer::Key TA_KEY_TEXT_DECORATION_LINE = 15; +constexpr static MapBuffer::Key TA_KEY_TEXT_DECORATION_STYLE = 16; +constexpr static MapBuffer::Key TA_KEY_TEXT_SHADOW_RAIDUS = 18; +constexpr static MapBuffer::Key TA_KEY_TEXT_SHADOW_COLOR = 19; +constexpr static MapBuffer::Key TA_KEY_IS_HIGHLIGHTED = 20; +constexpr static MapBuffer::Key TA_KEY_LAYOUT_DIRECTION = 21; +constexpr static MapBuffer::Key TA_KEY_ACCESSIBILITY_ROLE = 22; // constants for ParagraphAttributes serialization -constexpr static Key PA_KEY_MAX_NUMBER_OF_LINES = 0; -constexpr static Key PA_KEY_ELLIPSIZE_MODE = 1; -constexpr static Key PA_KEY_TEXT_BREAK_STRATEGY = 2; -constexpr static Key PA_KEY_ADJUST_FONT_SIZE_TO_FIT = 3; -constexpr static Key PA_KEY_INCLUDE_FONT_PADDING = 4; -constexpr static Key PA_KEY_HYPHENATION_FREQUENCY = 5; +constexpr static MapBuffer::Key PA_KEY_MAX_NUMBER_OF_LINES = 0; +constexpr static MapBuffer::Key PA_KEY_ELLIPSIZE_MODE = 1; +constexpr static MapBuffer::Key PA_KEY_TEXT_BREAK_STRATEGY = 2; +constexpr static MapBuffer::Key PA_KEY_ADJUST_FONT_SIZE_TO_FIT = 3; +constexpr static MapBuffer::Key PA_KEY_INCLUDE_FONT_PADDING = 4; +constexpr static MapBuffer::Key PA_KEY_HYPHENATION_FREQUENCY = 5; inline MapBuffer toMapBuffer(const ParagraphAttributes ¶graphAttributes) { auto builder = MapBufferBuilder(); @@ -1150,16 +1094,12 @@ inline MapBuffer toMapBuffer(const TextAttributes &textAttributes) { TA_KEY_TEXT_DECORATION_LINE, toString(*textAttributes.textDecorationLineType)); } - if (textAttributes.textDecorationLineStyle.has_value()) { - builder.putString( - TA_KEY_TEXT_DECORATION_LINE_STYLE, - toString(*textAttributes.textDecorationLineStyle)); - } - if (textAttributes.textDecorationLinePattern.has_value()) { + if (textAttributes.textDecorationStyle.has_value()) { builder.putString( - TA_KEY_TEXT_DECORATION_LINE_PATTERN, - toString(*textAttributes.textDecorationLinePattern)); + TA_KEY_TEXT_DECORATION_STYLE, + toString(*textAttributes.textDecorationStyle)); } + // Shadow if (!std::isnan(textAttributes.textShadowRadius)) { builder.putDouble( diff --git a/ReactCommon/react/renderer/attributedstring/primitives.h b/ReactCommon/react/renderer/attributedstring/primitives.h index d4be52366132..1535210aca2b 100644 --- a/ReactCommon/react/renderer/attributedstring/primitives.h +++ b/ReactCommon/react/renderer/attributedstring/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -81,15 +81,7 @@ enum class TextDecorationLineType { UnderlineStrikethrough }; -enum class TextDecorationLineStyle { Single, Thick, Double }; - -enum class TextDecorationLinePattern { - Solid, - Dot, - Dash, - DashDot, - DashDotDot, -}; +enum class TextDecorationStyle { Solid, Double, Dotted, Dashed }; enum class AccessibilityRole { None, @@ -176,15 +168,8 @@ struct hash { }; template <> -struct hash { - size_t operator()(const facebook::react::TextDecorationLinePattern &v) const { - return hash()(static_cast(v)); - } -}; - -template <> -struct hash { - size_t operator()(const facebook::react::TextDecorationLineStyle &v) const { +struct hash { + size_t operator()(const facebook::react::TextDecorationStyle &v) const { return hash()(static_cast(v)); } }; diff --git a/ReactCommon/react/renderer/attributedstring/tests/AttributedStringBoxTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/AttributedStringBoxTest.cpp index 493598b2c42c..e8c0047f987d 100644 --- a/ReactCommon/react/renderer/attributedstring/tests/AttributedStringBoxTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/AttributedStringBoxTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp index f0dff6685926..63991131325f 100644 --- a/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/AttributedStringTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp index 8b44e8b9fc2b..1019578e8c1b 100644 --- a/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/ParagraphAttributesTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp b/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp index 7fce2b9a7835..c753b00d67ac 100644 --- a/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp +++ b/ReactCommon/react/renderer/attributedstring/tests/TextAttributesTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/componentregistry/Android.mk b/ReactCommon/react/renderer/componentregistry/Android.mk index 06297c729805..0b89f14bcb00 100644 --- a/ReactCommon/react/renderer/componentregistry/Android.mk +++ b/ReactCommon/react/renderer/componentregistry/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,10 +12,19 @@ LOCAL_MODULE := react_render_componentregistry LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ -LOCAL_SHARED_LIBRARIES := libjsi libfolly_futures libfolly_json libreact_render_core libreact_render_debug libreact_utils libglog_init libreact_debug +LOCAL_SHARED_LIBRARIES := \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_utils LOCAL_CFLAGS := \ -DLOG_TAG=\"Fabric\" diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h index d152fb981bfb..5d1c8b022d38 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h index 99e91a8e9a7c..10f8e14cbb60 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp index 609316369d39..965c7d409fae 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ namespace react { void ComponentDescriptorProviderRegistry::add( ComponentDescriptorProvider provider) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); /* // TODO: T57583139 @@ -45,8 +45,9 @@ void ComponentDescriptorProviderRegistry::add( void ComponentDescriptorProviderRegistry::setComponentDescriptorProviderRequest( ComponentDescriptorProviderRequest componentDescriptorProviderRequest) const { - std::shared_lock lock(mutex_); - componentDescriptorProviderRequest_ = componentDescriptorProviderRequest; + std::shared_lock lock(mutex_); + componentDescriptorProviderRequest_ = + std::move(componentDescriptorProviderRequest); } void ComponentDescriptorProviderRegistry::request( @@ -54,7 +55,7 @@ void ComponentDescriptorProviderRegistry::request( ComponentDescriptorProviderRequest componentDescriptorProviderRequest; { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); componentDescriptorProviderRequest = componentDescriptorProviderRequest_; } @@ -66,7 +67,7 @@ void ComponentDescriptorProviderRegistry::request( ComponentDescriptorRegistry::Shared ComponentDescriptorProviderRegistry::createComponentDescriptorRegistry( ComponentDescriptorParameters const ¶meters) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto registry = std::make_shared( parameters, *this, parameters.contextContainer); diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h index c4d1982b0b07..182d24a7a8c7 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -59,10 +59,10 @@ class ComponentDescriptorProviderRegistry final { void request(ComponentName componentName) const; - mutable better::shared_mutex mutex_; + mutable butter::shared_mutex mutex_; mutable std::vector> componentDescriptorRegistries_; - mutable better::map + mutable butter::map componentDescriptorProviders_; mutable ComponentDescriptorProviderRequest componentDescriptorProviderRequest_; diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp index 137fb20cbbfe..408fb0a0d346 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,20 +14,22 @@ #include #include +#include + namespace facebook { namespace react { ComponentDescriptorRegistry::ComponentDescriptorRegistry( - ComponentDescriptorParameters const ¶meters, + ComponentDescriptorParameters parameters, ComponentDescriptorProviderRegistry const &providerRegistry, ContextContainer::Shared contextContainer) - : parameters_(parameters), + : parameters_(std::move(parameters)), providerRegistry_(providerRegistry), - contextContainer_(contextContainer) {} + contextContainer_(std::move(contextContainer)) {} void ComponentDescriptorRegistry::add( ComponentDescriptorProvider componentDescriptorProvider) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto componentDescriptor = componentDescriptorProvider.constructor( {parameters_.eventDispatcher, @@ -58,7 +60,7 @@ void ComponentDescriptorRegistry::registerComponentDescriptor( ComponentDescriptor const &ComponentDescriptorRegistry::at( std::string const &componentName) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto unifiedComponentName = componentNameByReactViewName(componentName); @@ -95,7 +97,7 @@ ComponentDescriptor const &ComponentDescriptorRegistry::at( ComponentDescriptor const *ComponentDescriptorRegistry:: findComponentDescriptorByHandle_DO_NOT_USE_THIS_IS_BROKEN( ComponentHandle componentHandle) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = _registryByHandle.find(componentHandle); if (iterator == _registryByHandle.end()) { @@ -107,14 +109,14 @@ ComponentDescriptor const *ComponentDescriptorRegistry:: ComponentDescriptor const &ComponentDescriptorRegistry::at( ComponentHandle componentHandle) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); return *_registryByHandle.at(componentHandle); } bool ComponentDescriptorRegistry::hasComponentDescriptorAt( ComponentHandle componentHandle) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = _registryByHandle.find(componentHandle); if (iterator == _registryByHandle.end()) { diff --git a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h index e23d41c14616..054af63c032b 100644 --- a/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h +++ b/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include #include #include @@ -37,7 +37,7 @@ class ComponentDescriptorRegistry { * be used later to create `ComponentDescriptor`s. */ ComponentDescriptorRegistry( - ComponentDescriptorParameters const ¶meters, + ComponentDescriptorParameters parameters, ComponentDescriptorProviderRegistry const &providerRegistry, ContextContainer::Shared contextContainer); @@ -80,10 +80,10 @@ class ComponentDescriptorRegistry { */ void add(ComponentDescriptorProvider componentDescriptorProvider) const; - mutable better::shared_mutex mutex_; - mutable better::map + mutable butter::shared_mutex mutex_; + mutable butter::map _registryByHandle; - mutable better::map _registryByName; + mutable butter::map _registryByName; ComponentDescriptor::Shared _fallbackComponentDescriptor; ComponentDescriptorParameters parameters_{}; ComponentDescriptorProviderRegistry const &providerRegistry_; diff --git a/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp b/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp index d703dcb549d9..1588f2e619d4 100644 --- a/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp +++ b/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h b/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h index 8408b2a2cadc..ab6b9c9fc4f8 100644 --- a/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h +++ b/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/componentregistry/native/Android.mk b/ReactCommon/react/renderer/componentregistry/native/Android.mk index f5674482f6bc..db5afed42905 100644 --- a/ReactCommon/react/renderer/componentregistry/native/Android.mk +++ b/ReactCommon/react/renderer/componentregistry/native/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,10 +12,19 @@ LOCAL_MODULE := rrc_native LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ -LOCAL_SHARED_LIBRARIES := libjsi libfolly_futures libfolly_json libreact_render_core libreact_render_debug libreact_utils libglog_init libreact_debug +LOCAL_SHARED_LIBRARIES := \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_utils LOCAL_CFLAGS := \ -DLOG_TAG=\"Fabric\" diff --git a/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.cpp b/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.cpp index 474877663049..b23525bddc78 100644 --- a/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.cpp +++ b/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.h b/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.h index 403b332342df..a728c23586e2 100644 --- a/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.h +++ b/ReactCommon/react/renderer/componentregistry/native/NativeComponentRegistryBinding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/Android.mk b/ReactCommon/react/renderer/components/image/Android.mk index 8c3fbcabda9c..6406c5847d77 100644 --- a/ReactCommon/react/renderer/components/image/Android.mk +++ b/ReactCommon/react/renderer/components/image/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_image LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,7 +22,19 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libjsi libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_render_imagemanager libreact_debug libreact_render_mapbuffer +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_imagemanager \ + libreact_render_mapbuffer \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h b/ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h index 39465a0fe610..69bc565ee2a2 100644 --- a/ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/image/ImageComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageEventEmitter.cpp b/ReactCommon/react/renderer/components/image/ImageEventEmitter.cpp index 20639e40bdcf..731a592ad920 100644 --- a/ReactCommon/react/renderer/components/image/ImageEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/image/ImageEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageEventEmitter.h b/ReactCommon/react/renderer/components/image/ImageEventEmitter.h index 13bc446ee9eb..d4fa125ea72f 100644 --- a/ReactCommon/react/renderer/components/image/ImageEventEmitter.h +++ b/ReactCommon/react/renderer/components/image/ImageEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageProps.cpp b/ReactCommon/react/renderer/components/image/ImageProps.cpp index b007b4869d45..37ca6e4208cf 100644 --- a/ReactCommon/react/renderer/components/image/ImageProps.cpp +++ b/ReactCommon/react/renderer/components/image/ImageProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageProps.h b/ReactCommon/react/renderer/components/image/ImageProps.h index b3d9ef36cf53..dd55bce09614 100644 --- a/ReactCommon/react/renderer/components/image/ImageProps.h +++ b/ReactCommon/react/renderer/components/image/ImageProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp b/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp index 64a1020e2e21..5edd7966c895 100644 --- a/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp +++ b/ReactCommon/react/renderer/components/image/ImageShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageShadowNode.h b/ReactCommon/react/renderer/components/image/ImageShadowNode.h index 0e60f78deef2..4376eda4a583 100644 --- a/ReactCommon/react/renderer/components/image/ImageShadowNode.h +++ b/ReactCommon/react/renderer/components/image/ImageShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageState.cpp b/ReactCommon/react/renderer/components/image/ImageState.cpp index d30d21680fb9..17b8261d71fc 100644 --- a/ReactCommon/react/renderer/components/image/ImageState.cpp +++ b/ReactCommon/react/renderer/components/image/ImageState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/ImageState.h b/ReactCommon/react/renderer/components/image/ImageState.h index 68cdcb681f4f..281d395658ff 100644 --- a/ReactCommon/react/renderer/components/image/ImageState.h +++ b/ReactCommon/react/renderer/components/image/ImageState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/image/conversions.h b/ReactCommon/react/renderer/components/image/conversions.h index 9449dfe773b2..4b4e3d9ca9d3 100644 --- a/ReactCommon/react/renderer/components/image/conversions.h +++ b/ReactCommon/react/renderer/components/image/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -30,8 +30,8 @@ inline void fromRawValue( return; } - if (value.hasType>()) { - auto items = (better::map)value; + if (value.hasType>()) { + auto items = (butter::map)value; result = {}; result.type = ImageSource::Type::Remote; diff --git a/ReactCommon/react/renderer/components/image/tests/ImageTest.cpp b/ReactCommon/react/renderer/components/image/tests/ImageTest.cpp index 9fc41d11a3f2..5a5ede8ee5d0 100644 --- a/ReactCommon/react/renderer/components/image/tests/ImageTest.cpp +++ b/ReactCommon/react/renderer/components/image/tests/ImageTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h index 7978f06330af..c579ba5d407c 100644 --- a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.cpp b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.cpp index dcc59dcb0205..d806054883e2 100644 --- a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.cpp +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h index d0afebc23ad1..595c23bc86f7 100644 --- a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h index 24fe19b4e5df..b58175240939 100644 --- a/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h +++ b/ReactCommon/react/renderer/components/inputaccessory/InputAccessoryState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h index 089e3ff40ccc..4838a88d0926 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm index 8c44bc246538..c988742089a4 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp index 53b8bf8f3522..e99f7c390b5f 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h index 5667ed003f00..da7b3691f748 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h index d416b0b23311..90b5cb8934fb 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm index 4ded11fa5993..85ce2b0b5ac4 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropState.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp index 78ead212c36a..39c0ec670432 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h index 8d0e0e29bb59..2a4abecfa9a6 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp index 4676a2c01e1b..36771139bd9e 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h index b2645cd7de2d..fa684aab402e 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropViewProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h index ca84249cae99..2062f42a2433 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm index 60ac9786f659..cfa480f5067d 100644 --- a/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +++ b/ReactCommon/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/modal/Android.mk b/ReactCommon/react/renderer/components/modal/Android.mk index cd0a046e7320..5f841fac916a 100644 --- a/ReactCommon/react/renderer/components/modal/Android.mk +++ b/ReactCommon/react/renderer/components/modal/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_modal LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,9 +22,23 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_image libreact_render_uimanager libreact_render_imagemanager librrc_view libreact_render_componentregistry libreact_codegen_rncore libreact_render_mapbuffer - -include $(BUILD_SHARED_LIBRARY) +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_json \ + libglog_init \ + libreact_codegen_rncore \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_imagemanager \ + libreact_render_mapbuffer \ + libreact_render_uimanager \ + librrc_image \ + librrc_view \ + libyoga + +include $(BUILD_STATIC_LIBRARY) $(call import-module,glog) $(call import-module,folly) diff --git a/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h b/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h index c1130183ad14..e3e504160adf 100644 --- a/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp index fffaf8047e9e..bdf59f88ca15 100644 --- a/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h index ad02fd26aafd..054074229b76 100644 --- a/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp b/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp index 2650613a75c5..1105a3883eb3 100644 --- a/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/modal/ModalHostViewState.h b/ReactCommon/react/renderer/components/modal/ModalHostViewState.h index b0921864ba77..de9b9537fe65 100644 --- a/ReactCommon/react/renderer/components/modal/ModalHostViewState.h +++ b/ReactCommon/react/renderer/components/modal/ModalHostViewState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/progressbar/Android.mk b/ReactCommon/react/renderer/components/progressbar/Android.mk index b899b97badae..e5a8fb6e8903 100644 --- a/ReactCommon/react/renderer/components/progressbar/Android.mk +++ b/ReactCommon/react/renderer/components/progressbar/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_progressbar LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/android/react/renderer/components/progressbar/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/android/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/android/ @@ -21,9 +22,24 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libfbjni libreact_codegen_rncore libreactnativeutilsjni libreact_render_componentregistry libreact_render_uimanager libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_debug - -include $(BUILD_SHARED_LIBRARY) +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libreact_codegen_rncore \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_uimanager \ + libreactnativejni \ + librrc_view \ + libyoga + +include $(BUILD_STATIC_LIBRARY) $(call import-module,fbjni) $(call import-module,folly) diff --git a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarComponentDescriptor.h b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarComponentDescriptor.h index 9e012b91cc56..cd8ea2235156 100644 --- a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp index 9e4c2fdbe92a..71ce1f60798a 100644 --- a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp +++ b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,7 +18,7 @@ namespace react { Size AndroidProgressBarMeasurementsManager::measure( SurfaceId surfaceId, - AndroidProgressBarProps props, + AndroidProgressBarProps const &props, LayoutConstraints layoutConstraints) const { { std::lock_guard lock(mutex_); diff --git a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.h b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.h index c2eb8191f772..7755ed371619 100644 --- a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,7 +24,7 @@ class AndroidProgressBarMeasurementsManager { Size measure( SurfaceId surfaceId, - AndroidProgressBarProps props, + AndroidProgressBarProps const &props, LayoutConstraints layoutConstraints) const; private: diff --git a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.cpp b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.cpp index 0ab3970a71fd..3d7c97a4a03b 100644 --- a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.cpp +++ b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.h b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.h index e13f547eb663..65d0de57cdbe 100644 --- a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.h +++ b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/AndroidProgressBarShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/conversions.h b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/conversions.h index cb70dc61169f..7f7ee33e543b 100644 --- a/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/conversions.h +++ b/ReactCommon/react/renderer/components/progressbar/android/react/renderer/components/progressbar/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/root/Android.mk b/ReactCommon/react/renderer/components/root/Android.mk index 8149fe3f02fd..448327b88cf0 100644 --- a/ReactCommon/react/renderer/components/root/Android.mk +++ b/ReactCommon/react/renderer/components/root/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_root LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,7 +22,17 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_debug +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/components/root/RootComponentDescriptor.h b/ReactCommon/react/renderer/components/root/RootComponentDescriptor.h index 7d8cb7b2b277..c031b7eeb351 100644 --- a/ReactCommon/react/renderer/components/root/RootComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/root/RootComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/root/RootProps.cpp b/ReactCommon/react/renderer/components/root/RootProps.cpp index 3e14c8a73ad0..47013f3c14e4 100644 --- a/ReactCommon/react/renderer/components/root/RootProps.cpp +++ b/ReactCommon/react/renderer/components/root/RootProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/root/RootProps.h b/ReactCommon/react/renderer/components/root/RootProps.h index d28f02837b93..6ba7952c495b 100644 --- a/ReactCommon/react/renderer/components/root/RootProps.h +++ b/ReactCommon/react/renderer/components/root/RootProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/root/RootShadowNode.cpp b/ReactCommon/react/renderer/components/root/RootShadowNode.cpp index 5e611de8d614..20380d422887 100644 --- a/ReactCommon/react/renderer/components/root/RootShadowNode.cpp +++ b/ReactCommon/react/renderer/components/root/RootShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/root/RootShadowNode.h b/ReactCommon/react/renderer/components/root/RootShadowNode.h index 8d88ec913389..aa6a5f8343d5 100644 --- a/ReactCommon/react/renderer/components/root/RootShadowNode.h +++ b/ReactCommon/react/renderer/components/root/RootShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp b/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp index 66d67ee817ca..659ce017f081 100644 --- a/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/components/root/tests/RootShadowNodeTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h index ad10ca8b125e..de0dcb4a9057 100644 --- a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.cpp b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.cpp index a04bea2e5e6e..e4b821d31411 100644 --- a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h index 2a27f0ef227c..c4b312d90aa1 100644 --- a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.cpp b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.cpp index 8824fbb15d71..2238b0793d85 100644 --- a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.cpp +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h index f64b1bb275b6..a2d272b8c6e0 100644 --- a/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h +++ b/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/Android.mk b/ReactCommon/react/renderer/components/scrollview/Android.mk index 9b02ae73f042..aea0a3effb80 100644 --- a/ReactCommon/react/renderer/components/scrollview/Android.mk +++ b/ReactCommon/react/renderer/components/scrollview/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_scrollview LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,9 +22,21 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libjsi libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_debug libreact_render_mapbuffer - -include $(BUILD_SHARED_LIBRARY) +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mapbuffer \ + librrc_view \ + libyoga + +include $(BUILD_STATIC_LIBRARY) $(call import-module,glog) $(call import-module,folly) diff --git a/ReactCommon/react/renderer/components/scrollview/RCTComponentViewHelpers.h b/ReactCommon/react/renderer/components/scrollview/RCTComponentViewHelpers.h index 0fab3ae8160e..d1cdcfc99554 100644 --- a/ReactCommon/react/renderer/components/scrollview/RCTComponentViewHelpers.h +++ b/ReactCommon/react/renderer/components/scrollview/RCTComponentViewHelpers.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h index 43b74b08dc33..3f6dd76720bf 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp index a44150d2183f..10810ad2ea3c 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h index 722731fdbbce..ca15a26940cd 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp index 5ac1187937b2..81fc68770845 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h index 2e83cb16a19f..a3157f828699 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp index 09c860740f32..41ddcdb4175f 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h index f4d4a5f964bb..c34367e8c55b 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewState.cpp b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.cpp index 6f368957a6e8..4bbfaa4a3e5c 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewState.cpp +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h index 6d3dd7e63252..d0846baecc6f 100644 --- a/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h +++ b/ReactCommon/react/renderer/components/scrollview/ScrollViewState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/conversions.h b/ReactCommon/react/renderer/components/scrollview/conversions.h index 710bd8f3b07d..4605f08ea203 100644 --- a/ReactCommon/react/renderer/components/scrollview/conversions.h +++ b/ReactCommon/react/renderer/components/scrollview/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/primitives.h b/ReactCommon/react/renderer/components/scrollview/primitives.h index 03cfd90c6ff0..fe8a60e21d7c 100644 --- a/ReactCommon/react/renderer/components/scrollview/primitives.h +++ b/ReactCommon/react/renderer/components/scrollview/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp b/ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp index 87313e585e48..1b64ed7ac06c 100644 --- a/ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp +++ b/ReactCommon/react/renderer/components/scrollview/tests/ScrollViewTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/Android.mk b/ReactCommon/react/renderer/components/slider/Android.mk index 101ed6ee564c..7919a68b3162 100644 --- a/ReactCommon/react/renderer/components/slider/Android.mk +++ b/ReactCommon/react/renderer/components/slider/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_slider LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/platform/android/react/renderer/components/slider/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ $(LOCAL_PATH)/platform/android/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ $(LOCAL_PATH)/platform/android/ @@ -21,9 +22,27 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libfbjni libreact_codegen_rncore libreact_render_imagemanager libreactnativeutilsjni libreact_render_componentregistry libreact_render_uimanager librrc_image libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_debug libreact_render_mapbuffer - -include $(BUILD_SHARED_LIBRARY) +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libreact_codegen_rncore \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_imagemanager \ + libreact_render_mapbuffer \ + libreact_render_uimanager \ + libreactnativejni \ + librrc_image \ + librrc_view \ + libyoga + +include $(BUILD_STATIC_LIBRARY) $(call import-module,fbjni) $(call import-module,folly) diff --git a/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h b/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h index c167f68fa48c..8a4d592c3ff0 100644 --- a/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/slider/SliderComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp b/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp index 15803f26f3de..094389801734 100644 --- a/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp +++ b/ReactCommon/react/renderer/components/slider/SliderShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/SliderShadowNode.h b/ReactCommon/react/renderer/components/slider/SliderShadowNode.h index ebd2eca04836..b1aa0dc9c5fc 100644 --- a/ReactCommon/react/renderer/components/slider/SliderShadowNode.h +++ b/ReactCommon/react/renderer/components/slider/SliderShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/SliderState.cpp b/ReactCommon/react/renderer/components/slider/SliderState.cpp index 348d372d9a29..c27e7139cd05 100644 --- a/ReactCommon/react/renderer/components/slider/SliderState.cpp +++ b/ReactCommon/react/renderer/components/slider/SliderState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/SliderState.h b/ReactCommon/react/renderer/components/slider/SliderState.h index 82a338c08f24..7984a657088a 100644 --- a/ReactCommon/react/renderer/components/slider/SliderState.h +++ b/ReactCommon/react/renderer/components/slider/SliderState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.cpp b/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.cpp index 24bc977fbad7..07119bd68a31 100644 --- a/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.cpp +++ b/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.h b/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.h index 19ba0c4f7de2..a8234ae6aea3 100644 --- a/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/slider/platform/android/react/renderer/components/slider/SliderMeasurementsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp index d23aff739c7a..773d3f7bbeec 100644 --- a/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp +++ b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h index f78ff2bb2704..067deeadff5b 100644 --- a/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/slider/platform/ios/SliderMeasurementsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp b/ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp index ea1923f56658..5bb020e65b71 100644 --- a/ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp +++ b/ReactCommon/react/renderer/components/slider/tests/SliderTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/switch/Android.mk b/ReactCommon/react/renderer/components/switch/Android.mk index ec7b041a63e2..5dfe9e966bb3 100644 --- a/ReactCommon/react/renderer/components/switch/Android.mk +++ b/ReactCommon/react/renderer/components/switch/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_switch LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/androidswitch/react/renderer/components/androidswitch/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/androidswitch/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/androidswitch/ @@ -21,9 +22,24 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libfbjni libreact_codegen_rncore libreactnativeutilsjni libreact_render_componentregistry libreact_render_uimanager libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_debug - -include $(BUILD_SHARED_LIBRARY) +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libreact_codegen_rncore \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_uimanager \ + libreactnativejni \ + librrc_view \ + libyoga + +include $(BUILD_STATIC_LIBRARY) $(call import-module,fbjni) $(call import-module,folly) diff --git a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchComponentDescriptor.h b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchComponentDescriptor.h index b253baf17183..aefde23b9c9a 100644 --- a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.cpp b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.cpp index 1d8d53e9c16d..7a683eecc032 100644 --- a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.cpp +++ b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.h b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.h index 1d7672df504e..ebf7eaea64c4 100644 --- a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.h +++ b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchMeasurementsManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.cpp b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.cpp index 53667c313a3b..4dca3fbda46d 100644 --- a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.cpp +++ b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.h b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.h index f002902dd644..4b9904441477 100644 --- a/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.h +++ b/ReactCommon/react/renderer/components/switch/androidswitch/react/renderer/components/androidswitch/AndroidSwitchShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/Android.mk b/ReactCommon/react/renderer/components/text/Android.mk index 33bfdb78a963..351484d0f428 100644 --- a/ReactCommon/react/renderer/components/text/Android.mk +++ b/ReactCommon/react/renderer/components/text/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_text LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,7 +22,23 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libjsi libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics libreact_render_uimanager libreact_render_textlayoutmanager libreact_render_attributedstring libreact_render_mounting librrc_view libreact_utils libreact_debug libreact_render_mapbuffer +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_attributedstring \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mapbuffer \ + libreact_render_mounting \ + libreact_render_textlayoutmanager \ + libreact_render_uimanager \ + libreact_utils \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/components/text/BaseTextProps.cpp b/ReactCommon/react/renderer/components/text/BaseTextProps.cpp index d8079cf4b812..af7d0734ff5e 100644 --- a/ReactCommon/react/renderer/components/text/BaseTextProps.cpp +++ b/ReactCommon/react/renderer/components/text/BaseTextProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,10 +16,10 @@ namespace facebook { namespace react { static TextAttributes convertRawProp( - const PropsParserContext &context, - const RawProps &rawProps, - const TextAttributes sourceTextAttributes, - const TextAttributes defaultTextAttributes) { + PropsParserContext const &context, + RawProps const &rawProps, + TextAttributes const &sourceTextAttributes, + TextAttributes const &defaultTextAttributes) { auto textAttributes = TextAttributes{}; // Color @@ -131,18 +131,12 @@ static TextAttributes convertRawProp( "textDecorationLine", sourceTextAttributes.textDecorationLineType, defaultTextAttributes.textDecorationLineType); - textAttributes.textDecorationLineStyle = convertRawProp( - context, - rawProps, - "textDecorationLineStyle", - sourceTextAttributes.textDecorationLineStyle, - defaultTextAttributes.textDecorationLineStyle); - textAttributes.textDecorationLinePattern = convertRawProp( + textAttributes.textDecorationStyle = convertRawProp( context, rawProps, - "textDecorationLinePattern", - sourceTextAttributes.textDecorationLinePattern, - defaultTextAttributes.textDecorationLinePattern); + "textDecorationStyle", + sourceTextAttributes.textDecorationStyle, + defaultTextAttributes.textDecorationStyle); // Shadow textAttributes.textShadowOffset = convertRawProp( diff --git a/ReactCommon/react/renderer/components/text/BaseTextProps.h b/ReactCommon/react/renderer/components/text/BaseTextProps.h index c20d07b6c3e2..dea10226dd6c 100644 --- a/ReactCommon/react/renderer/components/text/BaseTextProps.h +++ b/ReactCommon/react/renderer/components/text/BaseTextProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp b/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp index a68e2dca773c..054bdeb14fbe 100644 --- a/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/BaseTextShadowNode.h b/ReactCommon/react/renderer/components/text/BaseTextShadowNode.h index 49d8733645c8..17a29b1e769d 100644 --- a/ReactCommon/react/renderer/components/text/BaseTextShadowNode.h +++ b/ReactCommon/react/renderer/components/text/BaseTextShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h b/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h index 0801a07b8d12..2909ebbc57a4 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/text/ParagraphComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -41,7 +41,7 @@ class ParagraphComponentDescriptor final } private: - SharedTextLayoutManager textLayoutManager_; + std::shared_ptr textLayoutManager_; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.cpp b/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.cpp index ee16f5d02655..3ea125167594 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.h b/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.h index 597ef6baa2dd..c7e306d75edc 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.h +++ b/ReactCommon/react/renderer/components/text/ParagraphEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/ParagraphProps.cpp b/ReactCommon/react/renderer/components/text/ParagraphProps.cpp index 632da3bdcd1a..73de56443cd8 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphProps.cpp +++ b/ReactCommon/react/renderer/components/text/ParagraphProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/ParagraphProps.h b/ReactCommon/react/renderer/components/text/ParagraphProps.h index a82bbb8eb4bd..20a5f9edf4a1 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphProps.h +++ b/ReactCommon/react/renderer/components/text/ParagraphProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp index 46f409878416..7c42ae7672e1 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -93,9 +93,9 @@ Content ParagraphShadowNode::getContentWithMeasuredAttachments( } void ParagraphShadowNode::setTextLayoutManager( - SharedTextLayoutManager textLayoutManager) { + std::shared_ptr textLayoutManager) { ensureUnsealed(); - textLayoutManager_ = textLayoutManager; + textLayoutManager_ = std::move(textLayoutManager); } void ParagraphShadowNode::updateStateIfNeeded(Content const &content) { diff --git a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h index 5bd8c1b1085c..e4db0f76b34d 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h +++ b/ReactCommon/react/renderer/components/text/ParagraphShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -57,7 +57,8 @@ class ParagraphShadowNode final : public ConcreteViewShadowNode< * `ParagraphShadowNode` uses the manager to measure text content * and construct `ParagraphState` objects. */ - void setTextLayoutManager(SharedTextLayoutManager textLayoutManager); + void setTextLayoutManager( + std::shared_ptr textLayoutManager); #pragma mark - LayoutableShadowNode @@ -96,12 +97,12 @@ class ParagraphShadowNode final : public ConcreteViewShadowNode< */ void updateStateIfNeeded(Content const &content); - SharedTextLayoutManager textLayoutManager_; + std::shared_ptr textLayoutManager_; /* * Cached content of the subtree started from the node. */ - mutable better::optional content_{}; + mutable butter::optional content_{}; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/text/ParagraphState.cpp b/ReactCommon/react/renderer/components/text/ParagraphState.cpp index 5c15d2a31e64..aa5ca1a8b393 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphState.cpp +++ b/ReactCommon/react/renderer/components/text/ParagraphState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/ParagraphState.h b/ReactCommon/react/renderer/components/text/ParagraphState.h index d4e80fda9cd7..76dcbcf1cee0 100644 --- a/ReactCommon/react/renderer/components/text/ParagraphState.h +++ b/ReactCommon/react/renderer/components/text/ParagraphState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/RawTextComponentDescriptor.h b/ReactCommon/react/renderer/components/text/RawTextComponentDescriptor.h index 5a437ec89612..163bdb5c6007 100644 --- a/ReactCommon/react/renderer/components/text/RawTextComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/text/RawTextComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/RawTextProps.cpp b/ReactCommon/react/renderer/components/text/RawTextProps.cpp index 3660824907f0..40e49859d29a 100644 --- a/ReactCommon/react/renderer/components/text/RawTextProps.cpp +++ b/ReactCommon/react/renderer/components/text/RawTextProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/RawTextProps.h b/ReactCommon/react/renderer/components/text/RawTextProps.h index 2516e99b1c49..7d448b374db0 100644 --- a/ReactCommon/react/renderer/components/text/RawTextProps.h +++ b/ReactCommon/react/renderer/components/text/RawTextProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/RawTextShadowNode.cpp b/ReactCommon/react/renderer/components/text/RawTextShadowNode.cpp index 13a15e29f693..55ee95cc2a85 100644 --- a/ReactCommon/react/renderer/components/text/RawTextShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/RawTextShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/RawTextShadowNode.h b/ReactCommon/react/renderer/components/text/RawTextShadowNode.h index 8dbde86c996e..11cda5609188 100644 --- a/ReactCommon/react/renderer/components/text/RawTextShadowNode.h +++ b/ReactCommon/react/renderer/components/text/RawTextShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/TextComponentDescriptor.h b/ReactCommon/react/renderer/components/text/TextComponentDescriptor.h index 12e6b54512e1..85612690049e 100644 --- a/ReactCommon/react/renderer/components/text/TextComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/text/TextComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/TextProps.cpp b/ReactCommon/react/renderer/components/text/TextProps.cpp index 8e4bc4b0a6e9..e2d9ac541680 100644 --- a/ReactCommon/react/renderer/components/text/TextProps.cpp +++ b/ReactCommon/react/renderer/components/text/TextProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/TextProps.h b/ReactCommon/react/renderer/components/text/TextProps.h index 9903b05e0d71..64eb66c6af0b 100644 --- a/ReactCommon/react/renderer/components/text/TextProps.h +++ b/ReactCommon/react/renderer/components/text/TextProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/TextShadowNode.cpp b/ReactCommon/react/renderer/components/text/TextShadowNode.cpp index 3ae356c491c4..561ddcb9475e 100644 --- a/ReactCommon/react/renderer/components/text/TextShadowNode.cpp +++ b/ReactCommon/react/renderer/components/text/TextShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/TextShadowNode.h b/ReactCommon/react/renderer/components/text/TextShadowNode.h index 57e3f25076ba..cefad9061513 100644 --- a/ReactCommon/react/renderer/components/text/TextShadowNode.h +++ b/ReactCommon/react/renderer/components/text/TextShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/conversions.h b/ReactCommon/react/renderer/components/text/conversions.h index 8ea5baeddb79..712b8f2fde23 100644 --- a/ReactCommon/react/renderer/components/text/conversions.h +++ b/ReactCommon/react/renderer/components/text/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,11 +27,11 @@ inline folly::dynamic toDynamic(ParagraphState const ¶graphState) { } // constants for Text State serialization -constexpr static Key TX_STATE_KEY_ATTRIBUTED_STRING = 0; -constexpr static Key TX_STATE_KEY_PARAGRAPH_ATTRIBUTES = 1; +constexpr static MapBuffer::Key TX_STATE_KEY_ATTRIBUTED_STRING = 0; +constexpr static MapBuffer::Key TX_STATE_KEY_PARAGRAPH_ATTRIBUTES = 1; // Used for TextInput -constexpr static Key TX_STATE_KEY_HASH = 2; -constexpr static Key TX_STATE_KEY_MOST_RECENT_EVENT_COUNT = 3; +constexpr static MapBuffer::Key TX_STATE_KEY_HASH = 2; +constexpr static MapBuffer::Key TX_STATE_KEY_MOST_RECENT_EVENT_COUNT = 3; inline MapBuffer toMapBuffer(ParagraphState const ¶graphState) { auto builder = MapBufferBuilder(); diff --git a/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp b/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp index f38bfe8de4f8..1c09c5d052bf 100644 --- a/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp +++ b/ReactCommon/react/renderer/components/text/tests/ParagraphLocalDataTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/text/tests/TextTest.cpp b/ReactCommon/react/renderer/components/text/tests/TextTest.cpp index 5debe8f34f10..296fc9a53a88 100644 --- a/ReactCommon/react/renderer/components/text/tests/TextTest.cpp +++ b/ReactCommon/react/renderer/components/text/tests/TextTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/textinput/Android.mk b/ReactCommon/react/renderer/components/textinput/Android.mk index c45affab7b9b..42c966af8ca5 100644 --- a/ReactCommon/react/renderer/components/textinput/Android.mk +++ b/ReactCommon/react/renderer/components/textinput/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_textinput LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/androidtextinput/react/renderer/components/androidtextinput/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/androidtextinput/react/renderer/components/androidtextinput/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/androidtextinput/ @@ -21,9 +22,29 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libjsi libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_mounting libreact_render_componentregistry libreact_render_debug libreact_render_graphics libreact_render_uimanager libreact_render_imagemanager libreact_render_textlayoutmanager libreact_render_attributedstring librrc_text librrc_image librrc_view libreact_utils libreact_debug libreact_render_mapbuffer +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_attributedstring \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_imagemanager \ + libreact_render_mapbuffer \ + libreact_render_mounting \ + libreact_render_textlayoutmanager \ + libreact_render_uimanager \ + libreact_utils \ + librrc_image \ + librrc_text \ + librrc_view \ + libyoga -include $(BUILD_SHARED_LIBRARY) +include $(BUILD_STATIC_LIBRARY) $(call import-module,glog) $(call import-module,folly) diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h index 1728de336a8e..60c14908786e 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -180,7 +180,7 @@ class AndroidTextInputComponentDescriptor final "com/facebook/react/fabric/FabricUIManager"; SharedTextLayoutManager textLayoutManager_; - mutable better::map surfaceIdToThemePaddingMap_; + mutable butter::map surfaceIdToThemePaddingMap_; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.cpp deleted file mode 100644 index 56fdc264a27e..000000000000 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#include "AndroidTextInputEventEmitter.h" - -namespace facebook { -namespace react { - -void AndroidTextInputEventEmitter::onBlur( - AndroidTextInputOnBlurStruct event) const { - dispatchEvent("blur", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - return payload; - }); -} -void AndroidTextInputEventEmitter::onFocus( - AndroidTextInputOnFocusStruct event) const { - dispatchEvent("focus", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - return payload; - }); -} -void AndroidTextInputEventEmitter::onChange( - AndroidTextInputOnChangeStruct event) const { - dispatchEvent("change", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty(runtime, "eventCount", event.eventCount); - payload.setProperty(runtime, "text", event.text); - return payload; - }); -} -void AndroidTextInputEventEmitter::onChangeText( - AndroidTextInputOnChangeTextStruct event) const { - dispatchEvent( - "changeText", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty(runtime, "eventCount", event.eventCount); - payload.setProperty(runtime, "text", event.text); - return payload; - }); -} -void AndroidTextInputEventEmitter::onContentSizeChange( - AndroidTextInputOnContentSizeChangeStruct event) const { - dispatchEvent( - "contentSizeChange", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - { - auto contentSize = jsi::Object(runtime); - contentSize.setProperty(runtime, "width", event.contentSize.width); - contentSize.setProperty(runtime, "height", event.contentSize.height); - - payload.setProperty(runtime, "contentSize", contentSize); - } - return payload; - }); -} -void AndroidTextInputEventEmitter::onTextInput( - AndroidTextInputOnTextInputStruct event) const { - dispatchEvent("textInput", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty(runtime, "text", event.text); - payload.setProperty(runtime, "previousText", event.previousText); - { - auto range = jsi::Object(runtime); - range.setProperty(runtime, "start", event.range.start); - range.setProperty(runtime, "end", event.range.end); - - payload.setProperty(runtime, "range", range); - } - return payload; - }); -} -void AndroidTextInputEventEmitter::onEndEditing( - AndroidTextInputOnEndEditingStruct event) const { - dispatchEvent( - "endEditing", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty(runtime, "text", event.text); - return payload; - }); -} -void AndroidTextInputEventEmitter::onSelectionChange( - AndroidTextInputOnSelectionChangeStruct event) const { - dispatchEvent( - "selectionChange", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - { - auto selection = jsi::Object(runtime); - selection.setProperty(runtime, "start", event.selection.start); - selection.setProperty(runtime, "end", event.selection.end); - - payload.setProperty(runtime, "selection", selection); - } - return payload; - }); -} -void AndroidTextInputEventEmitter::onSubmitEditing( - AndroidTextInputOnSubmitEditingStruct event) const { - dispatchEvent( - "submitEditing", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty(runtime, "text", event.text); - return payload; - }); -} -void AndroidTextInputEventEmitter::onKeyPress( - AndroidTextInputOnKeyPressStruct event) const { - dispatchEvent("keyPress", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty(runtime, "key", event.key); - return payload; - }); -} -void AndroidTextInputEventEmitter::onScroll( - AndroidTextInputOnScrollStruct event) const { - dispatchEvent("scroll", [event = std::move(event)](jsi::Runtime &runtime) { - auto payload = jsi::Object(runtime); - payload.setProperty(runtime, "target", event.target); - payload.setProperty( - runtime, "responderIgnoreScroll", event.responderIgnoreScroll); - { - auto contentInset = jsi::Object(runtime); - contentInset.setProperty(runtime, "top", event.contentInset.top); - contentInset.setProperty(runtime, "bottom", event.contentInset.bottom); - contentInset.setProperty(runtime, "left", event.contentInset.left); - contentInset.setProperty(runtime, "right", event.contentInset.right); - - payload.setProperty(runtime, "contentInset", contentInset); - } - { - auto contentOffset = jsi::Object(runtime); - contentOffset.setProperty(runtime, "x", event.contentOffset.x); - contentOffset.setProperty(runtime, "y", event.contentOffset.y); - - payload.setProperty(runtime, "contentOffset", contentOffset); - } - { - auto contentSize = jsi::Object(runtime); - contentSize.setProperty(runtime, "width", event.contentSize.width); - contentSize.setProperty(runtime, "height", event.contentSize.height); - - payload.setProperty(runtime, "contentSize", contentSize); - } - { - auto layoutMeasurement = jsi::Object(runtime); - layoutMeasurement.setProperty( - runtime, "width", event.layoutMeasurement.width); - layoutMeasurement.setProperty( - runtime, "height", event.layoutMeasurement.height); - - payload.setProperty(runtime, "layoutMeasurement", layoutMeasurement); - } - { - auto velocity = jsi::Object(runtime); - velocity.setProperty(runtime, "x", event.velocity.x); - velocity.setProperty(runtime, "y", event.velocity.y); - - payload.setProperty(runtime, "velocity", velocity); - } - return payload; - }); -} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.h index b99192b244f8..e9b4bd445105 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,136 +12,15 @@ namespace facebook { namespace react { -struct AndroidTextInputOnBlurStruct { - int target; -}; - -struct AndroidTextInputOnFocusStruct { - int target; -}; - -struct AndroidTextInputOnChangeStruct { - int target; - int eventCount; - std::string text; -}; - -struct AndroidTextInputOnChangeTextStruct { - int target; - int eventCount; - std::string text; -}; - -struct AndroidTextInputOnContentSizeChangeContentSizeStruct { - double width; - double height; -}; - -struct AndroidTextInputOnContentSizeChangeStruct { - int target; - AndroidTextInputOnContentSizeChangeContentSizeStruct contentSize; -}; - -struct AndroidTextInputOnTextInputRangeStruct { - double start; - double end; -}; - -struct AndroidTextInputOnTextInputStruct { - int target; - std::string text; - std::string previousText; - AndroidTextInputOnTextInputRangeStruct range; -}; - -struct AndroidTextInputOnEndEditingStruct { - int target; - std::string text; -}; - -struct AndroidTextInputOnSelectionChangeSelectionStruct { - double start; - double end; -}; - -struct AndroidTextInputOnSelectionChangeStruct { - int target; - AndroidTextInputOnSelectionChangeSelectionStruct selection; -}; - -struct AndroidTextInputOnSubmitEditingStruct { - int target; - std::string text; -}; - -struct AndroidTextInputOnKeyPressStruct { - int target; - std::string key; -}; - -struct AndroidTextInputOnScrollContentInsetStruct { - double top; - double bottom; - double left; - double right; -}; - -struct AndroidTextInputOnScrollContentOffsetStruct { - double x; - double y; -}; - -struct AndroidTextInputOnScrollContentSizeStruct { - double width; - double height; -}; - -struct AndroidTextInputOnScrollLayoutMeasurementStruct { - double width; - double height; -}; - -struct AndroidTextInputOnScrollVelocityStruct { - double x; - double y; -}; - -struct AndroidTextInputOnScrollStruct { - int target; - bool responderIgnoreScroll; - AndroidTextInputOnScrollContentInsetStruct contentInset; - AndroidTextInputOnScrollContentOffsetStruct contentOffset; - AndroidTextInputOnScrollContentSizeStruct contentSize; - AndroidTextInputOnScrollLayoutMeasurementStruct layoutMeasurement; - AndroidTextInputOnScrollVelocityStruct velocity; -}; - +// This emitter exists only as a placeholder and is not used for communication +// with JS. +// +// See: +// - EventEmitterWrapper::invokeEvent for the Android event emitter dispatch +// - ReactTextInputManager.java for the text input events used on Android class AndroidTextInputEventEmitter : public ViewEventEmitter { public: using ViewEventEmitter::ViewEventEmitter; - - void onBlur(AndroidTextInputOnBlurStruct value) const; - - void onFocus(AndroidTextInputOnFocusStruct value) const; - - void onChange(AndroidTextInputOnChangeStruct value) const; - - void onChangeText(AndroidTextInputOnChangeTextStruct value) const; - - void onContentSizeChange( - AndroidTextInputOnContentSizeChangeStruct value) const; - - void onTextInput(AndroidTextInputOnTextInputStruct value) const; - - void onEndEditing(AndroidTextInputOnEndEditingStruct value) const; - - void onSelectionChange(AndroidTextInputOnSelectionChangeStruct value) const; - - void onSubmitEditing(AndroidTextInputOnSubmitEditingStruct value) const; - - void onKeyPress(AndroidTextInputOnKeyPressStruct value) const; - - void onScroll(AndroidTextInputOnScrollStruct value) const; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp index ce7e24fd476a..100186165edb 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h index 34048ddf9100..aad4572bd410 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -37,7 +37,7 @@ static inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AndroidTextInputSelectionStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto start = map.find("start"); if (start != map.end()) { @@ -63,7 +63,7 @@ static inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AndroidTextInputTextShadowOffsetStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto width = map.find("width"); if (width != map.end()) { diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp index 1f2e468653e2..fa497f2e13a6 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,6 +17,8 @@ #include #include +#include + using namespace facebook::jni; namespace facebook { @@ -91,7 +93,7 @@ AttributedString AndroidTextInputShadowNode::getPlaceholderAttributedString() void AndroidTextInputShadowNode::setTextLayoutManager( SharedTextLayoutManager textLayoutManager) { ensureUnsealed(); - textLayoutManager_ = textLayoutManager; + textLayoutManager_ = std::move(textLayoutManager); } AttributedString AndroidTextInputShadowNode::getMostRecentAttributedString() diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h index 2642030d9477..90ae122f5ed7 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -81,7 +81,7 @@ class AndroidTextInputShadowNode final : public ConcreteViewShadowNode< * Cached attributed string that represents the content of the subtree started * from the node. */ - mutable better::optional cachedAttributedString_{}; + mutable butter::optional cachedAttributedString_{}; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp index 4e51cf0ceef8..a2deb59db337 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,27 +10,28 @@ #include #include +#include + namespace facebook { namespace react { AndroidTextInputState::AndroidTextInputState( int64_t mostRecentEventCount, - AttributedString const &attributedString, - AttributedString const &reactTreeAttributedString, - ParagraphAttributes const ¶graphAttributes, - TextAttributes const &defaultTextAttributes, - ShadowView const &defaultParentShadowView, + AttributedString attributedString, + AttributedString reactTreeAttributedString, + ParagraphAttributes paragraphAttributes, + TextAttributes defaultTextAttributes, + ShadowView defaultParentShadowView, float defaultThemePaddingStart, float defaultThemePaddingEnd, float defaultThemePaddingTop, float defaultThemePaddingBottom) : mostRecentEventCount(mostRecentEventCount), - cachedAttributedStringId(0), - attributedString(attributedString), - reactTreeAttributedString(reactTreeAttributedString), - paragraphAttributes(paragraphAttributes), - defaultTextAttributes(defaultTextAttributes), - defaultParentShadowView(defaultParentShadowView), + attributedString(std::move(attributedString)), + reactTreeAttributedString(std::move(reactTreeAttributedString)), + paragraphAttributes(std::move(paragraphAttributes)), + defaultTextAttributes(std::move(defaultTextAttributes)), + defaultParentShadowView(std::move(defaultParentShadowView)), defaultThemePaddingStart(defaultThemePaddingStart), defaultThemePaddingEnd(defaultThemePaddingEnd), defaultThemePaddingTop(defaultThemePaddingTop), diff --git a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h index 4d3d41ac7a87..4dc50ac94101 100644 --- a/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h +++ b/ReactCommon/react/renderer/components/textinput/androidtextinput/react/renderer/components/androidtextinput/AndroidTextInputState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -79,11 +79,11 @@ class AndroidTextInputState final { AndroidTextInputState( int64_t mostRecentEventCount, - AttributedString const &attributedString, - AttributedString const &reactTreeAttributedString, - ParagraphAttributes const ¶graphAttributes, - TextAttributes const &defaultTextAttributes, - ShadowView const &defaultParentShadowView, + AttributedString attributedString, + AttributedString reactTreeAttributedString, + ParagraphAttributes paragraphAttributes, + TextAttributes defaultTextAttributes, + ShadowView defaultParentShadowView, float defaultThemePaddingStart, float defaultThemePaddingEnd, float defaultThemePaddingTop, diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h index a23ad76a7b36..63900758c9bd 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +36,7 @@ class TextInputComponentDescriptor final } private: - TextLayoutManager::Shared textLayoutManager_; + std::shared_ptr textLayoutManager_; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.cpp index 6342a6c1ff23..66e3c6e41f9b 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -75,9 +75,10 @@ void TextInputEventEmitter::onChange( dispatchTextInputEvent("change", textInputMetrics); } -void TextInputEventEmitter::onChangeText( +void TextInputEventEmitter::onChangeSync( TextInputMetrics const &textInputMetrics) const { - dispatchTextInputEvent("changeText", textInputMetrics); + dispatchTextInputEvent( + "changeSync", textInputMetrics, EventPriority::SynchronousBatched); } void TextInputEventEmitter::onContentSizeChange( @@ -110,6 +111,21 @@ void TextInputEventEmitter::onKeyPress( EventPriority::AsynchronousBatched); } +void TextInputEventEmitter::onKeyPressSync( + KeyPressMetrics const &keyPressMetrics) const { + dispatchEvent( + "keyPressSync", + [keyPressMetrics](jsi::Runtime &runtime) { + return keyPressMetricsPayload(runtime, keyPressMetrics); + }, + EventPriority::SynchronousBatched); +} + +void TextInputEventEmitter::onScroll( + TextInputMetrics const &textInputMetrics) const { + dispatchTextInputEvent("scroll", textInputMetrics); +} + void TextInputEventEmitter::dispatchTextInputEvent( std::string const &name, TextInputMetrics const &textInputMetrics, diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h index 6e5ecd44342e..a872f5f7ba6f 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,6 +23,8 @@ class TextInputMetrics { EdgeInsets contentInset; Size containerSize; int eventCount; + Size layoutMeasurement; + float zoomScale; }; class KeyPressMetrics { @@ -38,12 +40,14 @@ class TextInputEventEmitter : public ViewEventEmitter { void onFocus(TextInputMetrics const &textInputMetrics) const; void onBlur(TextInputMetrics const &textInputMetrics) const; void onChange(TextInputMetrics const &textInputMetrics) const; - void onChangeText(TextInputMetrics const &textInputMetrics) const; + void onChangeSync(TextInputMetrics const &textInputMetrics) const; void onContentSizeChange(TextInputMetrics const &textInputMetrics) const; void onSelectionChange(TextInputMetrics const &textInputMetrics) const; void onEndEditing(TextInputMetrics const &textInputMetrics) const; void onSubmitEditing(TextInputMetrics const &textInputMetrics) const; void onKeyPress(KeyPressMetrics const &textInputMetrics) const; + void onKeyPressSync(KeyPressMetrics const &textInputMetrics) const; + void onScroll(TextInputMetrics const &textInputMetrics) const; private: void dispatchTextInputEvent( diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp index 9e13cb97bb05..65355be1d640 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -87,12 +87,24 @@ TextInputProps::TextInputProps( rawProps, "selection", sourceProps.selection, - better::optional())), + butter::optional())), inputAccessoryViewID(convertRawProp( context, rawProps, "inputAccessoryViewID", sourceProps.inputAccessoryViewID, + {})), + onKeyPressSync(convertRawProp( + context, + rawProps, + "onKeyPressSync", + sourceProps.onKeyPressSync, + {})), + onChangeSync(convertRawProp( + context, + rawProps, + "onChangeSync", + sourceProps.onChangeSync, {})){}; TextAttributes TextInputProps::getEffectiveTextAttributes( diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h index 9fb44a4b2c17..1169277c6477 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -58,10 +58,13 @@ class TextInputProps final : public ViewProps, public BaseTextProps { int const mostRecentEventCount{0}; bool autoFocus{false}; - better::optional selection{}; + butter::optional selection{}; std::string const inputAccessoryViewID{}; + bool onKeyPressSync{false}; + bool onChangeSync{false}; + /* * Accessors */ diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp index fb5c0ff7f33b..8910d21fb43d 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -71,9 +71,9 @@ AttributedString TextInputShadowNode::getAttributedString( } void TextInputShadowNode::setTextLayoutManager( - TextLayoutManager::Shared const &textLayoutManager) { + std::shared_ptr textLayoutManager) { ensureUnsealed(); - textLayoutManager_ = textLayoutManager; + textLayoutManager_ = std::move(textLayoutManager); } void TextInputShadowNode::updateStateIfNeeded( diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h index ffb370aab03f..105ed7805ab9 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -46,7 +46,8 @@ class TextInputShadowNode final : public ConcreteViewShadowNode< * `TextInputShadowNode` uses the manager to measure text content * and construct `TextInputState` objects. */ - void setTextLayoutManager(TextLayoutManager::Shared const &textLayoutManager); + void setTextLayoutManager( + std::shared_ptr textLayoutManager); #pragma mark - LayoutableShadowNode @@ -75,7 +76,7 @@ class TextInputShadowNode final : public ConcreteViewShadowNode< AttributedStringBox attributedStringBoxToMeasure( LayoutContext const &layoutContext) const; - TextLayoutManager::Shared textLayoutManager_; + std::shared_ptr textLayoutManager_; }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.cpp b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.cpp index c22ba8bd11d2..f4930a436e94 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.cpp +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,5 +8,27 @@ #include "TextInputState.h" namespace facebook { -namespace react {} // namespace react +namespace react { + +#ifdef ANDROID +TextInputState::TextInputState( + TextInputState const &previousState, + folly::dynamic const &data){}; + +/* + * Empty implementation for Android because it doesn't use this class. + */ +folly::dynamic TextInputState::getDynamic() const { + return {}; +}; + +/* + * Empty implementation for Android because it doesn't use this class. + */ +MapBuffer TextInputState::getMapBuffer() const { + return MapBufferBuilder::EMPTY(); +}; +#endif + +} // namespace react } // namespace facebook diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h index fb249f4a840a..68572c09e218 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/TextInputState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,6 +25,8 @@ namespace react { */ class TextInputState final { public: + TextInputState() = default; + /* * All content of component. */ @@ -50,9 +52,19 @@ class TextInputState final { * text rendering infrastructure which is capable to render the * `AttributedString`. */ - SharedTextLayoutManager layoutManager; + std::shared_ptr layoutManager; size_t mostRecentEventCount{0}; + +#ifdef ANDROID + TextInputState( + TextInputState const &previousState, + folly::dynamic const &data); + + folly::dynamic getDynamic() const; + + MapBuffer getMapBuffer() const; +#endif }; } // namespace react diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h b/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h index 56be93b9da17..98e44fd7c070 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h b/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h index f3b0fc2dfc58..54e241a21123 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ #include -#include +#include namespace facebook { namespace react { @@ -106,7 +106,7 @@ class TextInputTraits final { * iOS & Android * Default value: `empty` (`null`). */ - better::optional autoCorrect{}; + butter::optional autoCorrect{}; /* * iOS & Android @@ -141,7 +141,7 @@ class TextInputTraits final { * Can be empty (`null` in JavaScript) which means `default`. * Default value: `empty` (`null`). */ - better::optional spellCheck{}; + butter::optional spellCheck{}; /* * iOS & Android diff --git a/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h b/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h index 162e98911247..84c52eeace6c 100644 --- a/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h +++ b/ReactCommon/react/renderer/components/textinput/iostextinput/propsConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -149,8 +149,8 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, Selection &result) { - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "start") { result.start = pair.second; diff --git a/ReactCommon/react/renderer/components/unimplementedview/Android.mk b/ReactCommon/react/renderer/components/unimplementedview/Android.mk index 959500fb70d1..755f9d34e7b7 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/Android.mk +++ b/ReactCommon/react/renderer/components/unimplementedview/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_unimplementedview LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,7 +22,18 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libjsi libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics librrc_view libreact_debug +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp index c6b460641670..e58621a6c51b 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h index 2f5bfca3a95d..0d89f9553ec6 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp index b5033818f156..73aff6fd4e96 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h index c2907a50abc3..87794e2f312b 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp index a01eb025bbf2..30cadf3a3f39 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h index f176f68fc4ae..a6d141aacf7a 100644 --- a/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h +++ b/ReactCommon/react/renderer/components/unimplementedview/UnimplementedViewShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h b/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h index 23999ae4d28f..9a6a6cb89763 100644 --- a/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h +++ b/ReactCommon/react/renderer/components/view/AccessibilityPrimitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -50,7 +50,7 @@ constexpr enum AccessibilityTraits operator&( struct AccessibilityAction { std::string name{""}; - better::optional label{}; + butter::optional label{}; }; struct AccessibilityState { @@ -76,10 +76,10 @@ constexpr bool operator!=( } struct AccessibilityValue { - better::optional min; - better::optional max; - better::optional now; - better::optional text{}; + butter::optional min; + butter::optional max; + butter::optional now; + butter::optional text{}; }; constexpr bool operator==( diff --git a/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp b/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp index 4dda5214c6df..a911458aa3a8 100644 --- a/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp +++ b/ReactCommon/react/renderer/components/view/AccessibilityProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/AccessibilityProps.h b/ReactCommon/react/renderer/components/view/AccessibilityProps.h index eab784696605..3b6d9212b2ba 100644 --- a/ReactCommon/react/renderer/components/view/AccessibilityProps.h +++ b/ReactCommon/react/renderer/components/view/AccessibilityProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/Android.mk b/ReactCommon/react/renderer/components/view/Android.mk index 2f820d3cc504..a2806b166086 100644 --- a/ReactCommon/react/renderer/components/view/Android.mk +++ b/ReactCommon/react/renderer/components/view/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := rrc_view LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../../ @@ -21,7 +22,17 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libyoga glog libfolly_json libglog_init libreact_render_core libreact_render_debug libreact_render_graphics libreact_debug logger libjsi +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libyoga \ + logger \ include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/components/view/BUCK b/ReactCommon/react/renderer/components/view/BUCK index d78b21f2cf89..b82e163974fe 100644 --- a/ReactCommon/react/renderer/components/view/BUCK +++ b/ReactCommon/react/renderer/components/view/BUCK @@ -35,6 +35,8 @@ rn_xplat_cxx_library( ], prefix = "react/renderer/components/view", ), + compiler_flags_enable_exceptions = False, + compiler_flags_enable_rtti = False, # YogaLayoutableShadowNode fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), force_static = True, diff --git a/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h b/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h index 0fe2def64c94..045a5d752c69 100644 --- a/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h +++ b/ReactCommon/react/renderer/components/view/ConcreteViewShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/Touch.cpp b/ReactCommon/react/renderer/components/view/Touch.cpp index 2b0c522fa389..15e5bfaaee55 100644 --- a/ReactCommon/react/renderer/components/view/Touch.cpp +++ b/ReactCommon/react/renderer/components/view/Touch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/Touch.h b/ReactCommon/react/renderer/components/view/Touch.h index 91b6db7522b5..13383a0e5bbc 100644 --- a/ReactCommon/react/renderer/components/view/Touch.h +++ b/ReactCommon/react/renderer/components/view/Touch.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/TouchEvent.cpp b/ReactCommon/react/renderer/components/view/TouchEvent.cpp index 203a1bad0b0c..7f8b9fda170c 100644 --- a/ReactCommon/react/renderer/components/view/TouchEvent.cpp +++ b/ReactCommon/react/renderer/components/view/TouchEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/TouchEvent.h b/ReactCommon/react/renderer/components/view/TouchEvent.h index 02f7ab4e6361..ad0e918f4545 100644 --- a/ReactCommon/react/renderer/components/view/TouchEvent.h +++ b/ReactCommon/react/renderer/components/view/TouchEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp b/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp index 1d8ed3e33040..d94144c8715b 100644 --- a/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/view/TouchEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/TouchEventEmitter.h b/ReactCommon/react/renderer/components/view/TouchEventEmitter.h index c225fbb9d639..e652dc6e3bbb 100644 --- a/ReactCommon/react/renderer/components/view/TouchEventEmitter.h +++ b/ReactCommon/react/renderer/components/view/TouchEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h b/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h index 5379d71b9468..f9e04afb07e2 100644 --- a/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h +++ b/ReactCommon/react/renderer/components/view/ViewComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp b/ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp index f978934cc239..23f17caacbfe 100644 --- a/ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp +++ b/ReactCommon/react/renderer/components/view/ViewEventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/ViewEventEmitter.h b/ReactCommon/react/renderer/components/view/ViewEventEmitter.h index 1a4e17e84e51..5685a3e94ada 100644 --- a/ReactCommon/react/renderer/components/view/ViewEventEmitter.h +++ b/ReactCommon/react/renderer/components/view/ViewEventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/ViewProps.cpp b/ReactCommon/react/renderer/components/view/ViewProps.cpp index 0e1a99767939..bcc539077061 100644 --- a/ReactCommon/react/renderer/components/view/ViewProps.cpp +++ b/ReactCommon/react/renderer/components/view/ViewProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -125,6 +125,24 @@ ViewProps::ViewProps( "onLayout", sourceProps.onLayout, {})), + pointerEnter(convertRawProp( + context, + rawProps, + "pointerenter", + sourceProps.pointerEnter, + {})), + pointerLeave(convertRawProp( + context, + rawProps, + "pointerleave", + sourceProps.pointerLeave, + {})), + pointerMove(convertRawProp( + context, + rawProps, + "pointermove", + sourceProps.pointerMove, + {})), collapsable(convertRawProp( context, rawProps, diff --git a/ReactCommon/react/renderer/components/view/ViewProps.h b/ReactCommon/react/renderer/components/view/ViewProps.h index b66249a6915c..1f43dfa60d39 100644 --- a/ReactCommon/react/renderer/components/view/ViewProps.h +++ b/ReactCommon/react/renderer/components/view/ViewProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -54,13 +54,19 @@ class ViewProps : public YogaStylableProps, public AccessibilityProps { Transform transform{}; BackfaceVisibility backfaceVisibility{}; bool shouldRasterize{}; - better::optional zIndex{}; + butter::optional zIndex{}; // Events PointerEventsMode pointerEvents{}; EdgeInsets hitSlop{}; bool onLayout{}; + bool pointerEnter{}; + + bool pointerLeave{}; + + bool pointerMove{}; + bool collapsable{true}; bool removeClippedSubviews{false}; diff --git a/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h b/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h index cc4567abc696..0d0665f61c8c 100644 --- a/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h +++ b/ReactCommon/react/renderer/components/view/ViewPropsInterpolation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp index 75fa7f4c73a6..661858cba131 100644 --- a/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -48,7 +48,8 @@ void ViewShadowNode::initialize() noexcept { bool formsView = formsStackingContext || isColorMeaningful(viewProps.backgroundColor) || - isColorMeaningful(viewProps.foregroundColor) || + isColorMeaningful(viewProps.foregroundColor) || viewProps.pointerEnter || + viewProps.pointerLeave || viewProps.pointerMove || !(viewProps.yogaStyle.border() == YGStyle::Edges{}) || !viewProps.testId.empty(); diff --git a/ReactCommon/react/renderer/components/view/ViewShadowNode.h b/ReactCommon/react/renderer/components/view/ViewShadowNode.h index 20ccc04d5f45..0264a7ab41a2 100644 --- a/ReactCommon/react/renderer/components/view/ViewShadowNode.h +++ b/ReactCommon/react/renderer/components/view/ViewShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp index 0c5ccdf083c7..5ba750e48328 100644 --- a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,7 +33,7 @@ static int FabricDefaultYogaLog( va_copy(args_copy, args); // Adding 1 to add space for terminating null character. - int size_s = vsnprintf(NULL, 0, format, args); + int size_s = vsnprintf(nullptr, 0, format, args); auto size = static_cast(size_s); std::vector buffer(size); @@ -528,8 +528,17 @@ void YogaLayoutableShadowNode::layout(LayoutContext layoutContext) { } if (yogaNode_.getStyle().overflow() == YGOverflowVisible) { + auto transform = getTransform(); + auto transformedContentFrame = contentFrame; + if (Transform::Identity() != transform) { + // When animation uses native driver, Yoga has no knowledge of the + // animation. In case the content goes out from current container, we need + // to union the content frame with its transformed frame. + transformedContentFrame = contentFrame * getTransform(); + transformedContentFrame.unionInPlace(contentFrame); + } layoutMetrics_.overflowInset = - calculateOverflowInset(layoutMetrics_.frame, contentFrame); + calculateOverflowInset(layoutMetrics_.frame, transformedContentFrame); } else { layoutMetrics_.overflowInset = {}; } diff --git a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h index 77ba81311458..fe95d354930a 100644 --- a/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h +++ b/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ namespace react { class YogaLayoutableShadowNode : public LayoutableShadowNode { public: - using UnsharedList = better::small_vector< + using UnsharedList = butter::small_vector< YogaLayoutableShadowNode *, kShadowNodeChildrenSmallVectorSize>; diff --git a/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp b/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp index d8c44f49f5c1..5b2d5be6ba58 100644 --- a/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp +++ b/ReactCommon/react/renderer/components/view/YogaStylableProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/YogaStylableProps.h b/ReactCommon/react/renderer/components/view/YogaStylableProps.h index 3d6e314d6c0f..07d3d3fc8401 100644 --- a/ReactCommon/react/renderer/components/view/YogaStylableProps.h +++ b/ReactCommon/react/renderer/components/view/YogaStylableProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h b/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h index 92c52527cd55..833b7544dfb7 100644 --- a/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h +++ b/ReactCommon/react/renderer/components/view/accessibilityPropsConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -133,7 +133,7 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AccessibilityState &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto selected = map.find("selected"); if (selected != map.end()) { fromRawValue(context, selected->second, result.selected); @@ -212,7 +212,7 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, AccessibilityAction &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto name = map.find("name"); react_native_assert(name != map.end() && name->second.hasType()); @@ -232,7 +232,7 @@ inline void fromRawValue( const PropsParserContext &, const RawValue &value, AccessibilityValue &result) { - auto map = (better::map)value; + auto map = (butter::map)value; auto min = map.find("min"); if (min != map.end()) { diff --git a/ReactCommon/react/renderer/components/view/conversions.h b/ReactCommon/react/renderer/components/view/conversions.h index 36fc9d507f13..3820a872dc9f 100644 --- a/ReactCommon/react/renderer/components/view/conversions.h +++ b/ReactCommon/react/renderer/components/view/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include #include @@ -98,9 +98,9 @@ inline YGValue yogaStyleValueFromFloat( return {(float)value, unit}; } -inline better::optional optionalFloatFromYogaValue( +inline butter::optional optionalFloatFromYogaValue( const YGValue value, - better::optional base = {}) { + butter::optional base = {}) { switch (value.unit) { case YGUnitUndefined: return {}; @@ -108,9 +108,9 @@ inline better::optional optionalFloatFromYogaValue( return floatFromYogaFloat(value.value); case YGUnitPercent: return base.has_value() - ? better::optional( + ? butter::optional( base.value() * floatFromYogaFloat(value.value)) - : better::optional(); + : butter::optional(); case YGUnitAuto: return {}; } @@ -444,14 +444,14 @@ inline void fromRawValue( auto configurations = static_cast>(value); for (const auto &configuration : configurations) { - if (!configuration.hasType>()) { + if (!configuration.hasType>()) { // TODO: The following checks have to be removed after codegen is shipped. // See T45151459. continue; } auto configurationPair = - static_cast>(configuration); + static_cast>(configuration); auto pair = configurationPair.begin(); auto operation = pair->first; auto ¶meters = pair->second; diff --git a/ReactCommon/react/renderer/components/view/primitives.h b/ReactCommon/react/renderer/components/view/primitives.h index 52e5f3f08c21..5f86de9a49b5 100644 --- a/ReactCommon/react/renderer/components/view/primitives.h +++ b/ReactCommon/react/renderer/components/view/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -25,7 +25,7 @@ enum class BorderStyle { Solid, Dotted, Dashed }; template struct CascadedRectangleEdges { using Counterpart = RectangleEdges; - using OptionalT = better::optional; + using OptionalT = butter::optional; OptionalT left{}; OptionalT top{}; @@ -86,7 +86,7 @@ struct CascadedRectangleEdges { template struct CascadedRectangleCorners { using Counterpart = RectangleCorners; - using OptionalT = better::optional; + using OptionalT = butter::optional; OptionalT topLeft{}; OptionalT topRight{}; diff --git a/ReactCommon/react/renderer/components/view/propsConversions.h b/ReactCommon/react/renderer/components/view/propsConversions.h index 5f91adc5cbda..6d7233f50c0e 100644 --- a/ReactCommon/react/renderer/components/view/propsConversions.h +++ b/ReactCommon/react/renderer/components/view/propsConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp b/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp index 840547d8e668..f9890c32ffb7 100644 --- a/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp +++ b/ReactCommon/react/renderer/components/view/tests/LayoutTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp b/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp index 8da0ed46ea6e..05b9008b8e67 100644 --- a/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp +++ b/ReactCommon/react/renderer/components/view/tests/ViewTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/Android.mk b/ReactCommon/react/renderer/core/Android.mk index 32a8ddf5efe2..cc67ef7db75e 100644 --- a/ReactCommon/react/renderer/core/Android.mk +++ b/ReactCommon/react/renderer/core/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,10 +12,19 @@ LOCAL_MODULE := react_render_core LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ -LOCAL_SHARED_LIBRARIES := libfolly_json libjsi libfolly_futures libreact_utils libreact_debug libreact_render_debug libreact_render_graphics libglog +LOCAL_SHARED_LIBRARIES := \ + libfolly_futures \ + libfolly_json \ + libglog \ + libjsi \ + libreact_debug \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_utils LOCAL_CFLAGS := \ -DLOG_TAG=\"Fabric\" diff --git a/ReactCommon/react/renderer/core/BUCK b/ReactCommon/react/renderer/core/BUCK index feb8f6569be0..d4d9420c193e 100644 --- a/ReactCommon/react/renderer/core/BUCK +++ b/ReactCommon/react/renderer/core/BUCK @@ -32,8 +32,8 @@ rn_xplat_cxx_library( ], prefix = "react/renderer/core", ), - compiler_flags_enable_exceptions = True, - compiler_flags_enable_rtti = True, # Needed for DebugStringConvertible - need to find a non-RTTI way to do this / enable RTTI for debug builds only + compiler_flags_enable_exceptions = False, + compiler_flags_enable_rtti = False, # Needed for DebugStringConvertible - need to find a non-RTTI way to do this / enable RTTI for debug builds only. Also EventBeat/AsyncEventBeat fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), force_static = True, diff --git a/ReactCommon/react/renderer/core/BatchedEventQueue.cpp b/ReactCommon/react/renderer/core/BatchedEventQueue.cpp index 64d8df3288ce..87a59051a890 100644 --- a/ReactCommon/react/renderer/core/BatchedEventQueue.cpp +++ b/ReactCommon/react/renderer/core/BatchedEventQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/BatchedEventQueue.h b/ReactCommon/react/renderer/core/BatchedEventQueue.h index ea18dcf3d928..f663321f02f2 100644 --- a/ReactCommon/react/renderer/core/BatchedEventQueue.h +++ b/ReactCommon/react/renderer/core/BatchedEventQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ComponentDescriptor.cpp b/ReactCommon/react/renderer/core/ComponentDescriptor.cpp index dae316ad3612..9afdf8788605 100644 --- a/ReactCommon/react/renderer/core/ComponentDescriptor.cpp +++ b/ReactCommon/react/renderer/core/ComponentDescriptor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ComponentDescriptor.h b/ReactCommon/react/renderer/core/ComponentDescriptor.h index e0bac0845ead..7067b2563805 100644 --- a/ReactCommon/react/renderer/core/ComponentDescriptor.h +++ b/ReactCommon/react/renderer/core/ComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,6 +14,7 @@ #include #include #include +#include #include namespace facebook { @@ -112,7 +113,7 @@ class ComponentDescriptor { */ virtual SharedProps interpolateProps( const PropsParserContext &context, - float animationProgress, + Float animationProgress, const SharedProps &props, const SharedProps &newProps) const = 0; diff --git a/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h b/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h index 08193e7609f3..0632dfd39cce 100644 --- a/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h +++ b/ReactCommon/react/renderer/core/ConcreteComponentDescriptor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,7 @@ #include #include #include +#include namespace facebook { namespace react { @@ -113,7 +114,7 @@ class ConcreteComponentDescriptor : public ComponentDescriptor { SharedProps interpolateProps( const PropsParserContext &context, - float animationProgress, + Float animationProgress, const SharedProps &props, const SharedProps &newProps) const override { #ifdef ANDROID diff --git a/ReactCommon/react/renderer/core/ConcreteShadowNode.h b/ReactCommon/react/renderer/core/ConcreteShadowNode.h index 537aa6dcbf20..934de8d84bad 100644 --- a/ReactCommon/react/renderer/core/ConcreteShadowNode.h +++ b/ReactCommon/react/renderer/core/ConcreteShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ConcreteState.h b/ReactCommon/react/renderer/core/ConcreteState.h index c4f8bef37e1d..d7615e3926bb 100644 --- a/ReactCommon/react/renderer/core/ConcreteState.h +++ b/ReactCommon/react/renderer/core/ConcreteState.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/DynamicPropsUtilities.cpp b/ReactCommon/react/renderer/core/DynamicPropsUtilities.cpp index 428ae4f3b830..f4e03a822d59 100644 --- a/ReactCommon/react/renderer/core/DynamicPropsUtilities.cpp +++ b/ReactCommon/react/renderer/core/DynamicPropsUtilities.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/DynamicPropsUtilities.h b/ReactCommon/react/renderer/core/DynamicPropsUtilities.h index 9e7283cb8fc3..d251f20b7570 100644 --- a/ReactCommon/react/renderer/core/DynamicPropsUtilities.h +++ b/ReactCommon/react/renderer/core/DynamicPropsUtilities.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventBeat.cpp b/ReactCommon/react/renderer/core/EventBeat.cpp index 0275e7820b56..6675fb0e43ac 100644 --- a/ReactCommon/react/renderer/core/EventBeat.cpp +++ b/ReactCommon/react/renderer/core/EventBeat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,10 +7,13 @@ #include "EventBeat.h" +#include + namespace facebook { namespace react { -EventBeat::EventBeat(SharedOwnerBox const &ownerBox) : ownerBox_(ownerBox) {} +EventBeat::EventBeat(SharedOwnerBox ownerBox) + : ownerBox_(std::move(ownerBox)) {} void EventBeat::request() const { isRequested_ = true; @@ -32,8 +35,8 @@ void EventBeat::induce() const { // Default implementation does nothing. } -void EventBeat::setBeatCallback(const BeatCallback &beatCallback) { - beatCallback_ = beatCallback; +void EventBeat::setBeatCallback(BeatCallback beatCallback) { + beatCallback_ = std::move(beatCallback); } } // namespace react diff --git a/ReactCommon/react/renderer/core/EventBeat.h b/ReactCommon/react/renderer/core/EventBeat.h index 1e20c2ec937d..05388edd5bf6 100644 --- a/ReactCommon/react/renderer/core/EventBeat.h +++ b/ReactCommon/react/renderer/core/EventBeat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -47,7 +47,7 @@ class EventBeat { using BeatCallback = std::function; - EventBeat(SharedOwnerBox const &ownerBox); + EventBeat(SharedOwnerBox ownerBox); virtual ~EventBeat() = default; @@ -73,7 +73,7 @@ class EventBeat { * Sets the beat callback function. * The callback is must be called on the proper thread. */ - void setBeatCallback(const BeatCallback &beatCallback); + void setBeatCallback(BeatCallback beatCallback); protected: /* diff --git a/ReactCommon/react/renderer/core/EventDispatcher.cpp b/ReactCommon/react/renderer/core/EventDispatcher.cpp index 3cfe35f3e0cf..615390b04d6a 100644 --- a/ReactCommon/react/renderer/core/EventDispatcher.cpp +++ b/ReactCommon/react/renderer/core/EventDispatcher.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,7 @@ namespace facebook { namespace react { EventDispatcher::EventDispatcher( - EventQueueProcessor eventProcessor, + EventQueueProcessor const &eventProcessor, EventBeat::Factory const &synchonousEventBeatFactory, EventBeat::Factory const &asynchonousEventBeatFactory, EventBeat::SharedOwnerBox const &ownerBox) diff --git a/ReactCommon/react/renderer/core/EventDispatcher.h b/ReactCommon/react/renderer/core/EventDispatcher.h index f81ccd7cc268..9b630b3bf2a9 100644 --- a/ReactCommon/react/renderer/core/EventDispatcher.h +++ b/ReactCommon/react/renderer/core/EventDispatcher.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,7 +29,7 @@ class EventDispatcher { using Weak = std::weak_ptr; EventDispatcher( - EventQueueProcessor eventProcessor, + EventQueueProcessor const &eventProcessor, EventBeat::Factory const &synchonousEventBeatFactory, EventBeat::Factory const &asynchonousEventBeatFactory, EventBeat::SharedOwnerBox const &ownerBox); diff --git a/ReactCommon/react/renderer/core/EventEmitter.cpp b/ReactCommon/react/renderer/core/EventEmitter.cpp index cbc4dfd29b82..b397392f98c3 100644 --- a/ReactCommon/react/renderer/core/EventEmitter.cpp +++ b/ReactCommon/react/renderer/core/EventEmitter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventEmitter.h b/ReactCommon/react/renderer/core/EventEmitter.h index f2f484b0d398..0ebb31a9df48 100644 --- a/ReactCommon/react/renderer/core/EventEmitter.h +++ b/ReactCommon/react/renderer/core/EventEmitter.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventHandler.h b/ReactCommon/react/renderer/core/EventHandler.h index ecadae3d6536..6deb74bf83b1 100644 --- a/ReactCommon/react/renderer/core/EventHandler.h +++ b/ReactCommon/react/renderer/core/EventHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventPipe.h b/ReactCommon/react/renderer/core/EventPipe.h index 3e9ac127e6bb..e64281fc6868 100644 --- a/ReactCommon/react/renderer/core/EventPipe.h +++ b/ReactCommon/react/renderer/core/EventPipe.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventPriority.h b/ReactCommon/react/renderer/core/EventPriority.h index 8611f105800e..bde3b9a36aa9 100644 --- a/ReactCommon/react/renderer/core/EventPriority.h +++ b/ReactCommon/react/renderer/core/EventPriority.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventQueue.cpp b/ReactCommon/react/renderer/core/EventQueue.cpp index 4d10e4c74423..ef111d4b56d2 100644 --- a/ReactCommon/react/renderer/core/EventQueue.cpp +++ b/ReactCommon/react/renderer/core/EventQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,7 +19,7 @@ EventQueue::EventQueue( : eventProcessor_(std::move(eventProcessor)), eventBeat_(std::move(eventBeat)) { eventBeat_->setBeatCallback( - std::bind(&EventQueue::onBeat, this, std::placeholders::_1)); + [this](jsi::Runtime &runtime) { onBeat(runtime); }); } void EventQueue::enqueueEvent(RawEvent &&rawEvent) const { diff --git a/ReactCommon/react/renderer/core/EventQueue.h b/ReactCommon/react/renderer/core/EventQueue.h index d0f9da84426d..3a3196dbb521 100644 --- a/ReactCommon/react/renderer/core/EventQueue.h +++ b/ReactCommon/react/renderer/core/EventQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventQueueProcessor.cpp b/ReactCommon/react/renderer/core/EventQueueProcessor.cpp index 40b813e155aa..59ea4506a8f7 100644 --- a/ReactCommon/react/renderer/core/EventQueueProcessor.cpp +++ b/ReactCommon/react/renderer/core/EventQueueProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventQueueProcessor.h b/ReactCommon/react/renderer/core/EventQueueProcessor.h index 933cc9a20796..8fa3433ea419 100644 --- a/ReactCommon/react/renderer/core/EventQueueProcessor.h +++ b/ReactCommon/react/renderer/core/EventQueueProcessor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/EventTarget.cpp b/ReactCommon/react/renderer/core/EventTarget.cpp index b8d84547016a..9a6d115b2728 100644 --- a/ReactCommon/react/renderer/core/EventTarget.cpp +++ b/ReactCommon/react/renderer/core/EventTarget.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -40,8 +40,10 @@ void EventTarget::retain(jsi::Runtime &runtime) const { // particular implementation of JSI was able to detect this inconsistency and // dealt with it, but some JSI implementation may not support this feature and // that case will lead to a crash in those environments. - react_native_assert(!strongInstanceHandle_.isNull()); - react_native_assert(!strongInstanceHandle_.isUndefined()); + + // TODO: Replace with mustfix once mustfix is ready in React Native. + // react_native_assert(!strongInstanceHandle_.isNull()); + // react_native_assert(!strongInstanceHandle_.isUndefined()); } void EventTarget::release(jsi::Runtime &runtime) const { diff --git a/ReactCommon/react/renderer/core/EventTarget.h b/ReactCommon/react/renderer/core/EventTarget.h index 92f382a96c49..8807ef4b2806 100644 --- a/ReactCommon/react/renderer/core/EventTarget.h +++ b/ReactCommon/react/renderer/core/EventTarget.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutConstraints.cpp b/ReactCommon/react/renderer/core/LayoutConstraints.cpp index f7a9697e829e..db92606051df 100644 --- a/ReactCommon/react/renderer/core/LayoutConstraints.cpp +++ b/ReactCommon/react/renderer/core/LayoutConstraints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutConstraints.h b/ReactCommon/react/renderer/core/LayoutConstraints.h index 26b4c419e38c..fd21538a0f7f 100644 --- a/ReactCommon/react/renderer/core/LayoutConstraints.h +++ b/ReactCommon/react/renderer/core/LayoutConstraints.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutContext.h b/ReactCommon/react/renderer/core/LayoutContext.h index dcd441028eb5..f2a4ae55e7e7 100644 --- a/ReactCommon/react/renderer/core/LayoutContext.h +++ b/ReactCommon/react/renderer/core/LayoutContext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutMetrics.cpp b/ReactCommon/react/renderer/core/LayoutMetrics.cpp index 26a3feaafeb5..8e92f2f07a13 100644 --- a/ReactCommon/react/renderer/core/LayoutMetrics.cpp +++ b/ReactCommon/react/renderer/core/LayoutMetrics.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutMetrics.h b/ReactCommon/react/renderer/core/LayoutMetrics.h index f094e2c55276..2ba3b5dfc07d 100644 --- a/ReactCommon/react/renderer/core/LayoutMetrics.h +++ b/ReactCommon/react/renderer/core/LayoutMetrics.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutPrimitives.h b/ReactCommon/react/renderer/core/LayoutPrimitives.h index b0981f6f7367..aa1845172fd8 100644 --- a/ReactCommon/react/renderer/core/LayoutPrimitives.h +++ b/ReactCommon/react/renderer/core/LayoutPrimitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp index a1ad4dda15f7..c56846922579 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,6 +17,19 @@ namespace facebook { namespace react { +LayoutableShadowNode::LayoutableShadowNode( + ShadowNodeFragment const &fragment, + ShadowNodeFamily::Shared const &family, + ShadowNodeTraits traits) + : ShadowNode(fragment, family, traits), layoutMetrics_({}) {} + +LayoutableShadowNode::LayoutableShadowNode( + ShadowNode const &sourceShadowNode, + ShadowNodeFragment const &fragment) + : ShadowNode(sourceShadowNode, fragment), + layoutMetrics_(static_cast(sourceShadowNode) + .layoutMetrics_) {} + LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( ShadowNodeFamily const &descendantNodeFamily, LayoutableShadowNode const &ancestorNode, @@ -43,7 +56,7 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( // Step 1. // Creating a list of nodes that form a chain from the descender node to // ancestor node inclusively. - auto shadowNodeList = better::small_vector{}; + auto shadowNodeList = butter::small_vector{}; // Finding the measured node. // The last element in the `AncestorList` is a pair of a parent of the node @@ -118,19 +131,6 @@ LayoutMetrics LayoutableShadowNode::computeRelativeLayoutMetrics( return layoutMetrics; } -LayoutableShadowNode::LayoutableShadowNode( - ShadowNodeFragment const &fragment, - ShadowNodeFamily::Shared const &family, - ShadowNodeTraits traits) - : ShadowNode(fragment, family, traits), layoutMetrics_({}) {} - -LayoutableShadowNode::LayoutableShadowNode( - ShadowNode const &sourceShadowNode, - ShadowNodeFragment const &fragment) - : ShadowNode(sourceShadowNode, fragment), - layoutMetrics_(static_cast(sourceShadowNode) - .layoutMetrics_) {} - ShadowNodeTraits LayoutableShadowNode::BaseTraits() { auto traits = ShadowNodeTraits{}; traits.set(ShadowNodeTraits::Trait::LayoutableKind); @@ -202,18 +202,8 @@ Float LayoutableShadowNode::lastBaseline(Size size) const { return 0; } -void LayoutableShadowNode::layoutTree( - LayoutContext layoutContext, - LayoutConstraints layoutConstraints) { - // Default implementation does nothing. -} - -void LayoutableShadowNode::layout(LayoutContext layoutContext) { - // Default implementation does nothing. -} - ShadowNode::Shared LayoutableShadowNode::findNodeAtPoint( - ShadowNode::Shared node, + ShadowNode::Shared const &node, Point point) { auto layoutableShadowNode = traitCast(node.get()); diff --git a/ReactCommon/react/renderer/core/LayoutableShadowNode.h b/ReactCommon/react/renderer/core/LayoutableShadowNode.h index b816b54a2cfc..35dd55e75145 100644 --- a/ReactCommon/react/renderer/core/LayoutableShadowNode.h +++ b/ReactCommon/react/renderer/core/LayoutableShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,7 +12,7 @@ #include #include -#include +#include #include #include #include @@ -49,7 +49,7 @@ class LayoutableShadowNode : public ShadowNode { bool includeViewportOffset{false}; }; - using UnsharedList = better:: + using UnsharedList = butter:: small_vector; /* @@ -70,7 +70,7 @@ class LayoutableShadowNode : public ShadowNode { */ virtual void layoutTree( LayoutContext layoutContext, - LayoutConstraints layoutConstraints); + LayoutConstraints layoutConstraints) = 0; /* * Measures the node (and node content, probably recursively) with @@ -101,7 +101,7 @@ class LayoutableShadowNode : public ShadowNode { * - Calculate and assign `LayoutMetrics` for the children; * - Call itself recursively on every child if needed. */ - virtual void layout(LayoutContext layoutContext); + virtual void layout(LayoutContext layoutContext) = 0; /* * Returns layout metrics computed during previous layout pass. @@ -133,7 +133,7 @@ class LayoutableShadowNode : public ShadowNode { * parameter. */ static ShadowNode::Shared findNodeAtPoint( - ShadowNode::Shared node, + ShadowNode::Shared const &node, Point point); /* diff --git a/ReactCommon/react/renderer/core/Props.cpp b/ReactCommon/react/renderer/core/Props.cpp index f502fccfdf24..81e316ff8427 100644 --- a/ReactCommon/react/renderer/core/Props.cpp +++ b/ReactCommon/react/renderer/core/Props.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/Props.h b/ReactCommon/react/renderer/core/Props.h index 5d99a0139a1e..56e918794169 100644 --- a/ReactCommon/react/renderer/core/Props.h +++ b/ReactCommon/react/renderer/core/Props.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/PropsParserContext.h b/ReactCommon/react/renderer/core/PropsParserContext.h index df4b16d70a59..7297fbba321e 100644 --- a/ReactCommon/react/renderer/core/PropsParserContext.h +++ b/ReactCommon/react/renderer/core/PropsParserContext.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawEvent.cpp b/ReactCommon/react/renderer/core/RawEvent.cpp index 3abace5171e2..1c7c5b8dc3e9 100644 --- a/ReactCommon/react/renderer/core/RawEvent.cpp +++ b/ReactCommon/react/renderer/core/RawEvent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawEvent.h b/ReactCommon/react/renderer/core/RawEvent.h index ff50464d4a3e..bd57b7e37c6a 100644 --- a/ReactCommon/react/renderer/core/RawEvent.h +++ b/ReactCommon/react/renderer/core/RawEvent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawProps.cpp b/ReactCommon/react/renderer/core/RawProps.cpp index 4776ce5ac810..45d63d48e2ab 100644 --- a/ReactCommon/react/renderer/core/RawProps.cpp +++ b/ReactCommon/react/renderer/core/RawProps.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,6 +8,7 @@ #include "RawProps.h" #include +#include #include namespace facebook { diff --git a/ReactCommon/react/renderer/core/RawProps.h b/ReactCommon/react/renderer/core/RawProps.h index 3cb96eca5fed..99b4a7e1eb9d 100644 --- a/ReactCommon/react/renderer/core/RawProps.h +++ b/ReactCommon/react/renderer/core/RawProps.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,15 +9,14 @@ #include -#include -#include -#include +#include +#include +#include #include #include #include #include -#include #include #include #include @@ -126,10 +125,10 @@ class RawProps final { * Parsed artefacts: * To be used by `RawPropParser`. */ - mutable better:: + mutable butter:: small_vector keyIndexToValueIndex_; - mutable better:: + mutable butter:: small_vector values_; }; diff --git a/ReactCommon/react/renderer/core/RawPropsKey.cpp b/ReactCommon/react/renderer/core/RawPropsKey.cpp index 35c8283f5e24..c70f8f6e28d6 100644 --- a/ReactCommon/react/renderer/core/RawPropsKey.cpp +++ b/ReactCommon/react/renderer/core/RawPropsKey.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,7 @@ #include "RawPropsKey.h" +#include #include #include @@ -44,11 +45,11 @@ void RawPropsKey::render(char *buffer, RawPropsPropNameLength *length) } RawPropsKey::operator std::string() const noexcept { - char buffer[kPropNameLengthHardCap]; + auto buffer = std::array(); RawPropsPropNameLength length = 0; - render(buffer, &length); + render(buffer.data(), &length); react_native_assert(length < kPropNameLengthHardCap); - return std::string{buffer, length}; + return std::string{buffer.data(), length}; } static bool areFieldsEqual(char const *lhs, char const *rhs) { diff --git a/ReactCommon/react/renderer/core/RawPropsKey.h b/ReactCommon/react/renderer/core/RawPropsKey.h index 097b153dd518..510600cddecd 100644 --- a/ReactCommon/react/renderer/core/RawPropsKey.h +++ b/ReactCommon/react/renderer/core/RawPropsKey.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp b/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp index af24fdb4a986..d978bf4eed7f 100644 --- a/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp +++ b/ReactCommon/react/renderer/core/RawPropsKeyMap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawPropsKeyMap.h b/ReactCommon/react/renderer/core/RawPropsKeyMap.h index 3c300a314090..f71dd094e5da 100644 --- a/ReactCommon/react/renderer/core/RawPropsKeyMap.h +++ b/ReactCommon/react/renderer/core/RawPropsKeyMap.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -55,8 +55,8 @@ class RawPropsKeyMap final { Item const &rhs) noexcept; static bool hasSameName(Item const &lhs, Item const &rhs) noexcept; - better::small_vector items_{}; - better::small_vector + butter::small_vector items_{}; + butter::small_vector buckets_{}; }; diff --git a/ReactCommon/react/renderer/core/RawPropsParser.cpp b/ReactCommon/react/renderer/core/RawPropsParser.cpp index db098e9fab5b..1c24b72c39ae 100644 --- a/ReactCommon/react/renderer/core/RawPropsParser.cpp +++ b/ReactCommon/react/renderer/core/RawPropsParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawPropsParser.h b/ReactCommon/react/renderer/core/RawPropsParser.h index 5d37cefd8c3b..da7dff6b1f6c 100644 --- a/ReactCommon/react/renderer/core/RawPropsParser.h +++ b/ReactCommon/react/renderer/core/RawPropsParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include #include @@ -76,7 +76,7 @@ class RawPropsParser final { RawValue const *at(RawProps const &rawProps, RawPropsKey const &key) const noexcept; - mutable better::small_vector + mutable butter::small_vector keys_{}; mutable RawPropsKeyMap nameToIndex_{}; mutable int size_{0}; diff --git a/ReactCommon/react/renderer/core/RawPropsPrimitives.h b/ReactCommon/react/renderer/core/RawPropsPrimitives.h index 97896332f1f2..bc5f2c9a8fdc 100644 --- a/ReactCommon/react/renderer/core/RawPropsPrimitives.h +++ b/ReactCommon/react/renderer/core/RawPropsPrimitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawValue.cpp b/ReactCommon/react/renderer/core/RawValue.cpp index 3193bf6e7cd5..d274c78a8b59 100644 --- a/ReactCommon/react/renderer/core/RawValue.cpp +++ b/ReactCommon/react/renderer/core/RawValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/RawValue.h b/ReactCommon/react/renderer/core/RawValue.h index 16cab0bd7b9c..b5a3da483147 100644 --- a/ReactCommon/react/renderer/core/RawValue.h +++ b/ReactCommon/react/renderer/core/RawValue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -78,7 +78,7 @@ class RawValue { /* * Copy constructor and copy assignment operator would be private and only for * internal use, but it's needed for user-code that does `auto val = - * (better::map)rawVal;` + * (butter::map)rawVal;` */ RawValue(RawValue const &other) noexcept : dynamic_(other.dynamic_) {} @@ -185,7 +185,7 @@ class RawValue { template static bool checkValueType( const folly::dynamic &dynamic, - better::map *type) noexcept { + butter::map *type) noexcept { if (!dynamic.isObject()) { return false; } @@ -267,11 +267,11 @@ class RawValue { } template - static better::map castValue( + static butter::map castValue( const folly::dynamic &dynamic, - better::map *type) noexcept { + butter::map *type) noexcept { react_native_assert(dynamic.isObject()); - auto result = better::map{}; + auto result = butter::map{}; for (const auto &item : dynamic.items()) { react_native_assert(item.first.isString()); result[item.first.getString()] = castValue(item.second, (T *)nullptr); diff --git a/ReactCommon/react/renderer/core/ReactEventPriority.h b/ReactCommon/react/renderer/core/ReactEventPriority.h index 3ef8b5728ebd..b3c17f90ba30 100644 --- a/ReactCommon/react/renderer/core/ReactEventPriority.h +++ b/ReactCommon/react/renderer/core/ReactEventPriority.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ReactPrimitives.h b/ReactCommon/react/renderer/core/ReactPrimitives.h index 28738394bf9e..823811306494 100644 --- a/ReactCommon/react/renderer/core/ReactPrimitives.h +++ b/ReactCommon/react/renderer/core/ReactPrimitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/Sealable.cpp b/ReactCommon/react/renderer/core/Sealable.cpp index 2326a4ed7b2f..abb839c8ea65 100644 --- a/ReactCommon/react/renderer/core/Sealable.cpp +++ b/ReactCommon/react/renderer/core/Sealable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,7 +35,7 @@ Sealable::Sealable(Sealable &&other) noexcept : sealed_(false) { other.ensureUnsealed(); }; -Sealable::~Sealable() noexcept {}; +Sealable::~Sealable() noexcept = default; Sealable &Sealable::operator=(const Sealable &other) { ensureUnsealed(); diff --git a/ReactCommon/react/renderer/core/Sealable.h b/ReactCommon/react/renderer/core/Sealable.h index f57c42eda5ac..c92d9a738007 100644 --- a/ReactCommon/react/renderer/core/Sealable.h +++ b/ReactCommon/react/renderer/core/Sealable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ShadowNode.cpp b/ReactCommon/react/renderer/core/ShadowNode.cpp index 4c7258c4cbb7..f0b96309fedc 100644 --- a/ReactCommon/react/renderer/core/ShadowNode.cpp +++ b/ReactCommon/react/renderer/core/ShadowNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ #include "DynamicPropsUtilities.h" #include "ShadowNodeFragment.h" -#include +#include #include #include @@ -17,6 +17,8 @@ #include #include +#include + namespace facebook { namespace react { @@ -58,7 +60,7 @@ bool ShadowNode::sameFamily(const ShadowNode &first, const ShadowNode &second) { ShadowNode::ShadowNode( ShadowNodeFragment const &fragment, - ShadowNodeFamily::Shared const &family, + ShadowNodeFamily::Shared family, ShadowNodeTraits traits) : #if RN_DEBUG_STRING_CONVERTIBLE @@ -70,7 +72,7 @@ ShadowNode::ShadowNode( : emptySharedShadowNodeSharedList()), state_(fragment.state), orderIndex_(0), - family_(family), + family_(std::move(family)), traits_(traits) { react_native_assert(props_); react_native_assert(children_); @@ -178,7 +180,7 @@ void ShadowNode::sealRecursive() const { props_->seal(); - for (auto child : *children_) { + for (auto const &child : *children_) { child->sealRecursive(); } } @@ -253,8 +255,8 @@ ShadowNodeFamily const &ShadowNode::getFamily() const { ShadowNode::Unshared ShadowNode::cloneTree( ShadowNodeFamily const &shadowNodeFamily, - std::function - callback) const { + std::function const + &callback) const { auto ancestors = shadowNodeFamily.getAncestors(*this); if (ancestors.empty()) { @@ -306,7 +308,7 @@ std::string ShadowNode::getDebugValue() const { SharedDebugStringConvertibleList ShadowNode::getDebugChildren() const { auto debugChildren = SharedDebugStringConvertibleList{}; - for (auto child : *children_) { + for (auto const &child : *children_) { auto debugChild = std::dynamic_pointer_cast(child); if (debugChild) { diff --git a/ReactCommon/react/renderer/core/ShadowNode.h b/ReactCommon/react/renderer/core/ShadowNode.h index 1ef71355f06f..eb60957c615a 100644 --- a/ReactCommon/react/renderer/core/ShadowNode.h +++ b/ReactCommon/react/renderer/core/ShadowNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include #include @@ -34,7 +34,7 @@ class ShadowNode; using SharedShadowNode = std::shared_ptr; using WeakShadowNode = std::weak_ptr; using SharedShadowNodeList = - better::small_vector; + butter::small_vector; using SharedShadowNodeSharedList = std::shared_ptr; using SharedShadowNodeUnsharedList = std::shared_ptr; @@ -44,14 +44,14 @@ class ShadowNode : public Sealable, public DebugStringConvertible { using Weak = std::weak_ptr; using Unshared = std::shared_ptr; using ListOfShared = - better::small_vector; + butter::small_vector; using ListOfWeak = - better::small_vector; + butter::small_vector; using SharedListOfShared = std::shared_ptr; using UnsharedListOfShared = std::shared_ptr; using UnsharedListOfWeak = std::shared_ptr; - using AncestorList = better::small_vector< + using AncestorList = butter::small_vector< std::pair< std::reference_wrapper /* parentNode */, int /* childIndex */>, @@ -80,7 +80,7 @@ class ShadowNode : public Sealable, public DebugStringConvertible { */ ShadowNode( ShadowNodeFragment const &fragment, - ShadowNodeFamily::Shared const &family, + ShadowNodeFamily::Shared family, ShadowNodeTraits traits); /* @@ -114,8 +114,8 @@ class ShadowNode : public Sealable, public DebugStringConvertible { */ ShadowNode::Unshared cloneTree( ShadowNodeFamily const &shadowNodeFamily, - std::function - callback) const; + std::function const + &callback) const; #pragma mark - Getters diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp b/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp index f4c064425560..73d022bf2efb 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp +++ b/ReactCommon/react/renderer/core/ShadowNodeFamily.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,6 +12,8 @@ #include #include +#include + namespace facebook { namespace react { @@ -21,7 +23,7 @@ ShadowNodeFamily::ShadowNodeFamily( ShadowNodeFamilyFragment const &fragment, EventDispatcher::Weak eventDispatcher, ComponentDescriptor const &componentDescriptor) - : eventDispatcher_(eventDispatcher), + : eventDispatcher_(std::move(eventDispatcher)), tag_(fragment.tag), surfaceId_(fragment.surfaceId), eventEmitter_(fragment.eventEmitter), @@ -57,7 +59,7 @@ const ComponentDescriptor &ShadowNodeFamily::getComponentDescriptor() const { AncestorList ShadowNodeFamily::getAncestors( ShadowNode const &ancestorShadowNode) const { - auto families = better::small_vector{}; + auto families = butter::small_vector{}; auto ancestorFamily = ancestorShadowNode.family_.get(); auto family = this; @@ -78,7 +80,7 @@ AncestorList ShadowNodeFamily::getAncestors( auto childIndex = 0; for (const auto &childNode : *parentNode->children_) { if (childNode->family_.get() == childFamily) { - ancestors.push_back({*parentNode, childIndex}); + ancestors.emplace_back(*parentNode, childIndex); parentNode = childNode.get(); found = true; break; @@ -96,12 +98,12 @@ AncestorList ShadowNodeFamily::getAncestors( } State::Shared ShadowNodeFamily::getMostRecentState() const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); return mostRecentState_; } void ShadowNodeFamily::setMostRecentState(State::Shared const &state) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); /* * Checking and setting `isObsolete_` prevents old states to be recommitted @@ -122,7 +124,7 @@ void ShadowNodeFamily::setMostRecentState(State::Shared const &state) const { std::shared_ptr ShadowNodeFamily::getMostRecentStateIfObsolete( State const &state) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); if (!state.isObsolete_) { return {}; } diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamily.h b/ReactCommon/react/renderer/core/ShadowNodeFamily.h index 07746e35501b..a4ed371ff790 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamily.h +++ b/ReactCommon/react/renderer/core/ShadowNodeFamily.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,8 +9,8 @@ #include -#include -#include +#include +#include #include #include @@ -32,7 +32,7 @@ class ShadowNodeFamily final { using Shared = std::shared_ptr; using Weak = std::weak_ptr; - using AncestorList = better::small_vector< + using AncestorList = butter::small_vector< std::pair< std::reference_wrapper /* parentNode */, int /* childIndex */>, @@ -101,7 +101,7 @@ class ShadowNodeFamily final { EventDispatcher::Weak eventDispatcher_; mutable std::shared_ptr mostRecentState_; - mutable better::shared_mutex mutex_; + mutable butter::shared_mutex mutex_; /* * Deprecated. diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.cpp b/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.cpp index a16da4317739..c744700c3fd7 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.cpp +++ b/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.h b/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.h index af380d6ff6c5..2f7aa4b148d9 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.h +++ b/ReactCommon/react/renderer/core/ShadowNodeFamilyFragment.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ShadowNodeFragment.cpp b/ReactCommon/react/renderer/core/ShadowNodeFragment.cpp index 37b11150c136..02793cc12450 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFragment.cpp +++ b/ReactCommon/react/renderer/core/ShadowNodeFragment.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ShadowNodeFragment.h b/ReactCommon/react/renderer/core/ShadowNodeFragment.h index 6fbdc49451c7..f1b95afa3fdd 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeFragment.h +++ b/ReactCommon/react/renderer/core/ShadowNodeFragment.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ShadowNodeTraits.cpp b/ReactCommon/react/renderer/core/ShadowNodeTraits.cpp index 6e200c32be37..999581dd1d9b 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeTraits.cpp +++ b/ReactCommon/react/renderer/core/ShadowNodeTraits.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ShadowNodeTraits.h b/ReactCommon/react/renderer/core/ShadowNodeTraits.h index 7c02f4bea94a..d222f74d8962 100644 --- a/ReactCommon/react/renderer/core/ShadowNodeTraits.h +++ b/ReactCommon/react/renderer/core/ShadowNodeTraits.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/State.cpp b/ReactCommon/react/renderer/core/State.cpp index e740557d3620..85c07a13fa19 100644 --- a/ReactCommon/react/renderer/core/State.cpp +++ b/ReactCommon/react/renderer/core/State.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,16 +12,20 @@ #include #include +#include + namespace facebook { namespace react { -State::State(StateData::Shared const &data, State const &state) - : family_(state.family_), data_(data), revision_(state.revision_ + 1){}; +State::State(StateData::Shared data, State const &state) + : family_(state.family_), + data_(std::move(data)), + revision_(state.revision_ + 1){}; -State::State( - StateData::Shared const &data, - ShadowNodeFamily::Shared const &family) - : family_(family), data_(data), revision_{State::initialRevisionValue} {}; +State::State(StateData::Shared data, ShadowNodeFamily::Shared const &family) + : family_(family), + data_(std::move(data)), + revision_{State::initialRevisionValue} {}; State::Shared State::getMostRecentState() const { auto family = family_.lock(); diff --git a/ReactCommon/react/renderer/core/State.h b/ReactCommon/react/renderer/core/State.h index ce5b51fe065e..6777bc5ca02a 100644 --- a/ReactCommon/react/renderer/core/State.h +++ b/ReactCommon/react/renderer/core/State.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -34,9 +34,9 @@ class State { * Constructors are protected to make calling them directly with * type-erasured arguments impossible. */ - explicit State(StateData::Shared const &data, State const &state); + explicit State(StateData::Shared data, State const &state); explicit State( - StateData::Shared const &data, + StateData::Shared data, ShadowNodeFamily::Shared const &family); public: diff --git a/ReactCommon/react/renderer/core/StateData.h b/ReactCommon/react/renderer/core/StateData.h index 36e098d1cd64..8f08b1bb6e60 100644 --- a/ReactCommon/react/renderer/core/StateData.h +++ b/ReactCommon/react/renderer/core/StateData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/StatePipe.h b/ReactCommon/react/renderer/core/StatePipe.h index ac79fad1a1d9..ace25817209a 100644 --- a/ReactCommon/react/renderer/core/StatePipe.h +++ b/ReactCommon/react/renderer/core/StatePipe.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/StateUpdate.cpp b/ReactCommon/react/renderer/core/StateUpdate.cpp index 5c910c13177a..ebbca947aa9e 100644 --- a/ReactCommon/react/renderer/core/StateUpdate.cpp +++ b/ReactCommon/react/renderer/core/StateUpdate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/StateUpdate.h b/ReactCommon/react/renderer/core/StateUpdate.h index 890e56d14109..b275d06e4bb5 100644 --- a/ReactCommon/react/renderer/core/StateUpdate.h +++ b/ReactCommon/react/renderer/core/StateUpdate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/UnbatchedEventQueue.cpp b/ReactCommon/react/renderer/core/UnbatchedEventQueue.cpp index 98210411f748..acdcfdcbf383 100644 --- a/ReactCommon/react/renderer/core/UnbatchedEventQueue.cpp +++ b/ReactCommon/react/renderer/core/UnbatchedEventQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/UnbatchedEventQueue.h b/ReactCommon/react/renderer/core/UnbatchedEventQueue.h index 7bf94054658b..a3626babb6ec 100644 --- a/ReactCommon/react/renderer/core/UnbatchedEventQueue.h +++ b/ReactCommon/react/renderer/core/UnbatchedEventQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/ValueFactory.h b/ReactCommon/react/renderer/core/ValueFactory.h index e5956d39dc2c..37adc1bea961 100644 --- a/ReactCommon/react/renderer/core/ValueFactory.h +++ b/ReactCommon/react/renderer/core/ValueFactory.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/conversions.h b/ReactCommon/react/renderer/core/conversions.h index 70dda9a9f558..726aaa81ff04 100644 --- a/ReactCommon/react/renderer/core/conversions.h +++ b/ReactCommon/react/renderer/core/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/propsConversions.h b/ReactCommon/react/renderer/core/propsConversions.h index 55e78f24303a..34881004c8ee 100644 --- a/ReactCommon/react/renderer/core/propsConversions.h +++ b/ReactCommon/react/renderer/core/propsConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -106,12 +106,12 @@ T convertRawProp( } template -static better::optional convertRawProp( +static butter::optional convertRawProp( const PropsParserContext &context, RawProps const &rawProps, char const *name, - better::optional const &sourceValue, - better::optional const &defaultValue, + butter::optional const &sourceValue, + butter::optional const &defaultValue, char const *namePrefix = nullptr, char const *nameSuffix = nullptr) { const auto *rawValue = rawProps.at(name, namePrefix, nameSuffix); @@ -128,7 +128,7 @@ static better::optional convertRawProp( T result; fromRawValue(context, *rawValue, result); - return better::optional{result}; + return butter::optional{result}; } } // namespace react diff --git a/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp b/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp index 35a12911b250..6340f2ba3155 100644 --- a/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp +++ b/ReactCommon/react/renderer/core/tests/ComponentDescriptorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/ConcreteShadowNodeTest.cpp b/ReactCommon/react/renderer/core/tests/ConcreteShadowNodeTest.cpp index 0b2d025d08ad..f5e49e727935 100644 --- a/ReactCommon/react/renderer/core/tests/ConcreteShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/core/tests/ConcreteShadowNodeTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/DynamicPropsUtilitiesTest.cpp b/ReactCommon/react/renderer/core/tests/DynamicPropsUtilitiesTest.cpp index b6666ad0842a..1ebb12b3a81c 100644 --- a/ReactCommon/react/renderer/core/tests/DynamicPropsUtilitiesTest.cpp +++ b/ReactCommon/react/renderer/core/tests/DynamicPropsUtilitiesTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/EventQueueProcessorTest.cpp b/ReactCommon/react/renderer/core/tests/EventQueueProcessorTest.cpp index 268a6a0aca90..feb6c16973a9 100644 --- a/ReactCommon/react/renderer/core/tests/EventQueueProcessorTest.cpp +++ b/ReactCommon/react/renderer/core/tests/EventQueueProcessorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp b/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp index 37f1c4106db6..6a9effc6e5e1 100644 --- a/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp +++ b/ReactCommon/react/renderer/core/tests/FindNodeAtPointTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp b/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp index c6dc5f68b5bf..bf98fb317ef4 100644 --- a/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/core/tests/LayoutableShadowNodeTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp b/ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp index f3b4d9bafbea..2827d9b45d58 100644 --- a/ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp +++ b/ReactCommon/react/renderer/core/tests/PrimitivesTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp b/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp index e54b623c9984..fe9080069657 100644 --- a/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp +++ b/ReactCommon/react/renderer/core/tests/RawPropsTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp b/ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp index 0009baeed7b0..238b4e579a76 100644 --- a/ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp +++ b/ReactCommon/react/renderer/core/tests/ShadowNodeFamilyTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp b/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp index 7039e56cfdfa..f876611d5330 100644 --- a/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp +++ b/ReactCommon/react/renderer/core/tests/ShadowNodeTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/TestComponent.h b/ReactCommon/react/renderer/core/tests/TestComponent.h index a396f1ba6217..0e9931cc46ae 100644 --- a/ReactCommon/react/renderer/core/tests/TestComponent.h +++ b/ReactCommon/react/renderer/core/tests/TestComponent.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp b/ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp index 2f7f6e96242e..30e186ed7c4e 100644 --- a/ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp +++ b/ReactCommon/react/renderer/core/tests/benchmarks/RawPropsBenchmark.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,10 +25,10 @@ auto viewComponentDescriptor = ViewComponentDescriptor{ auto emptyPropsDynamic = folly::parseJson("{}"); auto propsString = std::string{ - "{\"flex\": 1, \"padding\": 10, \"position\": \"absolute\", \"display\": \"none\", \"nativeID\": \"some-id\", \"direction\": \"rtl\"}"}; + R"({"flex": 1, "padding": 10, "position": "absolute", "display": "none", "nativeID": "some-id", "direction": "rtl"})"}; auto propsDynamic = folly::parseJson(propsString); auto propsStringWithSomeUnsupportedProps = std::string{ - "{\"someName1\": 1, \"someName2\": 10, \"someName3\": \"absolute\", \"someName4\": \"none\", \"someName5\": \"some-id\", \"someName6\": \"rtl\"}"}; + R"({"someName1": 1, "someName2": 10, "someName3": "absolute", "someName4": "none", "someName5": "some-id", "someName6": "rtl"})"}; auto unsupportedPropsDynamic = folly::parseJson(propsStringWithSomeUnsupportedProps); @@ -43,33 +43,42 @@ static void emptyPropCreation(benchmark::State &state) { BENCHMARK(emptyPropCreation); static void propParsingEmptyRawProps(benchmark::State &state) { + ContextContainer contextContainer{}; + PropsParserContext parserContext{-1, contextContainer}; for (auto _ : state) { viewComponentDescriptor.cloneProps( - sharedSourceProps, RawProps{emptyPropsDynamic}); + parserContext, sharedSourceProps, RawProps{emptyPropsDynamic}); } } BENCHMARK(propParsingEmptyRawProps); static void propParsingRegularRawProps(benchmark::State &state) { + ContextContainer contextContainer{}; + PropsParserContext parserContext{-1, contextContainer}; for (auto _ : state) { viewComponentDescriptor.cloneProps( - sharedSourceProps, RawProps{propsDynamic}); + parserContext, sharedSourceProps, RawProps{propsDynamic}); } } BENCHMARK(propParsingRegularRawProps); static void propParsingUnsupportedRawProps(benchmark::State &state) { + ContextContainer contextContainer{}; + PropsParserContext parserContext{-1, contextContainer}; for (auto _ : state) { viewComponentDescriptor.cloneProps( - sharedSourceProps, RawProps{unsupportedPropsDynamic}); + parserContext, sharedSourceProps, RawProps{unsupportedPropsDynamic}); } } BENCHMARK(propParsingUnsupportedRawProps); static void propParsingRegularRawPropsWithNoSourceProps( benchmark::State &state) { + ContextContainer contextContainer{}; + PropsParserContext parserContext{-1, contextContainer}; for (auto _ : state) { - viewComponentDescriptor.cloneProps(nullptr, RawProps{propsDynamic}); + viewComponentDescriptor.cloneProps( + parserContext, nullptr, RawProps{propsDynamic}); } } BENCHMARK(propParsingRegularRawPropsWithNoSourceProps); diff --git a/ReactCommon/react/renderer/core/tests/traitCastTest.cpp b/ReactCommon/react/renderer/core/tests/traitCastTest.cpp index e68e4b166633..1154257792ab 100644 --- a/ReactCommon/react/renderer/core/tests/traitCastTest.cpp +++ b/ReactCommon/react/renderer/core/tests/traitCastTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/debug/Android.mk b/ReactCommon/react/renderer/debug/Android.mk index e856283cc6a4..9f90ff9a5f7c 100644 --- a/ReactCommon/react/renderer/debug/Android.mk +++ b/ReactCommon/react/renderer/debug/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,6 +12,7 @@ LOCAL_MODULE := react_render_debug LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ diff --git a/ReactCommon/react/renderer/debug/BUCK b/ReactCommon/react/renderer/debug/BUCK index e4b2ee230358..1fb3ddbd8e89 100644 --- a/ReactCommon/react/renderer/debug/BUCK +++ b/ReactCommon/react/renderer/debug/BUCK @@ -31,6 +31,8 @@ rn_xplat_cxx_library( ], prefix = "react/renderer/debug", ), + compiler_flags_enable_exceptions = True, + compiler_flags_enable_rtti = True, # DebugStringConvertible fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), force_static = True, @@ -48,7 +50,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), ], ) diff --git a/ReactCommon/react/renderer/debug/DebugStringConvertible.cpp b/ReactCommon/react/renderer/debug/DebugStringConvertible.cpp index 7e2aa50e669a..fde19f4163a2 100644 --- a/ReactCommon/react/renderer/debug/DebugStringConvertible.cpp +++ b/ReactCommon/react/renderer/debug/DebugStringConvertible.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,7 +26,7 @@ std::string DebugStringConvertible::getDebugChildrenDescription( auto trailing = options.format ? std::string{"\n"} : std::string{""}; auto childrenString = std::string{""}; - for (auto child : getDebugChildren()) { + for (auto const &child : getDebugChildren()) { if (!child) { continue; } @@ -52,7 +52,7 @@ std::string DebugStringConvertible::getDebugPropsDescription( auto propsString = std::string{""}; - for (auto prop : getDebugProps()) { + for (auto const &prop : getDebugProps()) { if (!prop) { continue; } diff --git a/ReactCommon/react/renderer/debug/DebugStringConvertible.h b/ReactCommon/react/renderer/debug/DebugStringConvertible.h index 8833211cd259..a9a1ef02b4e3 100644 --- a/ReactCommon/react/renderer/debug/DebugStringConvertible.h +++ b/ReactCommon/react/renderer/debug/DebugStringConvertible.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp index 73606d87424a..9f074600c74e 100644 --- a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp +++ b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,17 +7,22 @@ #include "DebugStringConvertibleItem.h" +#include + namespace facebook { namespace react { #if RN_DEBUG_STRING_CONVERTIBLE DebugStringConvertibleItem::DebugStringConvertibleItem( - const std::string &name, - const std::string &value, - const SharedDebugStringConvertibleList &props, - const SharedDebugStringConvertibleList &children) - : name_(name), value_(value), debugProps_(props), children_(children) {} + std::string name, + std::string value, + SharedDebugStringConvertibleList props, + SharedDebugStringConvertibleList children) + : name_(std::move(name)), + value_(std::move(value)), + debugProps_(std::move(props)), + children_(std::move(children)) {} std::string DebugStringConvertibleItem::getDebugName() const { return name_; diff --git a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h index 600113d810a4..6f01c8b7e136 100644 --- a/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h +++ b/ReactCommon/react/renderer/debug/DebugStringConvertibleItem.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,10 +24,10 @@ class DebugStringConvertibleItem : public DebugStringConvertible { DebugStringConvertibleItem(const DebugStringConvertibleItem &item) = default; DebugStringConvertibleItem( - const std::string &name = "", - const std::string &value = "", - const SharedDebugStringConvertibleList &props = {}, - const SharedDebugStringConvertibleList &children = {}); + std::string name = "", + std::string value = "", + SharedDebugStringConvertibleList props = {}, + SharedDebugStringConvertibleList children = {}); std::string getDebugName() const override; std::string getDebugValue() const override; diff --git a/ReactCommon/react/renderer/debug/SystraceSection.h b/ReactCommon/react/renderer/debug/SystraceSection.h index 603c823b4e51..d3ccd0b4827e 100644 --- a/ReactCommon/react/renderer/debug/SystraceSection.h +++ b/ReactCommon/react/renderer/debug/SystraceSection.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h b/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h index a41054e2207b..fa8a5f8b19a0 100644 --- a/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h +++ b/ReactCommon/react/renderer/debug/debugStringConvertibleUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -34,7 +34,7 @@ debugStringConvertibleItem(std::string name, T value, T defaultValue = {}) { template inline SharedDebugStringConvertible debugStringConvertibleItem( std::string name, - better::optional value, + butter::optional value, T defaultValue = {}) { if (!value.hasValue()) { return nullptr; diff --git a/ReactCommon/react/renderer/debug/flags.h b/ReactCommon/react/renderer/debug/flags.h index 698c9a55fc52..0239bf6b0c77 100644 --- a/ReactCommon/react/renderer/debug/flags.h +++ b/ReactCommon/react/renderer/debug/flags.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp b/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp index 1220542c01e2..fa0210739172 100644 --- a/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp +++ b/ReactCommon/react/renderer/debug/tests/DebugStringConvertibleTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/element/ComponentBuilder.cpp b/ReactCommon/react/renderer/element/ComponentBuilder.cpp index c1438bb63aaf..e6e1dd300bea 100644 --- a/ReactCommon/react/renderer/element/ComponentBuilder.cpp +++ b/ReactCommon/react/renderer/element/ComponentBuilder.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,12 +7,14 @@ #include "ComponentBuilder.h" +#include + namespace facebook { namespace react { ComponentBuilder::ComponentBuilder( - ComponentDescriptorRegistry::Shared const &componentDescriptorRegistry) - : componentDescriptorRegistry_(componentDescriptorRegistry){}; + ComponentDescriptorRegistry::Shared componentDescriptorRegistry) + : componentDescriptorRegistry_(std::move(componentDescriptorRegistry)){}; ShadowNode::Unshared ComponentBuilder::build( ElementFragment const &elementFragment) const { diff --git a/ReactCommon/react/renderer/element/ComponentBuilder.h b/ReactCommon/react/renderer/element/ComponentBuilder.h index b47ba81bd5c4..458323c309c9 100644 --- a/ReactCommon/react/renderer/element/ComponentBuilder.h +++ b/ReactCommon/react/renderer/element/ComponentBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,7 +27,7 @@ namespace react { class ComponentBuilder final { public: ComponentBuilder( - ComponentDescriptorRegistry::Shared const &componentDescriptorRegistry); + ComponentDescriptorRegistry::Shared componentDescriptorRegistry); /* * Copyable and movable. diff --git a/ReactCommon/react/renderer/element/Element.cpp b/ReactCommon/react/renderer/element/Element.cpp index cf72b623347d..0960746950ca 100644 --- a/ReactCommon/react/renderer/element/Element.cpp +++ b/ReactCommon/react/renderer/element/Element.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/element/Element.h b/ReactCommon/react/renderer/element/Element.h index b6e36a789eff..67233ae33800 100644 --- a/ReactCommon/react/renderer/element/Element.h +++ b/ReactCommon/react/renderer/element/Element.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/element/ElementFragment.cpp b/ReactCommon/react/renderer/element/ElementFragment.cpp index 4421f09d3065..14cae7836e6d 100644 --- a/ReactCommon/react/renderer/element/ElementFragment.cpp +++ b/ReactCommon/react/renderer/element/ElementFragment.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/element/ElementFragment.h b/ReactCommon/react/renderer/element/ElementFragment.h index fd0807a2cece..6a14ed154804 100644 --- a/ReactCommon/react/renderer/element/ElementFragment.h +++ b/ReactCommon/react/renderer/element/ElementFragment.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/element/testUtils.h b/ReactCommon/react/renderer/element/testUtils.h index 4452c17c52d6..2d6a07141a66 100644 --- a/ReactCommon/react/renderer/element/testUtils.h +++ b/ReactCommon/react/renderer/element/testUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/element/tests/ElementTest.cpp b/ReactCommon/react/renderer/element/tests/ElementTest.cpp index ad79f4b65657..519047b8e17d 100644 --- a/ReactCommon/react/renderer/element/tests/ElementTest.cpp +++ b/ReactCommon/react/renderer/element/tests/ElementTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Android.mk b/ReactCommon/react/renderer/graphics/Android.mk index 94e3adbce79a..c888affce894 100644 --- a/ReactCommon/react/renderer/graphics/Android.mk +++ b/ReactCommon/react/renderer/graphics/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,8 +10,15 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_graphics LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/platform/cxx/react/renderer/graphics/*.cpp) - -LOCAL_SHARED_LIBRARIES := libfolly_json libreact_debug libfb libfbjni libfolly_json glog +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) + +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfb \ + libfbjni \ + libfolly_json \ + libfolly_json \ + libreact_debug LOCAL_STATIC_LIBRARIES := diff --git a/ReactCommon/react/renderer/graphics/BUCK b/ReactCommon/react/renderer/graphics/BUCK index 34748db24272..c8016ee5d93a 100644 --- a/ReactCommon/react/renderer/graphics/BUCK +++ b/ReactCommon/react/renderer/graphics/BUCK @@ -102,7 +102,7 @@ rn_xplat_cxx_library( visibility = ["PUBLIC"], deps = [ react_native_xplat_target("react/debug:debug"), - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), "//third-party/glog:glog", "//xplat/fbsystrace:fbsystrace", "//xplat/folly:headers_only", diff --git a/ReactCommon/react/renderer/graphics/ColorComponents.h b/ReactCommon/react/renderer/graphics/ColorComponents.h index 8dce73d31590..870a8c33ce7a 100644 --- a/ReactCommon/react/renderer/graphics/ColorComponents.h +++ b/ReactCommon/react/renderer/graphics/ColorComponents.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Geometry.h b/ReactCommon/react/renderer/graphics/Geometry.h index db3c3de4ffb1..409ee06667f8 100644 --- a/ReactCommon/react/renderer/graphics/Geometry.h +++ b/ReactCommon/react/renderer/graphics/Geometry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Point.h b/ReactCommon/react/renderer/graphics/Point.h index 41c0c4d0e280..fe05894862f4 100644 --- a/ReactCommon/react/renderer/graphics/Point.h +++ b/ReactCommon/react/renderer/graphics/Point.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/React-graphics.podspec b/ReactCommon/react/renderer/graphics/React-graphics.podspec index bb4913623839..e73a974d78d7 100644 --- a/ReactCommon/react/renderer/graphics/React-graphics.podspec +++ b/ReactCommon/react/renderer/graphics/React-graphics.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Rect.h b/ReactCommon/react/renderer/graphics/Rect.h index 19db0b44b6ac..8cb12dda0d05 100644 --- a/ReactCommon/react/renderer/graphics/Rect.h +++ b/ReactCommon/react/renderer/graphics/Rect.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/RectangleCorners.h b/ReactCommon/react/renderer/graphics/RectangleCorners.h index 771dc9f24b8e..438ee96a77d5 100644 --- a/ReactCommon/react/renderer/graphics/RectangleCorners.h +++ b/ReactCommon/react/renderer/graphics/RectangleCorners.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/RectangleEdges.h b/ReactCommon/react/renderer/graphics/RectangleEdges.h index 616abe07e7b2..65f6f5990e3d 100644 --- a/ReactCommon/react/renderer/graphics/RectangleEdges.h +++ b/ReactCommon/react/renderer/graphics/RectangleEdges.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Size.h b/ReactCommon/react/renderer/graphics/Size.h index 9c093cfd8ca8..c5e3e8a44bb5 100644 --- a/ReactCommon/react/renderer/graphics/Size.h +++ b/ReactCommon/react/renderer/graphics/Size.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Transform.cpp b/ReactCommon/react/renderer/graphics/Transform.cpp index 90a588b84ad6..b150fb8ca8a9 100644 --- a/ReactCommon/react/renderer/graphics/Transform.cpp +++ b/ReactCommon/react/renderer/graphics/Transform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/Transform.h b/ReactCommon/react/renderer/graphics/Transform.h index a346c713acc4..16baac06d2c6 100644 --- a/ReactCommon/react/renderer/graphics/Transform.h +++ b/ReactCommon/react/renderer/graphics/Transform.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/conversions.h b/ReactCommon/react/renderer/graphics/conversions.h index a30d03daf644..fba02b74d27c 100644 --- a/ReactCommon/react/renderer/graphics/conversions.h +++ b/ReactCommon/react/renderer/graphics/conversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -88,8 +88,8 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, Point &result) { - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "x") { result.x = pair.second; @@ -119,8 +119,8 @@ inline void fromRawValue( const PropsParserContext &context, const RawValue &value, Size &result) { - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "width") { result.width = pair.second; @@ -156,10 +156,11 @@ inline void fromRawValue( if (value.hasType()) { auto number = (Float)value; result = {number, number, number, number}; + return; } - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "top") { result.top = pair.second; @@ -202,8 +203,8 @@ inline void fromRawValue( return; } - if (value.hasType>()) { - auto map = (better::map)value; + if (value.hasType>()) { + auto map = (butter::map)value; for (const auto &pair : map) { if (pair.first == "topLeft") { result.topLeft = pair.second; diff --git a/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h b/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h index 950dd1ad8426..b158014071f9 100644 --- a/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h +++ b/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/PlatformColorParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,8 +21,8 @@ inline ColorComponents parsePlatformColor( const RawValue &value) { ColorComponents colorComponents = {0, 0, 0, 0}; - if (value.hasType>>()) { - auto map = (better::map>)value; + if (value.hasType>>()) { + auto map = (butter::map>)value; auto resourcePaths = map["resource_paths"]; auto dynamicResourcePaths = folly::dynamic::array(); for (const auto &resourcePath : resourcePaths) { diff --git a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp index 455ce60dc537..02c6bf82d4ab 100644 --- a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp +++ b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,7 +27,7 @@ SharedColor colorFromComponents(ColorComponents components) { ((int)round(components.blue * ratio) & 0xff)); } -ColorComponents colorComponentsFromColor(SharedColor sharedColor) { +ColorComponents colorComponentsFromColor(SharedColor const &sharedColor) { float ratio = 255; Color color = *sharedColor; return ColorComponents{ diff --git a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h index 34c7f6f53f3e..7de09df3adc5 100644 --- a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Color.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -61,7 +61,7 @@ class SharedColor { bool isColorMeaningful(SharedColor const &color) noexcept; SharedColor colorFromComponents(ColorComponents components); -ColorComponents colorComponentsFromColor(SharedColor color); +ColorComponents colorComponentsFromColor(SharedColor const &color); SharedColor clearColor(); SharedColor blackColor(); diff --git a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Float.h b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Float.h index b15a893bee1f..ef2c55c93ff2 100644 --- a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Float.h +++ b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/Float.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/PlatformColorParser.h b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/PlatformColorParser.h index c48403ba22ab..83809d751b01 100644 --- a/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/PlatformColorParser.h +++ b/ReactCommon/react/renderer/graphics/platform/cxx/react/renderer/graphics/PlatformColorParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp b/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp index 0c42253b94e9..61da5e26797f 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp +++ b/ReactCommon/react/renderer/graphics/platform/ios/Color.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/platform/ios/Color.h b/ReactCommon/react/renderer/graphics/platform/ios/Color.h index 5078b43f1e4b..43086364751b 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/Color.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/Color.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include diff --git a/ReactCommon/react/renderer/graphics/platform/ios/Float.h b/ReactCommon/react/renderer/graphics/platform/ios/Float.h index 2346e7b75f8d..4bee49ced99e 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/Float.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/Float.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h b/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h index 3437b280760d..28922fff67b2 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/PlatformColorParser.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,8 +18,8 @@ namespace react { inline ColorComponents parsePlatformColor( const PropsParserContext &context, const RawValue &value) { - if (value.hasType>()) { - auto items = (better::map)value; + if (value.hasType>()) { + auto items = (butter::map)value; if (items.find("semantic") != items.end() && items.at("semantic").hasType>()) { auto semanticItems = (std::vector)items.at("semantic"); diff --git a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.h b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.h index 6994c1e0b856..64eab12620bf 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.h +++ b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm index baa232423a85..f11b2af9e40e 100644 --- a/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm +++ b/ReactCommon/react/renderer/graphics/platform/ios/RCTPlatformColorUtils.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -187,16 +187,14 @@ facebook::react::ColorComponents RCTPlatformColorComponentsFromSemanticItems(std::vector &semanticItems) { for (const auto &semanticCString : semanticItems) { - if (@available(iOS 11.0, *)) { - NSString *semanticNSString = _NSStringFromCString(semanticCString); - UIColor *uiColor = [UIColor colorNamed:semanticNSString]; - if (uiColor != nil) { - return _ColorComponentsFromUIColor(uiColor); - } - uiColor = _UIColorFromSemanticString(semanticNSString); - if (uiColor != nil) { - return _ColorComponentsFromUIColor(uiColor); - } + NSString *semanticNSString = _NSStringFromCString(semanticCString); + UIColor *uiColor = [UIColor colorNamed:semanticNSString]; + if (uiColor != nil) { + return _ColorComponentsFromUIColor(uiColor); + } + uiColor = _UIColorFromSemanticString(semanticNSString); + if (uiColor != nil) { + return _ColorComponentsFromUIColor(uiColor); } } diff --git a/ReactCommon/react/renderer/graphics/rounding.h b/ReactCommon/react/renderer/graphics/rounding.h index b43b9d494d4b..bbdc7d33e161 100644 --- a/ReactCommon/react/renderer/graphics/rounding.h +++ b/ReactCommon/react/renderer/graphics/rounding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/tests/GraphicsTest.cpp b/ReactCommon/react/renderer/graphics/tests/GraphicsTest.cpp index 7a59aa1ac770..b338ccd0b1d5 100644 --- a/ReactCommon/react/renderer/graphics/tests/GraphicsTest.cpp +++ b/ReactCommon/react/renderer/graphics/tests/GraphicsTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/graphics/tests/TransformTest.cpp b/ReactCommon/react/renderer/graphics/tests/TransformTest.cpp index 9c40fc341f49..bcd0641d62f9 100644 --- a/ReactCommon/react/renderer/graphics/tests/TransformTest.cpp +++ b/ReactCommon/react/renderer/graphics/tests/TransformTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,7 @@ #include #include -#include +#include using namespace facebook::react; diff --git a/ReactCommon/react/renderer/imagemanager/Android.mk b/ReactCommon/react/renderer/imagemanager/Android.mk index 83f3ae91f45e..4489712b88a4 100644 --- a/ReactCommon/react/renderer/imagemanager/Android.mk +++ b/ReactCommon/react/renderer/imagemanager/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,8 +10,16 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_imagemanager LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/platform/cxx/react/renderer/imagemanager/*.cpp) - -LOCAL_SHARED_LIBRARIES := libfolly_json libyoga libfolly_json libreact_render_core libreact_render_debug libreact_render_graphics libreact_render_mounting libreact_debug +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) + +LOCAL_SHARED_LIBRARIES := \ + libfolly_json \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mounting \ + libyoga LOCAL_STATIC_LIBRARIES := diff --git a/ReactCommon/react/renderer/imagemanager/ImageManager.h b/ReactCommon/react/renderer/imagemanager/ImageManager.h index a6023e8e3d9f..f76912bf778d 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageManager.h +++ b/ReactCommon/react/renderer/imagemanager/ImageManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/ImageRequest.h b/ReactCommon/react/renderer/imagemanager/ImageRequest.h index 2c181d3b9b28..7d46def8a2c3 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageRequest.h +++ b/ReactCommon/react/renderer/imagemanager/ImageRequest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,7 +29,7 @@ class ImageRequest final { * The default constructor */ ImageRequest( - const ImageSource &imageSource, + ImageSource imageSource, std::shared_ptr telemetry); /* diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp b/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp index 361e5fe7f885..cde6adeb67bd 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp +++ b/ReactCommon/react/renderer/imagemanager/ImageResponse.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,13 +7,15 @@ #include "ImageResponse.h" +#include + namespace facebook { namespace react { ImageResponse::ImageResponse( - const std::shared_ptr &image, - const std::shared_ptr &metadata) - : image_(image), metadata_(metadata) {} + std::shared_ptr image, + std::shared_ptr metadata) + : image_(std::move(image)), metadata_(std::move(metadata)) {} std::shared_ptr ImageResponse::getImage() const { return image_; diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponse.h b/ReactCommon/react/renderer/imagemanager/ImageResponse.h index 23cc49f65bf6..41a32e0251c4 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponse.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponse.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,9 +23,7 @@ class ImageResponse final { Failed, }; - ImageResponse( - const std::shared_ptr &image, - const std::shared_ptr &metadata); + ImageResponse(std::shared_ptr image, std::shared_ptr metadata); std::shared_ptr getImage() const; diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h b/ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h index edb94835c7b6..5e3bca02cecf 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponseObserver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp index c75fa5b4c19f..46dea634105c 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp +++ b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h index 6b1f83015881..696d90569aa1 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h +++ b/ReactCommon/react/renderer/imagemanager/ImageResponseObserverCoordinator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include @@ -59,7 +59,7 @@ class ImageResponseObserverCoordinator { * List of observers. * Mutable: protected by mutex_. */ - mutable better::small_vector observers_; + mutable butter::small_vector observers_; /* * Current status of image loading. diff --git a/ReactCommon/react/renderer/imagemanager/ImageTelemetry.cpp b/ReactCommon/react/renderer/imagemanager/ImageTelemetry.cpp index 40524e5b0ff0..3373ce8b7939 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageTelemetry.cpp +++ b/ReactCommon/react/renderer/imagemanager/ImageTelemetry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/ImageTelemetry.h b/ReactCommon/react/renderer/imagemanager/ImageTelemetry.h index 1ffaffd0a4aa..2169590dbaad 100644 --- a/ReactCommon/react/renderer/imagemanager/ImageTelemetry.h +++ b/ReactCommon/react/renderer/imagemanager/ImageTelemetry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageManager.cpp b/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageManager.cpp index 245c3b5e7a78..b7f1274e351c 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageManager.cpp +++ b/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp b/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp index 9f811bc4d4a3..c270971dd277 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp +++ b/ReactCommon/react/renderer/imagemanager/platform/cxx/react/renderer/imagemanager/ImageRequest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,13 +7,15 @@ #include "ImageRequest.h" +#include + namespace facebook { namespace react { ImageRequest::ImageRequest( - const ImageSource &imageSource, + ImageSource imageSource, std::shared_ptr telemetry) - : imageSource_(imageSource), telemetry_(telemetry) { + : imageSource_(std::move(imageSource)), telemetry_(std::move(telemetry)) { // Not implemented. } diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/ImageManager.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageManager.mm index 3d37911aaf1a..9b833ae1a43d 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/ImageManager.mm +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp index ac01f5b1c190..1998d2917315 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/ImageRequest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,9 +11,9 @@ namespace facebook { namespace react { ImageRequest::ImageRequest( - ImageSource const &imageSource, + ImageSource imageSource, std::shared_ptr telemetry) - : imageSource_(imageSource), telemetry_(telemetry) { + : imageSource_(std::move(imageSource)), telemetry_(std::move(telemetry)) { coordinator_ = std::make_shared(); } diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h index 0b5814990ce4..88130fe07557 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm index 4922b96ef03d..d2023acc1e33 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h index a48d24ed313d..30bfbf391e35 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImageManagerProtocol.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h index ec37101afa1b..d72e61c63f0a 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTImagePrimitivesConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h index c48c0b077ef3..c0ef180bc22d 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm index 19aeafdc3009..5cb067c84f17 100644 --- a/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm +++ b/ReactCommon/react/renderer/imagemanager/platform/ios/RCTSyncImageManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/primitives.h b/ReactCommon/react/renderer/imagemanager/primitives.h index dd95a542e469..0d9ec9fc2539 100644 --- a/ReactCommon/react/renderer/imagemanager/primitives.h +++ b/ReactCommon/react/renderer/imagemanager/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp b/ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp index d9395d564732..e3823f879e98 100644 --- a/ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp +++ b/ReactCommon/react/renderer/imagemanager/tests/ImageManagerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/leakchecker/Android.mk b/ReactCommon/react/renderer/leakchecker/Android.mk index 48056bc8dd26..31dceaf7bebc 100644 --- a/ReactCommon/react/renderer/leakchecker/Android.mk +++ b/ReactCommon/react/renderer/leakchecker/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,10 +12,14 @@ LOCAL_MODULE := react_render_leakchecker LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ -LOCAL_SHARED_LIBRARIES := libruntimeexecutor libreact_render_core glog +LOCAL_SHARED_LIBRARIES := \ + glog \ + libreact_render_core \ + libruntimeexecutor LOCAL_CFLAGS := \ -DLOG_TAG=\"Fabric\" diff --git a/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp b/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp index a72e485665f2..b0ef65609a17 100644 --- a/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp +++ b/ReactCommon/react/renderer/leakchecker/LeakChecker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,11 +10,13 @@ #include #include +#include + namespace facebook { namespace react { -LeakChecker::LeakChecker(RuntimeExecutor const &runtimeExecutor) - : runtimeExecutor_(runtimeExecutor) {} +LeakChecker::LeakChecker(RuntimeExecutor runtimeExecutor) + : runtimeExecutor_(std::move(runtimeExecutor)) {} void LeakChecker::uiManagerDidCreateShadowNodeFamily( ShadowNodeFamily::Shared const &shadowNodeFamily) const { diff --git a/ReactCommon/react/renderer/leakchecker/LeakChecker.h b/ReactCommon/react/renderer/leakchecker/LeakChecker.h index a9bb3dd00409..c88b34a5e1a2 100644 --- a/ReactCommon/react/renderer/leakchecker/LeakChecker.h +++ b/ReactCommon/react/renderer/leakchecker/LeakChecker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,7 +20,7 @@ using GarbageCollectionTrigger = std::function; class LeakChecker final { public: - LeakChecker(RuntimeExecutor const &runtimeExecutor); + LeakChecker(RuntimeExecutor runtimeExecutor); void uiManagerDidCreateShadowNodeFamily( ShadowNodeFamily::Shared const &shadowNodeFamily) const; diff --git a/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.cpp b/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.cpp index ffb2e161d485..a2279a5ed626 100644 --- a/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.cpp +++ b/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.h b/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.h index 702eb05152ec..d8b0e8b777ff 100644 --- a/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.h +++ b/ReactCommon/react/renderer/leakchecker/WeakFamilyRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mapbuffer/Android.mk b/ReactCommon/react/renderer/mapbuffer/Android.mk index 57c51b2ec4c9..7b9250cf357e 100644 --- a/ReactCommon/react/renderer/mapbuffer/Android.mk +++ b/ReactCommon/react/renderer/mapbuffer/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_mapbuffer LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,7 +22,10 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := glog libglog_init libreact_debug +LOCAL_SHARED_LIBRARIES := \ + glog \ + libglog_init \ + libreact_debug include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp b/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp index 80e76dfb4f2e..94d8c87bd323 100644 --- a/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp +++ b/ReactCommon/react/renderer/mapbuffer/MapBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,43 +12,54 @@ using namespace facebook::react; namespace facebook { namespace react { -// TODO T83483191: Extend MapBuffer C++ implementation to support basic random -// access -MapBuffer::MapBuffer(uint8_t *const data, int32_t dataSize) { - react_native_assert( - (data != nullptr) && "Error trying to build an invalid MapBuffer"); - - // Should we move the memory here or document it? - data_ = data; +static inline int32_t bucketOffset(int32_t index) { + return sizeof(MapBuffer::Header) + sizeof(MapBuffer::Bucket) * index; +} - count_ = 0; - memcpy( - reinterpret_cast(&count_), - reinterpret_cast(data_ + HEADER_COUNT_OFFSET), - UINT16_SIZE); +static inline int32_t valueOffset(int32_t bucketIndex) { + return bucketOffset(bucketIndex) + offsetof(MapBuffer::Bucket, data); +} - // TODO T83483191: extract memcpy calls into an inline function to simplify - // the code - dataSize_ = 0; - memcpy( - reinterpret_cast(&dataSize_), - reinterpret_cast(data_ + HEADER_BUFFER_SIZE_OFFSET), - INT_SIZE); +// TODO T83483191: Extend MapBuffer C++ implementation to support basic random +// access +MapBuffer::MapBuffer(std::vector data) : bytes_(std::move(data)) { + auto header = reinterpret_cast
(bytes_.data()); + count_ = header->count; - if (dataSize != dataSize_) { - LOG(ERROR) << "Error: Data size does not match, expected " << dataSize - << " found: " << dataSize_; + if (header->bufferSize != bytes_.size()) { + LOG(ERROR) << "Error: Data size does not match, expected " + << header->bufferSize << " found: " << bytes_.size(); abort(); } } +int32_t MapBuffer::getKeyBucket(Key key) const { + int32_t lo = 0; + int32_t hi = count_ - 1; + while (lo <= hi) { + int32_t mid = (lo + hi) >> 1; + + Key midVal = + *reinterpret_cast(bytes_.data() + bucketOffset(mid)); + + if (midVal < key) { + lo = mid + 1; + } else if (midVal > key) { + hi = mid - 1; + } else { + return mid; + } + } + + return -1; +} + int32_t MapBuffer::getInt(Key key) const { - int32_t value = 0; - memcpy( - reinterpret_cast(&value), - reinterpret_cast(data_ + getValueOffset(key)), - INT_SIZE); - return value; + auto bucketIndex = getKeyBucket(key); + react_native_assert(bucketIndex != -1 && "Key not found in MapBuffer"); + + return *reinterpret_cast( + bytes_.data() + valueOffset(bucketIndex)); } bool MapBuffer::getBool(Key key) const { @@ -56,42 +67,30 @@ bool MapBuffer::getBool(Key key) const { } double MapBuffer::getDouble(Key key) const { - // TODO T83483191: extract this code into a "template method" and reuse it for - // other types - double value = 0; - memcpy( - reinterpret_cast(&value), - reinterpret_cast(data_ + getValueOffset(key)), - DOUBLE_SIZE); - return value; + auto bucketIndex = getKeyBucket(key); + react_native_assert(bucketIndex != -1 && "Key not found in MapBuffer"); + + return *reinterpret_cast( + bytes_.data() + valueOffset(bucketIndex)); } int32_t MapBuffer::getDynamicDataOffset() const { - // The begininig of dynamic data can be calculated as the offset of the next + // The start of dynamic data can be calculated as the offset of the next // key in the map - return getKeyOffset(count_); + return bucketOffset(count_); } std::string MapBuffer::getString(Key key) const { // TODO T83483191:Add checks to verify that offsets are under the boundaries // of the map buffer int32_t dynamicDataOffset = getDynamicDataOffset(); - int32_t stringLength = 0; int32_t offset = getInt(key); - memcpy( - reinterpret_cast(&stringLength), - reinterpret_cast(data_ + dynamicDataOffset + offset), - INT_SIZE); - - char *value = new char[stringLength]; + int32_t stringLength = *reinterpret_cast( + bytes_.data() + dynamicDataOffset + offset); + uint8_t const *stringPtr = + bytes_.data() + dynamicDataOffset + offset + sizeof(int); - memcpy( - reinterpret_cast(value), - reinterpret_cast( - data_ + dynamicDataOffset + offset + INT_SIZE), - stringLength); - - return std::string(value, 0, stringLength); + return std::string(stringPtr, stringPtr + stringLength); } MapBuffer MapBuffer::getMapBuffer(Key key) const { @@ -99,50 +98,30 @@ MapBuffer MapBuffer::getMapBuffer(Key key) const { // of the map buffer int32_t dynamicDataOffset = getDynamicDataOffset(); - int32_t mapBufferLength = 0; int32_t offset = getInt(key); - memcpy( - reinterpret_cast(&mapBufferLength), - reinterpret_cast(data_ + dynamicDataOffset + offset), - INT_SIZE); + int32_t mapBufferLength = *reinterpret_cast( + bytes_.data() + dynamicDataOffset + offset); - uint8_t *value = new Byte[mapBufferLength]; + std::vector value(mapBufferLength); memcpy( - reinterpret_cast(value), - reinterpret_cast( - data_ + dynamicDataOffset + offset + INT_SIZE), + value.data(), + bytes_.data() + dynamicDataOffset + offset + sizeof(int32_t), mapBufferLength); - return MapBuffer(value, mapBufferLength); + return MapBuffer(std::move(value)); } -bool MapBuffer::isNull(Key key) const { - return getInt(key) == NULL_VALUE; +size_t MapBuffer::size() const { + return bytes_.size(); } -int32_t MapBuffer::getBufferSize() const { - return dataSize_; -} - -void MapBuffer::copy(uint8_t *output) const { - memcpy(output, data_, dataSize_); -} - -uint16_t MapBuffer::getCount() const { - uint16_t size = 0; - - memcpy( - reinterpret_cast(&size), - reinterpret_cast(data_ + HEADER_COUNT_OFFSET), - - UINT16_SIZE); - - return size; +uint8_t const *MapBuffer::data() const { + return bytes_.data(); } -MapBuffer::~MapBuffer() { - delete[] data_; +uint16_t MapBuffer::count() const { + return count_; } } // namespace react diff --git a/ReactCommon/react/renderer/mapbuffer/MapBuffer.h b/ReactCommon/react/renderer/mapbuffer/MapBuffer.h index b3f0c3051f17..fe6830585123 100644 --- a/ReactCommon/react/renderer/mapbuffer/MapBuffer.h +++ b/ReactCommon/react/renderer/mapbuffer/MapBuffer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,20 +8,28 @@ #pragma once #include -#include -#include +#include + +#include +#include #include +#include +#include namespace facebook { namespace react { +class ReadableMapBuffer; + +// clang-format off + /** - * MapBuffer is an optimized map format for transferring data like props between - * C++ and other platforms The implementation of this map is optimized to: + * MapBuffer is an optimized sparse array format for transferring props-like + * between C++ and other VMs. The implementation of this map is optimized to: * - be compact to optimize space when sparse (sparse is the common case). * - be accessible through JNI with zero/minimal copying via ByteBuffer. - * - be Have excellent C++ single-write and many-read performance by maximizing + * - Have excellent C++ single-write and many-read performance by maximizing * CPU cache performance through compactness, data locality, and fixed offsets * where possible. * - be optimized for iteration and intersection against other maps, but with @@ -30,45 +38,113 @@ namespace react { * - Supports dynamic types that map to JSON. * - Don't require mutability - single-write on creation. * - have minimal APK size and build time impact. + * + * MapBuffer data is stored in a continuous chunk of memory (bytes_ field below) with the following layout: + * + * ┌─────────────────────Header──────────────────────┐ + * │ 10 bytes │ + * ├─Alignment─┬─Item count─┬──────Buffer size───────┤ + * │ 2 bytes │ 2 bytes │ 4 bytes │ + * └───────────┴────────────┴────────────────────────┘ + * ┌────────────────────────────────────────────────────────────────────────────────────────┐ + * │ Buckets (one per item in the map) │ + * │ │ + * ├───────────────────────────Bucket───────────────────────────┬───Bucket────┬─────────────┤ + * │ 12 bytes │ 12 bytes │ │ + * ├───Key───┬──Type───┬──────Value (primitive or offset)───────┤ ... │ ... │ + * │ 2 bytes │ 2 bytes │ 8 bytes │ │ │ + * └─────────┴─────────┴────────────────────────────────────────┴─────────────┴─────────────┘ + * ┌────────────────────────────────────────────────────────────────────────────────────────┐ + * │ Dynamic data │ + * │ │ + * │ Free-form data for complex objects (e.g. strings or nested MapBuffers). │ + * │ When dynamic data is serialized with some object, bucket value contains an offset of │ + * │ associated byte in the array. The format of the data is not restricted, but common │ + * │ practice is to use [length | bytes]. │ + * └────────────────────────────────────────────────────────────────────────────────────────┘ */ + +// clang-format on + class MapBuffer { - private: - // Buffer and its size - const uint8_t *data_ = nullptr; + public: + using Key = uint16_t; - // amount of bytes in the MapBuffer - int32_t dataSize_ = 0; + // The first value in the buffer, used to check correct encoding/endianness on + // JVM side. + constexpr static uint16_t HEADER_ALIGNMENT = 0xFE; - // amount of items in the MapBuffer - uint16_t count_ = 0; + struct Header { + uint16_t alignment = HEADER_ALIGNMENT; // alignment of serialization + uint16_t count; // amount of items in the map + uint32_t bufferSize; // Amount of bytes used to store the map in memory + }; - // returns the relative offset of the first byte of dynamic data - int32_t getDynamicDataOffset() const; +#pragma pack(push, 1) + struct Bucket { + Key key; + uint16_t type; + uint64_t data; - public: - MapBuffer(uint8_t *const data, int32_t dataSize); + Bucket(Key key, uint16_t type, uint64_t data) + : key(key), type(type), data(data) {} + }; +#pragma pack(pop) - ~MapBuffer(); + static_assert(sizeof(Header) == 8, "MapBuffer header size is incorrect."); + static_assert(sizeof(Bucket) == 12, "MapBuffer bucket size is incorrect."); - int32_t getInt(Key key) const; + /** + * Data types available for serialization in MapBuffer + * Keep in sync with `DataType` enum in `ReadableMapBuffer.java`, which + * expects the same values after reading them through JNI. + */ + enum DataType : uint16_t { + Boolean = 0, + Int = 1, + Double = 2, + String = 3, + Map = 4, + }; - bool getBool(Key key) const; + explicit MapBuffer(std::vector data); - double getDouble(Key key) const; + MapBuffer(MapBuffer const &buffer) = delete; - std::string getString(Key key) const; + MapBuffer &operator=(MapBuffer other) = delete; + + MapBuffer(MapBuffer &&buffer) = default; + + int32_t getInt(MapBuffer::Key key) const; + + bool getBool(MapBuffer::Key key) const; + + double getDouble(MapBuffer::Key key) const; + + std::string getString(MapBuffer::Key key) const; // TODO T83483191: review this declaration - MapBuffer getMapBuffer(Key key) const; + MapBuffer getMapBuffer(MapBuffer::Key key) const; + + size_t size() const; - int32_t getBufferSize() const; + uint8_t const *data() const; - // TODO T83483191: review parameters of copy method - void copy(uint8_t *output) const; + uint16_t count() const; + + private: + // Buffer and its size + std::vector const bytes_; + + // amount of items in the MapBuffer + uint16_t count_ = 0; + + // returns the relative offset of the first byte of dynamic data + int32_t getDynamicDataOffset() const; - bool isNull(Key key) const; + int32_t getKeyBucket(MapBuffer::Key key) const; - uint16_t getCount() const; + friend ReadableMapBuffer; }; } // namespace react diff --git a/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp b/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp index 4ff2f7b5c588..93883437012b 100644 --- a/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp +++ b/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp @@ -1,225 +1,148 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "MapBufferBuilder.h" +#include using namespace facebook::react; namespace facebook { namespace react { -// TODO T83483191: Add asserts to check overflowing on additions -MapBufferBuilder::MapBufferBuilder() - : MapBufferBuilder::MapBufferBuilder(INITIAL_KEY_VALUE_SIZE) {} +constexpr uint32_t INT_SIZE = sizeof(uint32_t); +constexpr uint32_t DOUBLE_SIZE = sizeof(double); +constexpr uint32_t MAX_BUCKET_VALUE_SIZE = sizeof(uint64_t); MapBuffer MapBufferBuilder::EMPTY() { - static auto emptyMap = MapBufferBuilder().build(); - return emptyMap; + return MapBufferBuilder(0).build(); } -MapBufferBuilder::MapBufferBuilder(uint16_t initialSize) { - keyValuesSize_ = initialSize; - keyValues_ = new Byte[keyValuesSize_]; - // First Key should be written right after the header. - keyValuesOffset_ = HEADER_SIZE; - - dynamicDataSize_ = 0; - dynamicDataValues_ = nullptr; - dynamicDataOffset_ = 0; -} - -void MapBufferBuilder::ensureKeyValueSpace() { - int32_t oldKeyValuesSize = keyValuesSize_; - react_native_assert( - (keyValuesSize_ < std::numeric_limits::max() / 2) && - "Error trying to assign a value beyond the capacity of uint16_t: "); - keyValuesSize_ *= 2; - uint8_t *newKeyValues = new Byte[keyValuesSize_]; - uint8_t *oldKeyValues = keyValues_; - memcpy(newKeyValues, keyValues_, oldKeyValuesSize); - keyValues_ = newKeyValues; - delete[] oldKeyValues; +MapBufferBuilder::MapBufferBuilder(uint32_t initialSize) { + buckets_.reserve(initialSize); + header_.count = 0; + header_.bufferSize = 0; } void MapBufferBuilder::storeKeyValue( - Key key, - uint8_t *value, - int32_t valueSize) { - if (key < minKeyToStore_) { - LOG(ERROR) << "Error: key out of order - key: " << key; - abort(); - } - if (valueSize > MAX_VALUE_SIZE) { + MapBuffer::Key key, + MapBuffer::DataType type, + uint8_t const *value, + uint32_t valueSize) { + if (valueSize > MAX_BUCKET_VALUE_SIZE) { LOG(ERROR) << "Error: size of value must be <= MAX_VALUE_SIZE. ValueSize: " << valueSize; abort(); } - // TODO T83483191: header.count points to the next index - // TODO T83483191: add test to verify storage of sparse keys - int32_t keyOffset = getKeyOffset(_header.count); - int32_t valueOffset = keyOffset + KEY_SIZE; + uint64_t data = 0; + auto *dataPtr = reinterpret_cast(&data); + memcpy(dataPtr, value, valueSize); - int32_t nextKeyValueOffset = keyOffset + BUCKET_SIZE; - if (nextKeyValueOffset >= keyValuesSize_) { - ensureKeyValueSpace(); - } - - memcpy(keyValues_ + keyOffset, &key, KEY_SIZE); - memcpy(keyValues_ + valueOffset, value, valueSize); + buckets_.emplace_back(key, static_cast(type), data); - _header.count++; - - minKeyToStore_ = key + 1; - // Move keyValuesOffset_ to the next available [key, value] position - keyValuesOffset_ = std::max(nextKeyValueOffset, keyValuesOffset_); -} + header_.count++; -void MapBufferBuilder::putBool(Key key, bool value) { - putInt(key, (int)value); -} - -void MapBufferBuilder::putDouble(Key key, double value) { - uint8_t *bytePointer = reinterpret_cast(&value); - storeKeyValue(key, bytePointer, DOUBLE_SIZE); + if (lastKey_ > key) { + needsSort_ = true; + } + lastKey_ = key; } -void MapBufferBuilder::putNull(Key key) { - putInt(key, NULL_VALUE); +void MapBufferBuilder::putBool(MapBuffer::Key key, bool value) { + int intValue = (int)value; + storeKeyValue( + key, + MapBuffer::DataType::Boolean, + reinterpret_cast(&intValue), + INT_SIZE); } -void MapBufferBuilder::putInt(Key key, int32_t value) { - uint8_t *bytePointer = reinterpret_cast(&(value)); - storeKeyValue(key, bytePointer, INT_SIZE); +void MapBufferBuilder::putDouble(MapBuffer::Key key, double value) { + storeKeyValue( + key, + MapBuffer::DataType::Double, + reinterpret_cast(&value), + DOUBLE_SIZE); } -void MapBufferBuilder::ensureDynamicDataSpace(int32_t size) { - if (dynamicDataValues_ == nullptr) { - dynamicDataSize_ = size; - dynamicDataValues_ = new Byte[dynamicDataSize_]; - dynamicDataOffset_ = 0; - return; - } - - if (dynamicDataOffset_ + size >= dynamicDataSize_) { - int32_t oldDynamicDataSize = dynamicDataSize_; - react_native_assert( - (dynamicDataSize_ < std::numeric_limits::max() / 2) && - "Error: trying to assign a value beyond the capacity of int"); - dynamicDataSize_ *= dynamicDataSize_; - - react_native_assert( - (dynamicDataSize_ < std::numeric_limits::max() - size) && - "Error: trying to assign a value beyond the capacity of int"); - - // sum size to ensure that the size always fit into newDynamicDataValues - dynamicDataSize_ += size; - uint8_t *newDynamicDataValues = new Byte[dynamicDataSize_]; - uint8_t *oldDynamicDataValues = dynamicDataValues_; - memcpy(newDynamicDataValues, dynamicDataValues_, oldDynamicDataSize); - dynamicDataValues_ = newDynamicDataValues; - delete[] oldDynamicDataValues; - } +void MapBufferBuilder::putInt(MapBuffer::Key key, int32_t value) { + storeKeyValue( + key, + MapBuffer::DataType::Int, + reinterpret_cast(&value), + INT_SIZE); } -void MapBufferBuilder::putString(Key key, std::string value) { - int32_t strLength = static_cast(value.length()); - const char *cstring = getCstring(&value); +void MapBufferBuilder::putString(MapBuffer::Key key, std::string const &value) { + auto strSize = value.size(); + const char *strData = value.data(); - // format [lenght of string (int)] + [Array of Characters in the string] - int32_t sizeOfLength = INT_SIZE; - // TODO T83483191: review if map.getBufferSize() should be an int32_t or long - // instead of an int16 (because strings can be longer than int16); - - int32_t sizeOfDynamicData = sizeOfLength + strLength; - ensureDynamicDataSpace(sizeOfDynamicData); - memcpy(dynamicDataValues_ + dynamicDataOffset_, &strLength, sizeOfLength); - memcpy( - dynamicDataValues_ + dynamicDataOffset_ + sizeOfLength, - cstring, - strLength); + // format [length of string (int)] + [Array of Characters in the string] + auto offset = dynamicData_.size(); + dynamicData_.resize(offset + INT_SIZE + strSize, 0); + memcpy(dynamicData_.data() + offset, &strSize, INT_SIZE); + memcpy(dynamicData_.data() + offset + INT_SIZE, strData, strSize); // Store Key and pointer to the string - putInt(key, dynamicDataOffset_); - - dynamicDataOffset_ += sizeOfDynamicData; + storeKeyValue( + key, + MapBuffer::DataType::String, + reinterpret_cast(&offset), + INT_SIZE); } -void MapBufferBuilder::putMapBuffer(Key key, MapBuffer &map) { - int32_t mapBufferSize = map.getBufferSize(); - - // format [lenght of buffer (int)] + [bytes of MapBuffer] - int32_t sizeOfDynamicData = mapBufferSize + INT_SIZE; +void MapBufferBuilder::putMapBuffer(MapBuffer::Key key, MapBuffer const &map) { + auto mapBufferSize = map.size(); - // format [Array of bytes of the mapBuffer] - ensureDynamicDataSpace(sizeOfDynamicData); + auto offset = dynamicData_.size(); - memcpy(dynamicDataValues_ + dynamicDataOffset_, &mapBufferSize, INT_SIZE); - // Copy the content of the map into dynamicDataValues_ - map.copy(dynamicDataValues_ + dynamicDataOffset_ + INT_SIZE); + // format [length of buffer (int)] + [bytes of MapBuffer] + dynamicData_.resize(offset + INT_SIZE + mapBufferSize, 0); + memcpy(dynamicData_.data() + offset, &mapBufferSize, INT_SIZE); + // Copy the content of the map into dynamicData_ + memcpy(dynamicData_.data() + offset + INT_SIZE, map.data(), mapBufferSize); // Store Key and pointer to the string - putInt(key, dynamicDataOffset_); + storeKeyValue( + key, + MapBuffer::DataType::Map, + reinterpret_cast(&offset), + INT_SIZE); +} - dynamicDataOffset_ += sizeOfDynamicData; +static inline bool compareBuckets( + MapBuffer::Bucket const &a, + MapBuffer::Bucket const &b) { + return a.key < b.key; } MapBuffer MapBufferBuilder::build() { - react_native_assert( - (keyValues_ != nullptr) && - "Error when building mapbuffer with invalid datastructures."); - // Create buffer: [header] + [key, values] + [dynamic data] - int32_t bufferSize = keyValuesOffset_ + dynamicDataOffset_; - - _header.bufferSize = bufferSize; - - // Copy header at the beginning of "keyValues_" - memcpy(keyValues_, &_header, HEADER_SIZE); - - uint8_t *buffer = new Byte[bufferSize]; - - memcpy(buffer, keyValues_, keyValuesOffset_); + auto bucketSize = buckets_.size() * sizeof(MapBuffer::Bucket); + auto headerSize = sizeof(MapBuffer::Header); + auto bufferSize = headerSize + bucketSize + dynamicData_.size(); - if (dynamicDataValues_ != nullptr) { - memcpy(buffer + keyValuesOffset_, dynamicDataValues_, dynamicDataOffset_); - } - - // TODO T83483191: should we use std::move here? - auto map = MapBuffer(buffer, bufferSize); + header_.bufferSize = static_cast(bufferSize); - // TODO T83483191: we should invalidate the class once the build() method is - // called. - - if (keyValues_ != nullptr) { - delete[] keyValues_; + if (needsSort_) { + std::sort(buckets_.begin(), buckets_.end(), compareBuckets); } - keyValues_ = nullptr; - keyValuesSize_ = 0; - keyValuesOffset_ = 0; - if (dynamicDataValues_ != nullptr) { - delete[] dynamicDataValues_; - dynamicDataValues_ = nullptr; - } - dynamicDataSize_ = 0; - dynamicDataOffset_ = 0; - _header = {ALIGNMENT, 0, 0}; + // TODO(T83483191): add pass to check for duplicates - return map; -} + std::vector buffer(bufferSize); + memcpy(buffer.data(), &header_, headerSize); + memcpy(buffer.data() + headerSize, buckets_.data(), bucketSize); + memcpy( + buffer.data() + headerSize + bucketSize, + dynamicData_.data(), + dynamicData_.size()); -MapBufferBuilder::~MapBufferBuilder() { - if (keyValues_ != nullptr) { - delete[] keyValues_; - } - if (dynamicDataValues_ != nullptr) { - delete[] dynamicDataValues_; - } + return MapBuffer(std::move(buffer)); } } // namespace react diff --git a/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h b/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h index d46dd8fbea0a..aa8ae8794074 100644 --- a/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h +++ b/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,85 +9,50 @@ #include #include -#include -#include namespace facebook { namespace react { -// Default initial size for _keyValues array -// 108 = 10 entries = 10*10 + 8 sizeof(header) -constexpr uint16_t INITIAL_KEY_VALUE_SIZE = 108; - -// Default initial size for _dynamicDataValues array -constexpr int32_t INITIAL_DYNAMIC_DATA_SIZE = 200; +// Default reserved size for buckets_ vector +constexpr uint32_t INITIAL_BUCKETS_SIZE = 10; /** * MapBufferBuilder is a builder class for MapBuffer */ class MapBufferBuilder { - private: - Header _header = {ALIGNMENT, 0, 0}; - - void ensureKeyValueSpace(); - - void ensureDynamicDataSpace(int32_t size); - - void storeKeyValue(Key key, uint8_t *value, int32_t valueSize); - - // Array of [key,value] map entries: - // - Key is represented in 2 bytes - // - Value is stored into 8 bytes. The 8 bytes of the value will contain the - // actual value for the key or a pointer to the actual value (based on the - // type) - uint8_t *keyValues_ = nullptr; - - // Amount of bytes allocated on _keyValues - uint16_t keyValuesSize_ = 0; - - // Relative offset on the _keyValues array. - // This represents the first byte that can be written in _keyValues array - int32_t keyValuesOffset_ = 0; - - // This array contains data for dynamic values in the MapBuffer. - // A dynamic value is a String or another MapBuffer. - uint8_t *dynamicDataValues_ = nullptr; - - // Amount of bytes allocated on _dynamicDataValues - int32_t dynamicDataSize_ = 0; + public: + MapBufferBuilder(uint32_t initialSize = INITIAL_BUCKETS_SIZE); - // Relative offset on the _dynamicDataValues array. - // This represents the first byte that can be written in _dynamicDataValues - // array - int32_t dynamicDataOffset_ = 0; + static MapBuffer EMPTY(); - // Minimmum key to store in the MapBuffer (this is used to guarantee - // consistency) - uint16_t minKeyToStore_ = 0; + void putInt(MapBuffer::Key key, int32_t value); - public: - MapBufferBuilder(); + void putBool(MapBuffer::Key key, bool value); - MapBufferBuilder(uint16_t initialSize); + void putDouble(MapBuffer::Key key, double value); - ~MapBufferBuilder(); + void putString(MapBuffer::Key key, std::string const &value); - static MapBuffer EMPTY(); + void putMapBuffer(MapBuffer::Key key, MapBuffer const &map); - void putInt(Key key, int32_t value); + MapBuffer build(); - void putBool(Key key, bool value); + private: + MapBuffer::Header header_; - void putDouble(Key key, double value); + std::vector buckets_{}; - void putNull(Key key); + std::vector dynamicData_{}; - void putString(Key key, std::string value); + uint16_t lastKey_{0}; - void putMapBuffer(Key key, MapBuffer &map); + bool needsSort_{false}; - // TODO T83483191: This should return MapBuffer! - MapBuffer build(); + void storeKeyValue( + MapBuffer::Key key, + MapBuffer::DataType type, + uint8_t const *value, + uint32_t valueSize); }; } // namespace react diff --git a/ReactCommon/react/renderer/mapbuffer/primitives.h b/ReactCommon/react/renderer/mapbuffer/primitives.h deleted file mode 100644 index 456e0b9e12d1..000000000000 --- a/ReactCommon/react/renderer/mapbuffer/primitives.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#pragma once - -#include - -// TODO T83483191: Enable CHECK_CONSISTENCY only in debug mode or test -// environments (or just in demand) #define CHECK_CONSISTENCY 1 - -constexpr static int32_t NULL_VALUE = 0; - -// Value used to verify if the data is serialized with LittleEndian order -constexpr static uint16_t ALIGNMENT = 0xFE; - -using Key = uint16_t; - -using Byte = uint8_t; - -namespace facebook { -namespace react { - -struct Header { - uint16_t alignment; // alignment of serialization - uint16_t count; // amount of items in the map - int32_t bufferSize; // Amount of bytes used to store the map in memory -}; - -constexpr static int32_t KEY_SIZE = sizeof(Key); -constexpr static int32_t HEADER_SIZE = sizeof(Header); -constexpr static int32_t INT_SIZE = sizeof(int32_t); -constexpr static int32_t DOUBLE_SIZE = sizeof(double); -constexpr static int32_t UINT8_SIZE = sizeof(uint8_t); -constexpr static int32_t UINT16_SIZE = sizeof(uint16_t); -constexpr static int32_t UINT64_SIZE = sizeof(uint64_t); -constexpr static int32_t HEADER_ALIGNMENT_OFFSET = 0; -constexpr static int32_t HEADER_COUNT_OFFSET = UINT16_SIZE; -constexpr static int32_t HEADER_BUFFER_SIZE_OFFSET = UINT16_SIZE * 2; - -constexpr static int32_t MAX_VALUE_SIZE = UINT64_SIZE; - -// 10 bytes : 2 key + 8 value -constexpr static int32_t BUCKET_SIZE = KEY_SIZE + UINT64_SIZE; - -/** - * Returns the offset of the key received by parameter. - */ -inline int32_t getKeyOffset(Key key) { - return HEADER_SIZE + BUCKET_SIZE * key; -} - -/** - * Returns the offset of the value associated to the key received by parameter. - */ -inline int32_t getValueOffset(Key key) { - return getKeyOffset(key) + KEY_SIZE; -} - -static inline const char *getCstring(const std::string *str) { - return str ? str->c_str() : ""; -} - -inline void -checkKeyConsistency(const Header &header, const uint8_t *data, Key key) { -#ifdef CHECK_CONSISTENCY - if (key >= header.count) { - LOG(ERROR) << "Error: Key is higher than size of Map - key '" << key - << "' - size: '" << header.count << "'"; - assert(false && "Error while reading key"); - } - - Key storedKey = 0; - memcpy( - reinterpret_cast(&storedKey), - reinterpret_cast(data + getKeyOffset(key)), - KEY_SIZE); - - if (storedKey != key) { - LOG(ERROR) << "Error while reading key, expecting '" << key << "' found: '" - << storedKey << "'"; - assert(false && "Error while reading key"); - } -#endif -} - -} // namespace react -} // namespace facebook diff --git a/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp b/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp index 9dd36eeb6df9..f0d5c737541a 100644 --- a/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp +++ b/ReactCommon/react/renderer/mapbuffer/tests/MapBufferTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -21,7 +21,7 @@ TEST(MapBufferTest, testSimpleIntMap) { auto map = builder.build(); - EXPECT_EQ(map.getCount(), 2); + EXPECT_EQ(map.count(), 2); EXPECT_EQ(map.getInt(0), 1234); EXPECT_EQ(map.getInt(1), 4321); } @@ -38,7 +38,7 @@ TEST(MapBufferTest, testMapBufferExtension) { auto map = buffer.build(); - EXPECT_EQ(map.getCount(), 4); + EXPECT_EQ(map.count(), 4); EXPECT_EQ(map.getInt(0), 1234); EXPECT_EQ(map.getInt(1), 4321); @@ -54,28 +54,11 @@ TEST(MapBufferTest, testBoolEntries) { auto map = buffer.build(); - EXPECT_EQ(map.getCount(), 2); + EXPECT_EQ(map.count(), 2); EXPECT_EQ(map.getBool(0), true); EXPECT_EQ(map.getBool(1), false); } -TEST(MapBufferTest, testNullEntries) { - auto buffer = MapBufferBuilder(); - - buffer.putNull(0); - buffer.putInt(1, 1234); - - auto map = buffer.build(); - - EXPECT_EQ(map.getCount(), 2); - EXPECT_EQ(map.isNull(0), true); - EXPECT_EQ(map.isNull(1), false); - // TODO T83483191: serialize null values to be distinguishable from '0' - // values - // EXPECT_EQ(map.isNull(1), false); - // EXPECT_EQ(map.getBool(1), false); -} - TEST(MapBufferTest, testDoubleEntries) { auto buffer = MapBufferBuilder(); @@ -84,7 +67,7 @@ TEST(MapBufferTest, testDoubleEntries) { auto map = buffer.build(); - EXPECT_EQ(map.getCount(), 2); + EXPECT_EQ(map.count(), 2); EXPECT_EQ(map.getDouble(0), 123.4); EXPECT_EQ(map.getDouble(1), 432.1); @@ -108,6 +91,18 @@ TEST(MapBufferTest, testUTFStringEntry) { EXPECT_EQ(map.getString(0), "Let's count: 的, 一, 是"); } +TEST(MapBufferTest, testEmojiStringEntry) { + auto builder = MapBufferBuilder(); + + builder.putString( + 0, "Let's count: 1️⃣, 2️⃣, 3️⃣, 🤦🏿‍♀️"); + auto map = builder.build(); + + EXPECT_EQ( + map.getString(0), + "Let's count: 1️⃣, 2️⃣, 3️⃣, 🤦🏿‍♀️"); +} + TEST(MapBufferTest, testUTFStringEntries) { auto builder = MapBufferBuilder(); @@ -122,12 +117,12 @@ TEST(MapBufferTest, testUTFStringEntries) { TEST(MapBufferTest, testEmptyMap) { auto builder = MapBufferBuilder(); auto map = builder.build(); - EXPECT_EQ(map.getCount(), 0); + EXPECT_EQ(map.count(), 0); } TEST(MapBufferTest, testEmptyMapConstant) { auto map = MapBufferBuilder::EMPTY(); - EXPECT_EQ(map.getCount(), 0); + EXPECT_EQ(map.count(), 0); } TEST(MapBufferTest, testMapEntries) { @@ -136,7 +131,7 @@ TEST(MapBufferTest, testMapEntries) { builder.putInt(1, 1234); auto map = builder.build(); - EXPECT_EQ(map.getCount(), 2); + EXPECT_EQ(map.count(), 2); EXPECT_EQ(map.getString(0), "This is a test"); EXPECT_EQ(map.getInt(1), 1234); @@ -145,12 +140,27 @@ TEST(MapBufferTest, testMapEntries) { builder2.putMapBuffer(1, map); auto map2 = builder2.build(); - EXPECT_EQ(map2.getCount(), 2); + EXPECT_EQ(map2.count(), 2); EXPECT_EQ(map2.getInt(0), 4321); MapBuffer readMap2 = map2.getMapBuffer(1); - EXPECT_EQ(readMap2.getCount(), 2); + EXPECT_EQ(readMap2.count(), 2); EXPECT_EQ(readMap2.getString(0), "This is a test"); EXPECT_EQ(readMap2.getInt(1), 1234); } + +TEST(MapBufferTest, testMapRandomAccess) { + auto builder = MapBufferBuilder(); + builder.putInt(1234, 4321); + builder.putString(0, "This is a test"); + builder.putDouble(8, 908.1); + builder.putString(65535, "Let's count: 的, 一, 是"); + auto map = builder.build(); + + EXPECT_EQ(map.count(), 4); + EXPECT_EQ(map.getString(0), "This is a test"); + EXPECT_EQ(map.getDouble(8), 908.1); + EXPECT_EQ(map.getInt(1234), 4321); + EXPECT_EQ(map.getString(65535), "Let's count: 的, 一, 是"); +} diff --git a/ReactCommon/react/renderer/mounting/Android.mk b/ReactCommon/react/renderer/mounting/Android.mk index efd902e42cad..c229b305d61d 100644 --- a/ReactCommon/react/renderer/mounting/Android.mk +++ b/ReactCommon/react/renderer/mounting/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_mounting LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,11 +22,26 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libjsi libbetter libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug librrc_view librrc_root libreact_utils libreact_debug libreact_render_graphics libreact_render_telemetry +LOCAL_SHARED_LIBRARIES := \ + glog \ + libbutter \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_telemetry \ + libreact_utils \ + librrc_root \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) -$(call import-module,better) +$(call import-module,butter) $(call import-module,glog) $(call import-module,folly) $(call import-module,fbgloginit) diff --git a/ReactCommon/react/renderer/mounting/BUCK b/ReactCommon/react/renderer/mounting/BUCK index 20a434f8687e..365ad353ce4d 100644 --- a/ReactCommon/react/renderer/mounting/BUCK +++ b/ReactCommon/react/renderer/mounting/BUCK @@ -50,7 +50,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), react_native_xplat_target("react/renderer/components/root:root"), react_native_xplat_target("react/renderer/components/view:view"), diff --git a/ReactCommon/react/renderer/mounting/Differentiator.cpp b/ReactCommon/react/renderer/mounting/Differentiator.cpp index a37e90758fcb..590358ed6698 100644 --- a/ReactCommon/react/renderer/mounting/Differentiator.cpp +++ b/ReactCommon/react/renderer/mounting/Differentiator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ #include "Differentiator.h" -#include -#include +#include +#include #include #include #include @@ -168,7 +168,7 @@ class TinyMap final { erasedAtFront_ = 0; } - better::small_vector vector_; + butter::small_vector vector_; size_t numErased_{0}; size_t erasedAtFront_{0}; }; @@ -895,8 +895,8 @@ static void calculateShadowViewMutationsFlattener( // Construct unvisited nodes map auto unvisitedRecursiveChildPairs = TinyMap{}; - for (size_t i = 0; i < flattenedNodes.size(); i++) { - auto &newChild = *flattenedNodes[i]; + for (auto &flattenedNode : flattenedNodes) { + auto &newChild = *flattenedNode; auto unvisitedOtherNodesIt = unvisitedOtherNodes.find(newChild.shadowView.tag); @@ -959,14 +959,12 @@ static void calculateShadowViewMutationsFlattener( // If old nodes were not visited, we know that we can delete them // now. They will be removed from the hierarchy by the outermost // loop of this function. - for (auto unvisitedOldChildPairIt = - unvisitedRecursiveChildPairs.begin(); - unvisitedOldChildPairIt != unvisitedRecursiveChildPairs.end(); - unvisitedOldChildPairIt++) { - if (unvisitedOldChildPairIt->first == 0) { + for (auto &unvisitedRecursiveChildPair : + unvisitedRecursiveChildPairs) { + if (unvisitedRecursiveChildPair.first == 0) { continue; } - auto &oldFlattenedNode = *unvisitedOldChildPairIt->second; + auto &oldFlattenedNode = *unvisitedRecursiveChildPair.second; // Node unvisited - mark the entire subtree for deletion if (oldFlattenedNode.isConcreteView && @@ -1026,13 +1024,11 @@ static void calculateShadowViewMutationsFlattener( // Final step: go through creation/deletion candidates and delete/create // subtrees if they were never visited during the execution of the above // loop and recursions. - for (auto it = deletionCreationCandidatePairs.begin(); - it != deletionCreationCandidatePairs.end(); - it++) { - if (it->first == 0) { + for (auto &deletionCreationCandidatePair : deletionCreationCandidatePairs) { + if (deletionCreationCandidatePair.first == 0) { continue; } - auto &treeChildPair = *it->second; + auto &treeChildPair = *deletionCreationCandidatePair.second; // If node was visited during a flattening/unflattening recursion, // and the node in the other tree is concrete, that means it was @@ -1477,14 +1473,12 @@ static void calculateShadowViewMutationsV2( // subtrees/nodes. We do this here because we need to traverse the entire // list to make sure that a node was not reparented into an unflattened // node that occurs *after* it in the hierarchy, due to zIndex ordering. - for (auto it = deletionCandidatePairs.begin(); - it != deletionCandidatePairs.end(); - it++) { - if (it->first == 0) { + for (auto &deletionCandidatePair : deletionCandidatePairs) { + if (deletionCandidatePair.first == 0) { continue; } - auto const &oldChildPair = *it->second; + auto const &oldChildPair = *deletionCandidatePair.second; DEBUG_LOGS({ LOG(ERROR) @@ -1520,17 +1514,16 @@ static void calculateShadowViewMutationsV2( // Final step: generate Create instructions for entirely new // subtrees/nodes that are not the result of flattening or unflattening. - for (auto it = newInsertedPairs.begin(); it != newInsertedPairs.end(); - it++) { + for (auto &newInsertedPair : newInsertedPairs) { // Erased elements of a TinyMap will have a Tag/key of 0 - skip those // These *should* be removed by the map; there are currently no KNOWN // cases where TinyMap will do the wrong thing, but there are not yet // any unit tests explicitly for TinyMap, so this is safer for now. - if (it->first == 0) { + if (newInsertedPair.first == 0) { continue; } - auto const &newChildPair = *it->second; + auto const &newChildPair = *newInsertedPair.second; DEBUG_LOGS({ LOG(ERROR) diff --git a/ReactCommon/react/renderer/mounting/Differentiator.h b/ReactCommon/react/renderer/mounting/Differentiator.h index 551173652c82..6d7cbfa58d35 100644 --- a/ReactCommon/react/renderer/mounting/Differentiator.h +++ b/ReactCommon/react/renderer/mounting/Differentiator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp index 98001cfa1c1f..6546e0c11adf 100644 --- a/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -75,11 +75,11 @@ void MountingCoordinator::resetLatestRevision() const { lastRevision_.reset(); } -better::optional MountingCoordinator::pullTransaction() +butter::optional MountingCoordinator::pullTransaction() const { std::lock_guard lock(mutex_); - auto transaction = better::optional{}; + auto transaction = butter::optional{}; // Base case if (lastRevision_.has_value()) { @@ -183,7 +183,7 @@ TelemetryController const &MountingCoordinator::getTelemetryController() const { void MountingCoordinator::setMountingOverrideDelegate( std::weak_ptr delegate) const { std::lock_guard lock(mutex_); - mountingOverrideDelegate_ = delegate; + mountingOverrideDelegate_ = std::move(delegate); } } // namespace react diff --git a/ReactCommon/react/renderer/mounting/MountingCoordinator.h b/ReactCommon/react/renderer/mounting/MountingCoordinator.h index 00c12ba06858..6d6e1e4623de 100644 --- a/ReactCommon/react/renderer/mounting/MountingCoordinator.h +++ b/ReactCommon/react/renderer/mounting/MountingCoordinator.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -56,7 +56,7 @@ class MountingCoordinator final { * However, a consumer should always call it on the same thread (e.g. on the * main thread) or ensure sequentiality of mount transactions separately. */ - better::optional pullTransaction() const; + butter::optional pullTransaction() const; /* * Blocks the current thread until a new mounting transaction is available or @@ -104,7 +104,7 @@ class MountingCoordinator final { mutable std::mutex mutex_; mutable ShadowTreeRevision baseRevision_; - mutable better::optional lastRevision_{}; + mutable butter::optional lastRevision_{}; mutable MountingTransaction::Number number_{0}; mutable std::condition_variable signal_; mutable std::weak_ptr diff --git a/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h b/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h index 5aa95d4d80f0..67c2b876cb0a 100644 --- a/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h +++ b/ReactCommon/react/renderer/mounting/MountingOverrideDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +36,7 @@ class MountingOverrideDelegate { * @param mountingCoordinator * @return */ - virtual better::optional pullTransaction( + virtual butter::optional pullTransaction( SurfaceId surfaceId, MountingTransaction::Number number, TransactionTelemetry const &telemetry, diff --git a/ReactCommon/react/renderer/mounting/MountingTransaction.cpp b/ReactCommon/react/renderer/mounting/MountingTransaction.cpp index 6fce3907303e..19a814f8a067 100644 --- a/ReactCommon/react/renderer/mounting/MountingTransaction.cpp +++ b/ReactCommon/react/renderer/mounting/MountingTransaction.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/MountingTransaction.h b/ReactCommon/react/renderer/mounting/MountingTransaction.h index 6f0bbee60fe3..055056fea1a1 100644 --- a/ReactCommon/react/renderer/mounting/MountingTransaction.h +++ b/ReactCommon/react/renderer/mounting/MountingTransaction.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp index ff8a2ce5bc36..e6106cda4f04 100644 --- a/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp +++ b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h index 176a34c9cda3..d0eda81002cf 100644 --- a/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h +++ b/ReactCommon/react/renderer/mounting/MountingTransactionMetadata.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.cpp b/ReactCommon/react/renderer/mounting/ShadowTree.cpp index 1d3c6fe8dce3..339ce6024b90 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -110,8 +110,8 @@ static ShadowNode::Unshared progressState( // Stage 1: Aligned part. for (index = 0; index < childrenSize && index < baseChildrenSize; index++) { - const auto &childNode = *children.at(index); - const auto &baseChildNode = *baseChildren.at(index); + auto const &childNode = *children[index]; + auto const &baseChildNode = *baseChildren[index]; if (&childNode == &baseChildNode) { // Nodes are identical, skipping. @@ -136,7 +136,7 @@ static ShadowNode::Unshared progressState( // Stage 2: Misaligned part. for (; index < childrenSize; index++) { - auto newChildNode = progressState(*children.at(index)); + auto newChildNode = progressState(*children[index]); if (newChildNode) { if (!areChildrenChanged) { // Making a copy before the first mutation. @@ -270,7 +270,7 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { auto revision = ShadowTreeRevision{}; { - std::unique_lock lock(commitMutex_); + std::unique_lock lock(commitMutex_); if (commitMode_ == commitMode) { return; } @@ -287,7 +287,7 @@ void ShadowTree::setCommitMode(CommitMode commitMode) const { } CommitMode ShadowTree::getCommitMode() const { - std::shared_lock lock(commitMutex_); + std::shared_lock lock(commitMutex_); return commitMode_; } @@ -330,12 +330,12 @@ CommitStatus ShadowTree::tryCommit( { // Reading `currentRevision_` in shared manner. - std::shared_lock lock(commitMutex_); + std::shared_lock lock(commitMutex_); commitMode = commitMode_; oldRevision = currentRevision_; } - auto oldRootShadowNode = oldRevision.rootShadowNode; + auto const &oldRootShadowNode = oldRevision.rootShadowNode; auto newRootShadowNode = transaction(*oldRevision.rootShadowNode); if (!newRootShadowNode || @@ -345,7 +345,7 @@ CommitStatus ShadowTree::tryCommit( if (commitOptions.enableStateReconciliation) { auto updatedNewRootShadowNode = - progressState(*newRootShadowNode, *oldRevision.rootShadowNode); + progressState(*newRootShadowNode, *oldRootShadowNode); if (updatedNewRootShadowNode) { newRootShadowNode = std::static_pointer_cast(updatedNewRootShadowNode); @@ -367,7 +367,7 @@ CommitStatus ShadowTree::tryCommit( { // Updating `currentRevision_` in unique manner if it hasn't changed. - std::unique_lock lock(commitMutex_); + std::unique_lock lock(commitMutex_); if (currentRevision_.number != oldRevision.number) { return CommitStatus::Failed; @@ -410,7 +410,7 @@ CommitStatus ShadowTree::tryCommit( } ShadowTreeRevision ShadowTree::getCurrentRevision() const { - std::shared_lock lock(commitMutex_); + std::shared_lock lock(commitMutex_); return currentRevision_; } diff --git a/ReactCommon/react/renderer/mounting/ShadowTree.h b/ReactCommon/react/renderer/mounting/ShadowTree.h index 2553fdc3d310..248ce4daa10f 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTree.h +++ b/ReactCommon/react/renderer/mounting/ShadowTree.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -135,7 +135,7 @@ class ShadowTree final { SurfaceId const surfaceId_; ShadowTreeDelegate const &delegate_; - mutable better::shared_mutex commitMutex_; + mutable butter::shared_mutex commitMutex_; mutable CommitMode commitMode_{ CommitMode::Normal}; // Protected by `commitMutex_`. mutable ShadowTreeRevision currentRevision_; // Protected by `commitMutex_`. diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h b/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h index 45e762c53140..481673306800 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp index 8c801d82270f..2b0c6927edf4 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,14 +18,14 @@ ShadowTreeRegistry::~ShadowTreeRegistry() { } void ShadowTreeRegistry::add(std::unique_ptr &&shadowTree) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); registry_.emplace(shadowTree->getSurfaceId(), std::move(shadowTree)); } std::unique_ptr ShadowTreeRegistry::remove( SurfaceId surfaceId) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto iterator = registry_.find(surfaceId); if (iterator == registry_.end()) { @@ -39,8 +39,8 @@ std::unique_ptr ShadowTreeRegistry::remove( bool ShadowTreeRegistry::visit( SurfaceId surfaceId, - std::function callback) const { - std::shared_lock lock(mutex_); + std::function const &callback) const { + std::shared_lock lock(mutex_); auto iterator = registry_.find(surfaceId); @@ -53,15 +53,10 @@ bool ShadowTreeRegistry::visit( } void ShadowTreeRegistry::enumerate( - std::function callback) - const { - std::shared_lock lock(mutex_); - bool stop = false; + std::function const &callback) const { + std::shared_lock lock(mutex_); for (auto const &pair : registry_) { - callback(*pair.second, stop); - if (stop) { - break; - } + callback(*pair.second); } } diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h index e2cee3d8c65b..5e520f963985 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRegistry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,8 +7,8 @@ #pragma once -#include -#include +#include +#include #include #include @@ -50,19 +50,18 @@ class ShadowTreeRegistry final { */ bool visit( SurfaceId surfaceId, - std::function callback) const; + std::function const &callback) const; /* * Enumerates all stored shadow trees. - * Set `stop` to `true` to interrupt the enumeration. * Can be called from any thread. */ - void enumerate(std::function - callback) const; + void enumerate( + std::function const &callback) const; private: - mutable better::shared_mutex mutex_; - mutable better::map> + mutable butter::shared_mutex mutex_; + mutable butter::map> registry_; // Protected by `mutex_`. }; diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRevision.cpp b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.cpp index f56d03ec2023..510683987eeb 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRevision.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h index 50e05ad7741a..732346894898 100644 --- a/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h +++ b/ReactCommon/react/renderer/mounting/ShadowTreeRevision.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include diff --git a/ReactCommon/react/renderer/mounting/ShadowView.cpp b/ReactCommon/react/renderer/mounting/ShadowView.cpp index 3b4b54f1439b..a521baf785c8 100644 --- a/ReactCommon/react/renderer/mounting/ShadowView.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/ShadowView.h b/ReactCommon/react/renderer/mounting/ShadowView.h index 614399b2fb02..350f05bd77d4 100644 --- a/ReactCommon/react/renderer/mounting/ShadowView.h +++ b/ReactCommon/react/renderer/mounting/ShadowView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -65,9 +65,9 @@ std::vector getDebugProps( * */ struct ShadowViewNodePair final { - using NonOwningList = better:: + using NonOwningList = butter:: small_vector; - using OwningList = better:: + using OwningList = butter:: small_vector; ShadowView shadowView; @@ -103,7 +103,7 @@ struct ShadowViewNodePair final { * */ struct ShadowViewNodePairLegacy final { - using OwningList = better::small_vector< + using OwningList = butter::small_vector< ShadowViewNodePairLegacy, kShadowNodeChildrenSmallVectorSize>; diff --git a/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp b/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp index 4a77190dff12..437f6634dba2 100644 --- a/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp +++ b/ReactCommon/react/renderer/mounting/ShadowViewMutation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,8 @@ #include "ShadowViewMutation.h" +#include + namespace facebook { namespace react { @@ -15,7 +17,7 @@ ShadowViewMutation ShadowViewMutation::CreateMutation(ShadowView shadowView) { /* .type = */ Create, /* .parentShadowView = */ {}, /* .oldChildShadowView = */ {}, - /* .newChildShadowView = */ shadowView, + /* .newChildShadowView = */ std::move(shadowView), /* .index = */ -1, }; } @@ -24,7 +26,7 @@ ShadowViewMutation ShadowViewMutation::DeleteMutation(ShadowView shadowView) { return { /* .type = */ Delete, /* .parentShadowView = */ {}, - /* .oldChildShadowView = */ shadowView, + /* .oldChildShadowView = */ std::move(shadowView), /* .newChildShadowView = */ {}, /* .index = */ -1, }; @@ -36,9 +38,9 @@ ShadowViewMutation ShadowViewMutation::InsertMutation( int index) { return { /* .type = */ Insert, - /* .parentShadowView = */ parentShadowView, + /* .parentShadowView = */ std::move(parentShadowView), /* .oldChildShadowView = */ {}, - /* .newChildShadowView = */ childShadowView, + /* .newChildShadowView = */ std::move(childShadowView), /* .index = */ index, }; } @@ -49,8 +51,8 @@ ShadowViewMutation ShadowViewMutation::RemoveMutation( int index) { return { /* .type = */ Remove, - /* .parentShadowView = */ parentShadowView, - /* .oldChildShadowView = */ childShadowView, + /* .parentShadowView = */ std::move(parentShadowView), + /* .oldChildShadowView = */ std::move(childShadowView), /* .newChildShadowView = */ {}, /* .index = */ index, }; @@ -62,8 +64,8 @@ ShadowViewMutation ShadowViewMutation::UpdateMutation( return { /* .type = */ Update, /* .parentShadowView = */ {}, - /* .oldChildShadowView = */ oldChildShadowView, - /* .newChildShadowView = */ newChildShadowView, + /* .oldChildShadowView = */ std::move(oldChildShadowView), + /* .newChildShadowView = */ std::move(newChildShadowView), /* .index = */ -1, }; } @@ -91,9 +93,9 @@ ShadowViewMutation::ShadowViewMutation( ShadowView newChildShadowView, int index) : type(type), - parentShadowView(parentShadowView), - oldChildShadowView(oldChildShadowView), - newChildShadowView(newChildShadowView), + parentShadowView(std::move(parentShadowView)), + oldChildShadowView(std::move(oldChildShadowView)), + newChildShadowView(std::move(newChildShadowView)), index(index) {} #if RN_DEBUG_STRING_CONVERTIBLE diff --git a/ReactCommon/react/renderer/mounting/ShadowViewMutation.h b/ReactCommon/react/renderer/mounting/ShadowViewMutation.h index 3ed3414804a5..36313cdeaa19 100644 --- a/ReactCommon/react/renderer/mounting/ShadowViewMutation.h +++ b/ReactCommon/react/renderer/mounting/ShadowViewMutation.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/StubView.cpp b/ReactCommon/react/renderer/mounting/StubView.cpp index cad4ae8a3986..0d490dc65725 100644 --- a/ReactCommon/react/renderer/mounting/StubView.cpp +++ b/ReactCommon/react/renderer/mounting/StubView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/StubView.h b/ReactCommon/react/renderer/mounting/StubView.h index a721c57c74d2..a9973aa5903a 100644 --- a/ReactCommon/react/renderer/mounting/StubView.h +++ b/ReactCommon/react/renderer/mounting/StubView.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/StubViewTree.cpp b/ReactCommon/react/renderer/mounting/StubViewTree.cpp index 6e82ad5028fb..e47e1bf92988 100644 --- a/ReactCommon/react/renderer/mounting/StubViewTree.cpp +++ b/ReactCommon/react/renderer/mounting/StubViewTree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/StubViewTree.h b/ReactCommon/react/renderer/mounting/StubViewTree.h index c3ce25c8fdf1..5d09bed0a0f6 100644 --- a/ReactCommon/react/renderer/mounting/StubViewTree.h +++ b/ReactCommon/react/renderer/mounting/StubViewTree.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/TelemetryController.cpp b/ReactCommon/react/renderer/mounting/TelemetryController.cpp index a9e36d9a3996..f660768a5cd7 100644 --- a/ReactCommon/react/renderer/mounting/TelemetryController.cpp +++ b/ReactCommon/react/renderer/mounting/TelemetryController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,9 +17,10 @@ TelemetryController::TelemetryController( : mountingCoordinator_(mountingCoordinator) {} bool TelemetryController::pullTransaction( - std::function willMount, - std::function doMount, - std::function didMount) const { + std::function const &willMount, + std::function const &doMount, + std::function const &didMount) + const { auto optional = mountingCoordinator_.pullTransaction(); if (!optional.has_value()) { return false; @@ -39,7 +40,7 @@ bool TelemetryController::pullTransaction( willMount({surfaceId, number, telemetry, compoundTelemetry}); telemetry.willMount(); - doMount(std::move(transaction.getMutations())); + doMount(transaction.getMutations()); telemetry.didMount(); compoundTelemetry.incorporate(telemetry, numberOfMutations); diff --git a/ReactCommon/react/renderer/mounting/TelemetryController.h b/ReactCommon/react/renderer/mounting/TelemetryController.h index 3911ea30e422..8ea445e8f0a3 100644 --- a/ReactCommon/react/renderer/mounting/TelemetryController.h +++ b/ReactCommon/react/renderer/mounting/TelemetryController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -43,9 +43,12 @@ class TelemetryController final { * Calls `MountingCoordinator::pullTransaction()` and aggregates telemetry. */ bool pullTransaction( - std::function willMount, - std::function doMount, - std::function didMount) const; + std::function const + &willMount, + std::function const + &doMount, + std::function const &didMount) + const; private: MountingCoordinator const &mountingCoordinator_; diff --git a/ReactCommon/react/renderer/mounting/stubs.cpp b/ReactCommon/react/renderer/mounting/stubs.cpp index c5f76beb203e..71ff672ecc7f 100644 --- a/ReactCommon/react/renderer/mounting/stubs.cpp +++ b/ReactCommon/react/renderer/mounting/stubs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/stubs.h b/ReactCommon/react/renderer/mounting/stubs.h index 73ac7b1d8ecc..a55145be1e6d 100644 --- a/ReactCommon/react/renderer/mounting/stubs.h +++ b/ReactCommon/react/renderer/mounting/stubs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp b/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp index 8ad2395bef76..cb6868990c79 100644 --- a/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/MountingTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -43,7 +43,7 @@ static SharedViewProps nonFlattenedDefaultProps( static ShadowNode::Shared makeNode( ComponentDescriptor const &componentDescriptor, int tag, - ShadowNode::ListOfShared children, + const ShadowNode::ListOfShared &children, bool flattened = false) { auto props = flattened ? generateDefaultProps(componentDescriptor) : nonFlattenedDefaultProps(componentDescriptor); @@ -358,9 +358,9 @@ TEST(MountingTest, testReorderingInstructionGeneration) { // The actual nodes that should be created in this transaction have a tag > // 105. EXPECT_TRUE(mutations6.size() == 25); - for (int i = 0; i < mutations6.size(); i++) { - if (mutations6[i].type == ShadowViewMutation::Create) { - EXPECT_TRUE(mutations6[i].newChildShadowView.tag > 105); + for (auto &i : mutations6) { + if (i.type == ShadowViewMutation::Create) { + EXPECT_TRUE(i.newChildShadowView.tag > 105); } } } diff --git a/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp b/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp index da9806e58dc5..fc913f666a2c 100644 --- a/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/ShadowTreeLifeCycleTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp b/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp index 521d3135d131..dc315be42760 100644 --- a/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/StackingContextTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -153,7 +153,7 @@ class StackingContextTest : public ::testing::Test { } void mutateViewShadowNodeProps_( - std::shared_ptr node, + std::shared_ptr const &node, std::function callback) { rootShadowNode_ = std::static_pointer_cast(rootShadowNode_->cloneTree( @@ -165,7 +165,7 @@ class StackingContextTest : public ::testing::Test { } void testViewTree_( - std::function callback) { + std::function const &callback) { rootShadowNode_->layoutIfNeeded(); callback(buildStubViewTreeUsingDifferentiator(*rootShadowNode_)); diff --git a/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp b/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp index b88ec2c33f78..ffa54f0dd97d 100644 --- a/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp +++ b/ReactCommon/react/renderer/mounting/tests/StateReconciliationTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,14 +24,14 @@ using namespace facebook::react; class DummyShadowTreeDelegate : public ShadowTreeDelegate { public: - virtual RootShadowNode::Unshared shadowTreeWillCommit( + RootShadowNode::Unshared shadowTreeWillCommit( ShadowTree const &shadowTree, RootShadowNode::Shared const &oldRootShadowNode, RootShadowNode::Unshared const &newRootShadowNode) const override { return newRootShadowNode; }; - virtual void shadowTreeDidFinishTransaction( + void shadowTreeDidFinishTransaction( ShadowTree const &shadowTree, MountingCoordinator::Shared const &mountingCoordinator) const override{}; }; diff --git a/ReactCommon/react/renderer/runtimescheduler/Android.mk b/ReactCommon/react/renderer/runtimescheduler/Android.mk index b67a8e632908..59aa098484ba 100644 --- a/ReactCommon/react/renderer/runtimescheduler/Android.mk +++ b/ReactCommon/react/renderer/runtimescheduler/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -12,10 +12,16 @@ LOCAL_MODULE := react_render_runtimescheduler LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../ LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ -LOCAL_SHARED_LIBRARIES := libruntimeexecutor libreact_render_core libreact_debug libjsi callinvoker +LOCAL_SHARED_LIBRARIES := \ + callinvoker \ + libjsi \ + libreact_debug \ + libreact_render_core \ + libruntimeexecutor \ LOCAL_CFLAGS := \ -DLOG_TAG=\"Fabric\" diff --git a/ReactCommon/react/renderer/runtimescheduler/BUCK b/ReactCommon/react/renderer/runtimescheduler/BUCK index 81f2b99954f9..061fa3197f34 100644 --- a/ReactCommon/react/renderer/runtimescheduler/BUCK +++ b/ReactCommon/react/renderer/runtimescheduler/BUCK @@ -46,7 +46,7 @@ rn_xplat_cxx_library( deps = [ react_native_xplat_target("runtimeexecutor:runtimeexecutor"), react_native_xplat_target("react/renderer/debug:debug"), - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("callinvoker:callinvoker"), ], ) diff --git a/ReactCommon/react/renderer/runtimescheduler/ErrorUtils.h b/ReactCommon/react/renderer/runtimescheduler/ErrorUtils.h index a6da8b49b852..75e7f0a6ba7d 100644 --- a/ReactCommon/react/renderer/runtimescheduler/ErrorUtils.h +++ b/ReactCommon/react/renderer/runtimescheduler/ErrorUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp index ecf2589dddca..6f52dffca3e2 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.cpp @@ -1,11 +1,13 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "RuntimeScheduler.h" + +#include #include "ErrorUtils.h" namespace facebook { @@ -14,25 +16,19 @@ namespace react { #pragma mark - Public RuntimeScheduler::RuntimeScheduler( - RuntimeExecutor const &runtimeExecutor, + RuntimeExecutor runtimeExecutor, std::function now) - : runtimeExecutor_(runtimeExecutor), now_(now) {} + : runtimeExecutor_(std::move(runtimeExecutor)), now_(std::move(now)) {} void RuntimeScheduler::scheduleWork( std::function callback) const { - if (enableYielding_) { - shouldYield_ = true; - runtimeExecutor_( - [this, callback = std::move(callback)](jsi::Runtime &runtime) { - shouldYield_ = false; - callback(runtime); - startWorkLoop(runtime); - }); - } else { - runtimeExecutor_([callback = std::move(callback)](jsi::Runtime &runtime) { - callback(runtime); - }); - } + shouldYield_ = true; + runtimeExecutor_( + [this, callback = std::move(callback)](jsi::Runtime &runtime) { + shouldYield_ = false; + callback(runtime); + startWorkLoop(runtime); + }); } std::shared_ptr RuntimeScheduler::scheduleTask( @@ -43,13 +39,7 @@ std::shared_ptr RuntimeScheduler::scheduleTask( std::make_shared(priority, std::move(callback), expirationTime); taskQueue_.push(task); - if (!isCallbackScheduled_ && !isPerformingWork_) { - isCallbackScheduled_ = true; - runtimeExecutor_([this](jsi::Runtime &runtime) { - isCallbackScheduled_ = false; - startWorkLoop(runtime); - }); - } + scheduleWorkLoopIfNecessary(); return task; } @@ -58,8 +48,12 @@ bool RuntimeScheduler::getShouldYield() const noexcept { return shouldYield_; } -void RuntimeScheduler::cancelTask(const std::shared_ptr &task) noexcept { - task->callback.reset(); +bool RuntimeScheduler::getIsSynchronous() const noexcept { + return isSynchronous_; +} + +void RuntimeScheduler::cancelTask(Task &task) noexcept { + task.callback.reset(); } SchedulerPriority RuntimeScheduler::getCurrentPriorityLevel() const noexcept { @@ -70,23 +64,56 @@ RuntimeSchedulerTimePoint RuntimeScheduler::now() const noexcept { return now_(); } -void RuntimeScheduler::setEnableYielding(bool enableYielding) { - enableYielding_ = enableYielding; -} - void RuntimeScheduler::executeNowOnTheSameThread( - std::function callback) const { + std::function callback) { shouldYield_ = true; executeSynchronouslyOnSameThread_CAN_DEADLOCK( runtimeExecutor_, - [callback = std::move(callback)](jsi::Runtime &runtime) { - callback(runtime); + [this, callback = std::move(callback)](jsi::Runtime &runtime) { + shouldYield_ = false; + auto task = jsi::Function::createFromHostFunction( + runtime, + jsi::PropNameID::forUtf8(runtime, ""), + 3, + [callback = std::move(callback)]( + jsi::Runtime &runtime, + jsi::Value const &, + jsi::Value const *arguments, + size_t) -> jsi::Value { + callback(runtime); + return jsi::Value::undefined(); + }); + + // We are about to trigger work loop. Setting `isCallbackScheduled_` to + // true prevents unnecessary call to `runtimeExecutor`. + isWorkLoopScheduled_ = true; + this->scheduleTask( + SchedulerPriority::ImmediatePriority, std::move(task)); + isWorkLoopScheduled_ = false; + + isSynchronous_ = true; + startWorkLoop(runtime); + isSynchronous_ = false; }); - shouldYield_ = false; + + // Resume work loop if needed. In synchronous mode + // only expired tasks are executed. Tasks with lower priority + // might be still in the queue. + scheduleWorkLoopIfNecessary(); } #pragma mark - Private +void RuntimeScheduler::scheduleWorkLoopIfNecessary() const { + if (!isWorkLoopScheduled_ && !isPerformingWork_) { + isWorkLoopScheduled_ = true; + runtimeExecutor_([this](jsi::Runtime &runtime) { + isWorkLoopScheduled_ = false; + startWorkLoop(runtime); + }); + } +} + void RuntimeScheduler::startWorkLoop(jsi::Runtime &runtime) const { auto previousPriority = currentPriority_; isPerformingWork_ = true; @@ -96,8 +123,15 @@ void RuntimeScheduler::startWorkLoop(jsi::Runtime &runtime) const { auto now = now_(); auto didUserCallbackTimeout = topPriorityTask->expirationTime <= now; - if (!didUserCallbackTimeout && shouldYield_) { - // This task hasn't expired and we need to yield. + // This task hasn't expired and we need to yield. + auto shouldBreakBecauseYield = !didUserCallbackTimeout && shouldYield_; + + // This task hasn't expired but we are in synchronous mode and need to + // only execute the necessary minimum. + auto shouldBreakBecauseSynchronous = + !didUserCallbackTimeout && isSynchronous_; + + if (shouldBreakBecauseYield || shouldBreakBecauseSynchronous) { break; } currentPriority_ = topPriorityTask->priority; diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h index 5d18a7d9ea8a..a76805b2a0ad 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeScheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,7 +20,7 @@ namespace react { class RuntimeScheduler final { public: RuntimeScheduler( - RuntimeExecutor const &runtimeExecutor, + RuntimeExecutor runtimeExecutor, std::function now = RuntimeSchedulerClock::now); /* @@ -45,22 +45,57 @@ class RuntimeScheduler final { * component. */ void executeNowOnTheSameThread( - std::function callback) const; + std::function callback); + /* + * Adds a JavaScript callback to priority queue with given priority. + * Triggers workloop if needed. + * + * Thread synchronization must be enforced externally. + */ std::shared_ptr scheduleTask( SchedulerPriority priority, jsi::Function callback); - void cancelTask(std::shared_ptr const &task) noexcept; + /* + * Cancelled task will never be executed. + * + * Operates on JSI object. + * Thread synchronization must be enforced externally. + */ + void cancelTask(Task &task) noexcept; + /* + * Return value indicates if host platform has a pending access to the + * runtime. + * + * Can be called from any thread. + */ bool getShouldYield() const noexcept; + /* + * Return value informs if the current task is executed inside synchronous + * block. + * + * Can be called from any thread. + */ + bool getIsSynchronous() const noexcept; + + /* + * Returns value of currently executed task. Designed to be called from React. + * + * Thread synchronization must be enforced externally. + */ SchedulerPriority getCurrentPriorityLevel() const noexcept; + /* + * Returns current monotonic time. This time is not related to wall clock + * time. + * + * Thread synchronization must be enforced externally. + */ RuntimeSchedulerTimePoint now() const noexcept; - void setEnableYielding(bool enableYielding); - private: mutable std::priority_queue< std::shared_ptr, @@ -71,9 +106,16 @@ class RuntimeScheduler final { RuntimeExecutor const runtimeExecutor_; mutable SchedulerPriority currentPriority_{SchedulerPriority::NormalPriority}; mutable std::atomic_bool shouldYield_{false}; + mutable std::atomic_bool isSynchronous_{false}; void startWorkLoop(jsi::Runtime &runtime) const; + /* + * Schedules a work loop unless it has been already scheduled + * This is to avoid unnecessary calls to `runtimeExecutor`. + */ + void scheduleWorkLoopIfNecessary() const; + /* * Returns a time point representing the current point in time. May be called * from multiple threads. @@ -84,21 +126,12 @@ class RuntimeScheduler final { * Flag indicating if callback on JavaScript queue has been * scheduled. */ - std::atomic_bool isCallbackScheduled_{false}; - - /* - * Flag indicating if yielding is enabled. - * - * If set to true and Concurrent Mode is enabled on the surface, - * React Native will ask React to yield in case any work has been scheduled. - * Default value is false - */ - bool enableYielding_{false}; + mutable std::atomic_bool isWorkLoopScheduled_{false}; /* * This flag is set while performing work, to prevent re-entrancy. */ - mutable bool isPerformingWork_{false}; + mutable std::atomic_bool isPerformingWork_{false}; }; } // namespace react diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp index 92525118e282..2482ecc82e71 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,6 +12,7 @@ #include #include #include +#include namespace facebook { namespace react { @@ -42,9 +43,27 @@ RuntimeSchedulerBinding::createAndInstallIfNeeded( return runtimeSchedulerObject.getHostObject(runtime); } +std::shared_ptr RuntimeSchedulerBinding::getBinding( + jsi::Runtime &runtime) { + auto runtimeSchedulerModuleName = "nativeRuntimeScheduler"; + + auto runtimeSchedulerValue = + runtime.global().getProperty(runtime, runtimeSchedulerModuleName); + if (runtimeSchedulerValue.isUndefined()) { + return nullptr; + } + + auto runtimeSchedulerObject = runtimeSchedulerValue.asObject(runtime); + return runtimeSchedulerObject.getHostObject(runtime); +} + RuntimeSchedulerBinding::RuntimeSchedulerBinding( - std::shared_ptr const &runtimeScheduler) - : runtimeScheduler_(runtimeScheduler) {} + std::shared_ptr runtimeScheduler) + : runtimeScheduler_(std::move(runtimeScheduler)) {} + +bool RuntimeSchedulerBinding::getIsSynchronous() const { + return runtimeScheduler_->getIsSynchronous(); +} jsi::Value RuntimeSchedulerBinding::get( jsi::Runtime &runtime, @@ -81,7 +100,7 @@ jsi::Value RuntimeSchedulerBinding::get( jsi::Value const &, jsi::Value const *arguments, size_t) noexcept -> jsi::Value { - runtimeScheduler_->cancelTask(taskFromValue(runtime, arguments[0])); + runtimeScheduler_->cancelTask(*taskFromValue(runtime, arguments[0])); return jsi::Value::undefined(); }); } diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h index 27c1ad9f31df..92c345abbfcd 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerBinding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -18,8 +18,7 @@ namespace react { */ class RuntimeSchedulerBinding : public jsi::HostObject { public: - RuntimeSchedulerBinding( - std::shared_ptr const &runtimeScheduler); + RuntimeSchedulerBinding(std::shared_ptr runtimeScheduler); /* * Installs RuntimeSchedulerBinding into JavaScript runtime if needed. @@ -31,11 +30,20 @@ class RuntimeSchedulerBinding : public jsi::HostObject { jsi::Runtime &runtime, std::shared_ptr const &runtimeScheduler); + /* + * Returns a shared pointer to RuntimeSchedulerBinding previously installed + * into a runtime. Thread synchronization must be enforced externally. + */ + static std::shared_ptr getBinding( + jsi::Runtime &runtime); + /* * `jsi::HostObject` specific overloads. */ jsi::Value get(jsi::Runtime &runtime, jsi::PropNameID const &name) override; + bool getIsSynchronous() const; + private: std::shared_ptr runtimeScheduler_; }; diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp index 70f02ca132e0..3f8b3be7ae4f 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,12 +7,14 @@ #include "RuntimeSchedulerCallInvoker.h" +#include + namespace facebook { namespace react { RuntimeSchedulerCallInvoker::RuntimeSchedulerCallInvoker( std::weak_ptr runtimeScheduler) - : runtimeScheduler_(runtimeScheduler) {} + : runtimeScheduler_(std::move(runtimeScheduler)) {} void RuntimeSchedulerCallInvoker::invokeAsync(std::function &&func) { if (auto runtimeScheduler = runtimeScheduler_.lock()) { diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h index b40e0cad7278..0fd18530c3da 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerClock.h b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerClock.h index 51652ee0a070..c6edc7f28c91 100644 --- a/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerClock.h +++ b/ReactCommon/react/renderer/runtimescheduler/RuntimeSchedulerClock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/SchedulerPriority.h b/ReactCommon/react/renderer/runtimescheduler/SchedulerPriority.h index 329fe252aa38..76309e24768a 100644 --- a/ReactCommon/react/renderer/runtimescheduler/SchedulerPriority.h +++ b/ReactCommon/react/renderer/runtimescheduler/SchedulerPriority.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -61,5 +61,21 @@ static inline std::chrono::milliseconds timeoutForSchedulerPriority( } } +static inline std::string debugValueForSchedulerPriority( + SchedulerPriority schedulerPriority) { + switch (schedulerPriority) { + case SchedulerPriority::ImmediatePriority: + return "SchedulerPriority::ImmediatePriority"; + case SchedulerPriority::UserBlockingPriority: + return "SchedulerPriority::UserBlockingPriority"; + case SchedulerPriority::NormalPriority: + return "SchedulerPriority::NormalPriority"; + case SchedulerPriority::LowPriority: + return "SchedulerPriority::LowPriority"; + case SchedulerPriority::IdlePriority: + return "SchedulerPriority::IdlePriority"; + } +} + } // namespace react } // namespace facebook diff --git a/ReactCommon/react/renderer/runtimescheduler/Task.cpp b/ReactCommon/react/renderer/runtimescheduler/Task.cpp index bd87944afa37..bed71bb4b032 100644 --- a/ReactCommon/react/renderer/runtimescheduler/Task.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/Task.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/Task.h b/ReactCommon/react/renderer/runtimescheduler/Task.h index 87676d5db737..c1c006042f6a 100644 --- a/ReactCommon/react/renderer/runtimescheduler/Task.h +++ b/ReactCommon/react/renderer/runtimescheduler/Task.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include #include @@ -29,7 +29,7 @@ struct Task final { friend TaskPriorityComparer; SchedulerPriority priority; - better::optional callback; + butter::optional callback; RuntimeSchedulerClock::time_point expirationTime; jsi::Value execute(jsi::Runtime &runtime); diff --git a/ReactCommon/react/renderer/runtimescheduler/primitives.h b/ReactCommon/react/renderer/runtimescheduler/primitives.h index 2283b4cad271..caa2b2614014 100644 --- a/ReactCommon/react/renderer/runtimescheduler/primitives.h +++ b/ReactCommon/react/renderer/runtimescheduler/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp b/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp index 3fade3594ee6..a7b014022e3d 100644 --- a/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/tests/RuntimeSchedulerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -159,7 +159,7 @@ TEST_F(RuntimeSchedulerTest, taskExpiration) { } TEST_F(RuntimeSchedulerTest, scheduleTwoTasksWithSamePriority) { - uint firstTaskCallOrder; + uint firstTaskCallOrder = 0; auto callbackOne = createHostFunctionFromLambda([this, &firstTaskCallOrder](bool) { firstTaskCallOrder = hostFunctionCallCount_; @@ -192,7 +192,7 @@ TEST_F(RuntimeSchedulerTest, scheduleTwoTasksWithSamePriority) { } TEST_F(RuntimeSchedulerTest, scheduleTwoTasksWithDifferentPriorities) { - uint lowPriorityTaskCallOrder; + uint lowPriorityTaskCallOrder = 0; auto callbackOne = createHostFunctionFromLambda([this, &lowPriorityTaskCallOrder](bool) { lowPriorityTaskCallOrder = hostFunctionCallCount_; @@ -237,7 +237,7 @@ TEST_F(RuntimeSchedulerTest, cancelTask) { EXPECT_FALSE(didRunTask); EXPECT_EQ(stubQueue_->size(), 1); - runtimeScheduler_->cancelTask(task); + runtimeScheduler_->cancelTask(*task); stubQueue_->tick(); @@ -323,7 +323,7 @@ TEST_F(RuntimeSchedulerTest, scheduleWork) { EXPECT_FALSE(wasCalled); - EXPECT_FALSE(runtimeScheduler_->getShouldYield()); + EXPECT_TRUE(runtimeScheduler_->getShouldYield()); EXPECT_EQ(stubQueue_->size(), 1); @@ -334,7 +334,6 @@ TEST_F(RuntimeSchedulerTest, scheduleWork) { } TEST_F(RuntimeSchedulerTest, scheduleWorkWithYielding) { - runtimeScheduler_->setEnableYielding(true); bool wasCalled = false; runtimeScheduler_->scheduleWork( [&](jsi::Runtime const &) { wasCalled = true; }); @@ -353,8 +352,6 @@ TEST_F(RuntimeSchedulerTest, scheduleWorkWithYielding) { } TEST_F(RuntimeSchedulerTest, normalTaskYieldsToPlatformEvent) { - runtimeScheduler_->setEnableYielding(true); - bool didRunJavaScriptTask = false; bool didRunPlatformWork = false; @@ -382,8 +379,6 @@ TEST_F(RuntimeSchedulerTest, normalTaskYieldsToPlatformEvent) { } TEST_F(RuntimeSchedulerTest, expiredTaskDoesntYieldToPlatformEvent) { - runtimeScheduler_->setEnableYielding(true); - bool didRunJavaScriptTask = false; bool didRunPlatformWork = false; @@ -412,8 +407,6 @@ TEST_F(RuntimeSchedulerTest, expiredTaskDoesntYieldToPlatformEvent) { } TEST_F(RuntimeSchedulerTest, immediateTaskDoesntYieldToPlatformEvent) { - runtimeScheduler_->setEnableYielding(true); - bool didRunJavaScriptTask = false; bool didRunPlatformWork = false; @@ -494,4 +487,108 @@ TEST_F(RuntimeSchedulerTest, handlingError) { EXPECT_EQ(stubErrorUtils_->getReportFatalCallCount(), 1); } +TEST_F(RuntimeSchedulerTest, basicSameThreadExecution) { + bool didRunSynchronousTask = false; + std::thread t1([this, &didRunSynchronousTask]() { + runtimeScheduler_->executeNowOnTheSameThread( + [this, &didRunSynchronousTask](jsi::Runtime &rt) { + EXPECT_TRUE(runtimeScheduler_->getIsSynchronous()); + didRunSynchronousTask = true; + }); + EXPECT_FALSE(runtimeScheduler_->getIsSynchronous()); + }); + + auto hasTask = stubQueue_->waitForTask(1ms); + + EXPECT_TRUE(hasTask); + EXPECT_FALSE(didRunSynchronousTask); + EXPECT_EQ(stubQueue_->size(), 1); + + stubQueue_->tick(); + + t1.join(); + + EXPECT_TRUE(didRunSynchronousTask); +} + +TEST_F(RuntimeSchedulerTest, sameThreadTaskCreatesImmediatePriorityTask) { + bool didRunSynchronousTask = false; + bool didRunSubsequentTask = false; + std::thread t1([this, &didRunSynchronousTask, &didRunSubsequentTask]() { + runtimeScheduler_->executeNowOnTheSameThread( + [this, &didRunSynchronousTask, &didRunSubsequentTask]( + jsi::Runtime &rt) { + didRunSynchronousTask = true; + + auto callback = createHostFunctionFromLambda( + [&didRunSubsequentTask](bool didUserCallbackTimeout) { + didRunSubsequentTask = true; + EXPECT_FALSE(didUserCallbackTimeout); + return jsi::Value::undefined(); + }); + + runtimeScheduler_->scheduleTask( + SchedulerPriority::ImmediatePriority, std::move(callback)); + }); + }); + + auto hasTask = stubQueue_->waitForTask(1ms); + + EXPECT_TRUE(hasTask); + EXPECT_FALSE(didRunSynchronousTask); + EXPECT_FALSE(didRunSubsequentTask); + EXPECT_EQ(stubQueue_->size(), 1); + + stubQueue_->tick(); + + t1.join(); + + EXPECT_TRUE(didRunSynchronousTask); + EXPECT_TRUE(didRunSubsequentTask); +} + +TEST_F(RuntimeSchedulerTest, sameThreadTaskCreatesLowPriorityTask) { + bool didRunSynchronousTask = false; + bool didRunSubsequentTask = false; + std::thread t1([this, &didRunSynchronousTask, &didRunSubsequentTask]() { + runtimeScheduler_->executeNowOnTheSameThread( + [this, &didRunSynchronousTask, &didRunSubsequentTask]( + jsi::Runtime &rt) { + didRunSynchronousTask = true; + + auto callback = createHostFunctionFromLambda( + [&didRunSubsequentTask](bool didUserCallbackTimeout) { + didRunSubsequentTask = true; + EXPECT_FALSE(didUserCallbackTimeout); + return jsi::Value::undefined(); + }); + + runtimeScheduler_->scheduleTask( + SchedulerPriority::LowPriority, std::move(callback)); + }); + }); + + auto hasTask = stubQueue_->waitForTask(1ms); + + EXPECT_TRUE(hasTask); + EXPECT_FALSE(didRunSynchronousTask); + EXPECT_FALSE(didRunSubsequentTask); + EXPECT_EQ(stubQueue_->size(), 1); + + stubQueue_->tick(); + + t1.join(); + + EXPECT_TRUE(didRunSynchronousTask); + EXPECT_FALSE(didRunSubsequentTask); + + EXPECT_EQ(stubQueue_->size(), 1); + + stubQueue_->tick(); + + EXPECT_TRUE(didRunSubsequentTask); + + EXPECT_EQ(stubQueue_->size(), 0); +} + } // namespace facebook::react diff --git a/ReactCommon/react/renderer/runtimescheduler/tests/SchedulerPriorityTest.cpp b/ReactCommon/react/renderer/runtimescheduler/tests/SchedulerPriorityTest.cpp index 4139e2f0c16c..cb32caf215e3 100644 --- a/ReactCommon/react/renderer/runtimescheduler/tests/SchedulerPriorityTest.cpp +++ b/ReactCommon/react/renderer/runtimescheduler/tests/SchedulerPriorityTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/tests/StubClock.h b/ReactCommon/react/renderer/runtimescheduler/tests/StubClock.h index 6ac977fd7d53..26c93459edb3 100644 --- a/ReactCommon/react/renderer/runtimescheduler/tests/StubClock.h +++ b/ReactCommon/react/renderer/runtimescheduler/tests/StubClock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/tests/StubErrorUtils.h b/ReactCommon/react/renderer/runtimescheduler/tests/StubErrorUtils.h index ca2de84a0fe6..f5ddf9bbd308 100644 --- a/ReactCommon/react/renderer/runtimescheduler/tests/StubErrorUtils.h +++ b/ReactCommon/react/renderer/runtimescheduler/tests/StubErrorUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/runtimescheduler/tests/StubQueue.h b/ReactCommon/react/renderer/runtimescheduler/tests/StubQueue.h index 272be4833b00..e81fb065c9e4 100644 --- a/ReactCommon/react/renderer/runtimescheduler/tests/StubQueue.h +++ b/ReactCommon/react/renderer/runtimescheduler/tests/StubQueue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,32 +7,54 @@ #pragma once +#include #include class StubQueue { public: void runOnQueue(std::function &&func) { - callbackQueue_.push(func); + { + std::lock_guard lock(mutex_); + callbackQueue_.push(func); + } + + signal_.notify_one(); } void flush() { - while (!callbackQueue_.empty()) { + while (size() > 0) { tick(); } } void tick() { - if (!callbackQueue_.empty()) { - auto callback = callbackQueue_.front(); + std::function callback; + { + std::lock_guard lock(mutex_); + if (!callbackQueue_.empty()) { + callback = callbackQueue_.front(); + callbackQueue_.pop(); + } + } + + if (callback) { callback(); - callbackQueue_.pop(); } } - int size() { + size_t size() const { + std::lock_guard lock(mutex_); return callbackQueue_.size(); } + bool waitForTask(std::chrono::duration timeout) const { + std::unique_lock lock(mutex_); + return signal_.wait_for( + lock, timeout, [this]() { return !callbackQueue_.empty(); }); + } + private: + mutable std::condition_variable signal_; + mutable std::mutex mutex_; std::queue> callbackQueue_; }; diff --git a/ReactCommon/react/renderer/scheduler/Android.mk b/ReactCommon/react/renderer/scheduler/Android.mk index 32b8f71dd047..df3b961bb0ed 100644 --- a/ReactCommon/react/renderer/scheduler/Android.mk +++ b/ReactCommon/react/renderer/scheduler/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_scheduler LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,7 +22,25 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libyoga librrc_view libreact_utils libreact_render_templateprocessor libreact_render_graphics libreact_render_uimanager libfolly_futures libreact_render_componentregistry glog libreactconfig libfolly_json libjsi libreact_render_core libreact_render_debug librrc_root libreact_render_mounting libreact_debug libreact_render_runtimescheduler +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libjsi \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mounting \ + libreact_render_runtimescheduler \ + libreact_render_templateprocessor \ + libreact_render_uimanager \ + libreact_utils \ + libreact_config \ + librrc_root \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp index e625afe059bb..543be6cf5c70 100644 --- a/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp +++ b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h index c6751a087912..c6350a431832 100644 --- a/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h +++ b/ReactCommon/react/renderer/scheduler/AsynchronousEventBeat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/scheduler/InspectorData.h b/ReactCommon/react/renderer/scheduler/InspectorData.h index ac77165b0dd0..76eda88ac7e6 100644 --- a/ReactCommon/react/renderer/scheduler/InspectorData.h +++ b/ReactCommon/react/renderer/scheduler/InspectorData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.cpp b/ReactCommon/react/renderer/scheduler/Scheduler.cpp index 15cff205ffee..3a782a9b370c 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.cpp +++ b/ReactCommon/react/renderer/scheduler/Scheduler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -31,7 +31,7 @@ namespace facebook { namespace react { Scheduler::Scheduler( - SchedulerToolbox schedulerToolbox, + SchedulerToolbox const &schedulerToolbox, UIManagerAnimationDelegate *animationDelegate, SchedulerDelegate *delegate) { runtimeExecutor_ = schedulerToolbox.runtimeExecutor; @@ -43,7 +43,7 @@ Scheduler::Scheduler( // Creating a container for future `EventDispatcher` instance. eventDispatcher_ = - std::make_shared>(); + std::make_shared>(); auto uiManager = std::make_shared( runtimeExecutor_, schedulerToolbox.backgroundExecutor, contextContainer_); @@ -86,12 +86,11 @@ Scheduler::Scheduler( uiManager->setDelegate(this); uiManager->setComponentDescriptorRegistry(componentDescriptorRegistry_); - runtimeExecutor_([uiManager, - runtimeExecutor = runtimeExecutor_](jsi::Runtime &runtime) { - auto uiManagerBinding = - UIManagerBinding::createAndInstallIfNeeded(runtime, runtimeExecutor); - uiManagerBinding->attach(uiManager); - }); + runtimeExecutor_( + [uiManager, runtimeExecutor = runtimeExecutor_](jsi::Runtime &runtime) { + UIManagerBinding::createAndInstallIfNeeded( + runtime, runtimeExecutor, uiManager); + }); auto componentDescriptorRegistryKey = "ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE"; @@ -105,7 +104,7 @@ Scheduler::Scheduler( commitHooks_ = schedulerToolbox.commitHooks; uiManager_ = uiManager; - for (auto commitHook : commitHooks_) { + for (auto const &commitHook : commitHooks_) { uiManager->registerCommitHook(*commitHook); } @@ -128,7 +127,7 @@ Scheduler::~Scheduler() { LOG(WARNING) << "Scheduler::~Scheduler() was called (address: " << this << ")."; - for (auto commitHook : commitHooks_) { + for (auto const &commitHook : commitHooks_) { uiManager_->unregisterCommitHook(*commitHook); } @@ -143,7 +142,7 @@ Scheduler::~Scheduler() { // Then, let's verify that the requirement was satisfied. auto surfaceIds = std::vector{}; uiManager_->getShadowTreeRegistry().enumerate( - [&](ShadowTree const &shadowTree, bool &stop) { + [&surfaceIds](ShadowTree const &shadowTree) { surfaceIds.push_back(shadowTree.getSurfaceId()); }); @@ -207,10 +206,10 @@ InspectorData Scheduler::getInspectorDataForInstance( // TODO T97216348: remove folly::dynamic from InspectorData struct result.props = dynamic["props"]; auto hierarchy = dynamic["hierarchy"]; - for (size_t i = 0; i < hierarchy.size(); i++) { - auto viewHierarchyValue = hierarchy[i]["name"]; + for (auto &i : hierarchy) { + auto viewHierarchyValue = i["name"]; if (!viewHierarchyValue.isNull()) { - result.hierarchy.push_back(viewHierarchyValue.c_str()); + result.hierarchy.emplace_back(viewHierarchyValue.c_str()); } } return result; @@ -315,7 +314,7 @@ void Scheduler::uiManagerDidCloneShadowNode( void Scheduler::uiManagerDidDispatchCommand( const ShadowNode::Shared &shadowNode, std::string const &commandName, - folly::dynamic const args) { + folly::dynamic const &args) { SystraceSection s("Scheduler::uiManagerDispatchCommand"); if (delegate_) { diff --git a/ReactCommon/react/renderer/scheduler/Scheduler.h b/ReactCommon/react/renderer/scheduler/Scheduler.h index 32beafc7e9ff..488a656619fe 100644 --- a/ReactCommon/react/renderer/scheduler/Scheduler.h +++ b/ReactCommon/react/renderer/scheduler/Scheduler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +36,7 @@ namespace react { class Scheduler final : public UIManagerDelegate { public: Scheduler( - SchedulerToolbox schedulerToolbox, + SchedulerToolbox const &schedulerToolbox, UIManagerAnimationDelegate *animationDelegate, SchedulerDelegate *delegate); ~Scheduler(); @@ -95,7 +95,7 @@ class Scheduler final : public UIManagerDelegate { void uiManagerDidDispatchCommand( const ShadowNode::Shared &shadowNode, std::string const &commandName, - folly::dynamic const args) override; + folly::dynamic const &args) override; void uiManagerDidSendAccessibilityEvent( const ShadowNode::Shared &shadowNode, std::string const &eventType) override; @@ -125,7 +125,7 @@ class Scheduler final : public UIManagerDelegate { * parts that need to have ownership (and only ownership) of that, and then * fill the optional. */ - std::shared_ptr> eventDispatcher_; + std::shared_ptr> eventDispatcher_; /** * Hold onto ContextContainer. See SchedulerToolbox. diff --git a/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h b/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h index cfd41c5d30d1..e1bf4fda5bb4 100644 --- a/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +++ b/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -47,7 +47,7 @@ class SchedulerDelegate { virtual void schedulerDidDispatchCommand( const ShadowView &shadowView, std::string const &commandName, - folly::dynamic const args) = 0; + folly::dynamic const &args) = 0; virtual void schedulerDidSendAccessibilityEvent( const ShadowView &shadowView, diff --git a/ReactCommon/react/renderer/scheduler/SchedulerToolbox.cpp b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.cpp index 95e21a150644..8b50f893b439 100644 --- a/ReactCommon/react/renderer/scheduler/SchedulerToolbox.cpp +++ b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h index c6c2c179e0e7..6903b86e4531 100644 --- a/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h +++ b/ReactCommon/react/renderer/scheduler/SchedulerToolbox.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp b/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp index 9e3669680334..b68e2f617a15 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp +++ b/ReactCommon/react/renderer/scheduler/SurfaceHandler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,12 +29,12 @@ SurfaceHandler::SurfaceHandler(SurfaceHandler &&other) noexcept { } SurfaceHandler &SurfaceHandler::operator=(SurfaceHandler &&other) noexcept { - std::unique_lock lock1(linkMutex_, std::defer_lock); - std::unique_lock lock2( + std::unique_lock lock1(linkMutex_, std::defer_lock); + std::unique_lock lock2( parametersMutex_, std::defer_lock); - std::unique_lock lock3( + std::unique_lock lock3( other.linkMutex_, std::defer_lock); - std::unique_lock lock4( + std::unique_lock lock4( other.parametersMutex_, std::defer_lock); std::lock(lock1, lock2, lock3, lock4); @@ -51,17 +51,17 @@ SurfaceHandler &SurfaceHandler::operator=(SurfaceHandler &&other) noexcept { void SurfaceHandler::setContextContainer( ContextContainer::Shared contextContainer) const noexcept { - parameters_.contextContainer = contextContainer; + parameters_.contextContainer = std::move(contextContainer); } Status SurfaceHandler::getStatus() const noexcept { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); return link_.status; } void SurfaceHandler::start() const noexcept { SystraceSection s("SurfaceHandler::start"); - std::unique_lock lock(linkMutex_); + std::unique_lock lock(linkMutex_); react_native_assert( link_.status == Status::Registered && "Surface must be registered."); react_native_assert( @@ -73,7 +73,7 @@ void SurfaceHandler::start() const noexcept { auto parameters = Parameters{}; { SystraceSection s2("SurfaceHandler::start::paramsLock"); - std::shared_lock parametersLock(parametersMutex_); + std::shared_lock parametersLock(parametersMutex_); parameters = parameters_; } @@ -100,7 +100,7 @@ void SurfaceHandler::start() const noexcept { void SurfaceHandler::stop() const noexcept { auto shadowTree = ShadowTree::Unique{}; { - std::unique_lock lock(linkMutex_); + std::unique_lock lock(linkMutex_); react_native_assert( link_.status == Status::Running && "Surface must be running."); @@ -118,7 +118,7 @@ void SurfaceHandler::stop() const noexcept { void SurfaceHandler::setDisplayMode(DisplayMode displayMode) const noexcept { { - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); if (parameters_.displayMode == displayMode) { return; } @@ -127,7 +127,7 @@ void SurfaceHandler::setDisplayMode(DisplayMode displayMode) const noexcept { } { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); if (link_.status != Status::Running) { return; @@ -144,41 +144,41 @@ void SurfaceHandler::setDisplayMode(DisplayMode displayMode) const noexcept { } DisplayMode SurfaceHandler::getDisplayMode() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.displayMode; } #pragma mark - Accessors SurfaceId SurfaceHandler::getSurfaceId() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.surfaceId; } void SurfaceHandler::setSurfaceId(SurfaceId surfaceId) const noexcept { - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); parameters_.surfaceId = surfaceId; } std::string SurfaceHandler::getModuleName() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.moduleName; } void SurfaceHandler::setProps(folly::dynamic const &props) const noexcept { SystraceSection s("SurfaceHandler::setProps"); - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); parameters_.props = props; } folly::dynamic SurfaceHandler::getProps() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.props; } std::shared_ptr SurfaceHandler::getMountingCoordinator() const noexcept { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); react_native_assert( link_.status != Status::Unregistered && "Surface must be registered."); react_native_assert( @@ -191,7 +191,7 @@ SurfaceHandler::getMountingCoordinator() const noexcept { Size SurfaceHandler::measure( LayoutConstraints const &layoutConstraints, LayoutContext const &layoutContext) const noexcept { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); if (link_.status != Status::Running) { return layoutConstraints.clamp({0, 0}); @@ -217,7 +217,7 @@ void SurfaceHandler::constraintLayout( LayoutContext const &layoutContext) const noexcept { SystraceSection s("SurfaceHandler::constraintLayout"); { - std::unique_lock lock(parametersMutex_); + std::unique_lock lock(parametersMutex_); if (parameters_.layoutConstraints == layoutConstraints && parameters_.layoutContext == layoutContext) { @@ -229,7 +229,7 @@ void SurfaceHandler::constraintLayout( } { - std::shared_lock lock(linkMutex_); + std::shared_lock lock(linkMutex_); if (link_.status != Status::Running) { return; @@ -248,12 +248,12 @@ void SurfaceHandler::constraintLayout( } LayoutConstraints SurfaceHandler::getLayoutConstraints() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.layoutConstraints; } LayoutContext SurfaceHandler::getLayoutContext() const noexcept { - std::shared_lock lock(parametersMutex_); + std::shared_lock lock(parametersMutex_); return parameters_.layoutContext; } @@ -292,7 +292,7 @@ void SurfaceHandler::applyDisplayMode(DisplayMode displayMode) const noexcept { } void SurfaceHandler::setUIManager(UIManager const *uiManager) const noexcept { - std::unique_lock lock(linkMutex_); + std::unique_lock lock(linkMutex_); react_native_assert( link_.status != Status::Running && "Surface must not be running."); diff --git a/ReactCommon/react/renderer/scheduler/SurfaceHandler.h b/ReactCommon/react/renderer/scheduler/SurfaceHandler.h index c0ae0e60bdc7..babf534da3a3 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceHandler.h +++ b/ReactCommon/react/renderer/scheduler/SurfaceHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -195,13 +195,13 @@ class SurfaceHandler { /* * `link_` and `linkMutex_` pair. */ - mutable better::shared_mutex linkMutex_; + mutable butter::shared_mutex linkMutex_; mutable Link link_; /* * `parameters_` and `parametersMutex_` pair. */ - mutable better::shared_mutex parametersMutex_; + mutable butter::shared_mutex parametersMutex_; mutable Parameters parameters_; }; diff --git a/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp b/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp index a6f8a537f92c..faa9c2c12822 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp +++ b/ReactCommon/react/renderer/scheduler/SurfaceManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -22,7 +22,7 @@ void SurfaceManager::startSurface( LayoutConstraints const &layoutConstraints, LayoutContext const &layoutContext) const noexcept { { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto surfaceHandler = SurfaceHandler{moduleName, surfaceId}; surfaceHandler.setContextContainer(scheduler_.getContextContainer()); registry_.emplace(surfaceId, std::move(surfaceHandler)); @@ -45,7 +45,7 @@ void SurfaceManager::stopSurface(SurfaceId surfaceId) const noexcept { }); { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); auto iterator = registry_.find(surfaceId); registry_.erase(iterator); @@ -87,9 +87,9 @@ void SurfaceManager::constraintSurfaceLayout( void SurfaceManager::visit( SurfaceId surfaceId, - std::function callback) + std::function const &callback) const noexcept { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); auto iterator = registry_.find(surfaceId); diff --git a/ReactCommon/react/renderer/scheduler/SurfaceManager.h b/ReactCommon/react/renderer/scheduler/SurfaceManager.h index 83052f1855d7..76dd2bf8f93a 100644 --- a/ReactCommon/react/renderer/scheduler/SurfaceManager.h +++ b/ReactCommon/react/renderer/scheduler/SurfaceManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -26,7 +26,7 @@ namespace react { */ class SurfaceManager final { public: - SurfaceManager(Scheduler const &scheduler) noexcept; + explicit SurfaceManager(Scheduler const &scheduler) noexcept; #pragma mark - Surface Management @@ -55,12 +55,12 @@ class SurfaceManager final { private: void visit( SurfaceId surfaceId, - std::function callback) + std::function const &callback) const noexcept; Scheduler const &scheduler_; - mutable better::shared_mutex mutex_; // Protects `registry_`. - mutable better::map registry_{}; + mutable butter::shared_mutex mutex_; // Protects `registry_`. + mutable butter::map registry_{}; }; } // namespace react diff --git a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp index 66d6c8c8a0f5..fc9a406629c0 100644 --- a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp +++ b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,17 +9,19 @@ #include +#include + namespace facebook { namespace react { SynchronousEventBeat::SynchronousEventBeat( RunLoopObserver::Unique uiRunLoopObserver, RuntimeExecutor runtimeExecutor, - std::shared_ptr const &runtimeScheduler) + std::shared_ptr runtimeScheduler) : EventBeat({}), uiRunLoopObserver_(std::move(uiRunLoopObserver)), runtimeExecutor_(std::move(runtimeExecutor)), - runtimeScheduler_(runtimeScheduler) { + runtimeScheduler_(std::move(runtimeScheduler)) { uiRunLoopObserver_->setDelegate(this); uiRunLoopObserver_->enable(); } diff --git a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h index a3e2d6489d18..ff2827897b58 100644 --- a/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h +++ b/ReactCommon/react/renderer/scheduler/SynchronousEventBeat.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ class SynchronousEventBeat final : public EventBeat, SynchronousEventBeat( RunLoopObserver::Unique uiRunLoopObserver, RuntimeExecutor runtimeExecutor, - std::shared_ptr const &runtimeScheduler); + std::shared_ptr runtimeScheduler); void induce() const override; diff --git a/ReactCommon/react/renderer/telemetry/Android.mk b/ReactCommon/react/renderer/telemetry/Android.mk index 990ec538ff5f..cba95fb598e2 100644 --- a/ReactCommon/react/renderer/telemetry/Android.mk +++ b/ReactCommon/react/renderer/telemetry/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_telemetry LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,11 +22,23 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libbetter libyoga libfolly_futures glog libfolly_json libglog_init libreact_render_core libreact_render_debug librrc_view librrc_root libreact_utils libreact_debug +LOCAL_SHARED_LIBRARIES := \ + glog \ + libbutter \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libreact_debug \ + libreact_render_core \ + libreact_render_debug \ + libreact_utils \ + librrc_root \ + librrc_view \ + libyoga include $(BUILD_SHARED_LIBRARY) -$(call import-module,better) +$(call import-module,butter) $(call import-module,glog) $(call import-module,folly) $(call import-module,react/utils) diff --git a/ReactCommon/react/renderer/telemetry/BUCK b/ReactCommon/react/renderer/telemetry/BUCK index d6b46e35dec6..efcd05cadd96 100644 --- a/ReactCommon/react/renderer/telemetry/BUCK +++ b/ReactCommon/react/renderer/telemetry/BUCK @@ -50,7 +50,7 @@ rn_xplat_cxx_library( "//xplat/folly:headers_only", "//xplat/folly:memory", "//xplat/folly:molly", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), react_native_xplat_target("react/utils:utils"), ], diff --git a/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.cpp b/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.cpp index 5d836b7006ea..d982e26d6ee7 100644 --- a/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.cpp +++ b/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h b/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h index 6a7263612000..32aa356be9fc 100644 --- a/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h +++ b/ReactCommon/react/renderer/telemetry/SurfaceTelemetry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -60,7 +60,7 @@ class SurfaceTelemetry final { int numberOfTextMeasurements_{}; int lastRevisionNumber_{}; - better:: + butter:: small_vector recentTransactionTelemetries_{}; }; diff --git a/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp b/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp index b7b5fe37c033..79c2f71b55af 100644 --- a/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp +++ b/ReactCommon/react/renderer/telemetry/TransactionTelemetry.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,8 @@ #include +#include + namespace facebook { namespace react { @@ -19,7 +21,7 @@ TransactionTelemetry::TransactionTelemetry() TransactionTelemetry::TransactionTelemetry( std::function now) - : now_{now} {} + : now_{std::move(now)} {} TransactionTelemetry *TransactionTelemetry::threadLocalTelemetry() { return threadLocalTransactionTelemetry; diff --git a/ReactCommon/react/renderer/telemetry/TransactionTelemetry.h b/ReactCommon/react/renderer/telemetry/TransactionTelemetry.h index ab3a398d7853..919e1f26b716 100644 --- a/ReactCommon/react/renderer/telemetry/TransactionTelemetry.h +++ b/ReactCommon/react/renderer/telemetry/TransactionTelemetry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/telemetry/tests/TransactionTelemetryTest.cpp b/ReactCommon/react/renderer/telemetry/tests/TransactionTelemetryTest.cpp index 95c6dfcf1b07..656ea81067f7 100644 --- a/ReactCommon/react/renderer/telemetry/tests/TransactionTelemetryTest.cpp +++ b/ReactCommon/react/renderer/telemetry/tests/TransactionTelemetryTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/templateprocessor/Android.mk b/ReactCommon/react/renderer/templateprocessor/Android.mk index 23ebd6b9a606..18c0e95ded90 100644 --- a/ReactCommon/react/renderer/templateprocessor/Android.mk +++ b/ReactCommon/react/renderer/templateprocessor/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_templateprocessor LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,7 +22,17 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libfolly_futures libreact_utils libreact_render_componentregistry glog libreactconfig libfolly_json libjsi libreact_render_core libreact_render_debug react_render_uimanager +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libjsi \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_utils \ + libreact_config \ + react_render_uimanager include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp index d9f4e44d1dc8..94b2e359084d 100644 --- a/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp +++ b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -39,7 +39,7 @@ SharedShadowNode UITemplateProcessor::runCommand( std::vector ®isters, const ComponentDescriptorRegistry &componentDescriptorRegistry, const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig) { + std::shared_ptr const &reactNativeConfig) { const std::string &opcode = command[0].asString(); const int tagOffset = 420000; // TODO: change to integer codes and a switch statement @@ -106,7 +106,7 @@ SharedShadowNode UITemplateProcessor::buildShadowTree( const folly::dynamic ¶ms, const ComponentDescriptorRegistry &componentDescriptorRegistry, const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig) { + std::shared_ptr const &reactNativeConfig) { if (DEBUG_FLY) { LOG(INFO) << "(strt) UITemplateProcessor inject hardcoded 'server rendered' view tree"; diff --git a/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h index 384c572a6997..22a88aab5277 100644 --- a/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h +++ b/ReactCommon/react/renderer/templateprocessor/UITemplateProcessor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -50,7 +50,7 @@ class UITemplateProcessor { const folly::dynamic ¶ms, const ComponentDescriptorRegistry &componentDescriptorRegistry, const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig); + std::shared_ptr const &reactNativeConfig); private: static ShadowNode::Shared runCommand( @@ -60,7 +60,7 @@ class UITemplateProcessor { std::vector ®isters, const ComponentDescriptorRegistry &componentDescriptorRegistry, const NativeModuleRegistry &nativeModuleRegistry, - const std::shared_ptr reactNativeConfig); + std::shared_ptr const &reactNativeConfig); }; } // namespace react } // namespace facebook diff --git a/ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp b/ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp index add08294321f..fc672ef606bf 100644 --- a/ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp +++ b/ReactCommon/react/renderer/templateprocessor/tests/UITemplateProcessorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -48,8 +48,7 @@ NativeModuleRegistry buildNativeModuleRegistry(); NativeModuleRegistry buildNativeModuleRegistry() { NativeModuleRegistry nMR; nMR.registerModule( - "MobileConfig", - [&](const std::string &methodName, const folly::dynamic &args) { + "MobileConfig", [&](const std::string &, const folly::dynamic &) { return mockSimpleTestValue_; }); return nMR; @@ -57,20 +56,20 @@ NativeModuleRegistry buildNativeModuleRegistry() { class MockReactNativeConfig : public ReactNativeConfig { public: - MockReactNativeConfig() {} + MockReactNativeConfig() = default; bool getBool(const std::string ¶m) const override { return mockSimpleTestValue_; } - std::string getString(const std::string ¶m) const override { + std::string getString(const std::string &) const override { return ""; } - int64_t getInt64(const std::string ¶m) const override { + int64_t getInt64(const std::string &) const override { return 0; } - double getDouble(const std::string ¶m) const override { + double getDouble(const std::string &) const override { return 0.0; } }; diff --git a/ReactCommon/react/renderer/textlayoutmanager/Android.mk b/ReactCommon/react/renderer/textlayoutmanager/Android.mk index 0d216e572762..1e6b951d4a87 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/Android.mk +++ b/ReactCommon/react/renderer/textlayoutmanager/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,8 +10,29 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_textlayoutmanager LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp $(LOCAL_PATH)/platform/android/react/renderer/textlayoutmanager/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) -LOCAL_SHARED_LIBRARIES := libfolly_futures libreactnativeutilsjni libreact_utils libfb libfbjni libreact_render_uimanager libreact_render_componentregistry libreact_render_attributedstring libreact_render_mounting glog libfolly_json libglog_init libyoga libreact_render_core libreact_render_debug libreact_render_graphics libreact_debug libreact_render_mapbuffer libmapbufferjni libreact_render_telemetry +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfb \ + libfbjni \ + libfolly_futures \ + libfolly_json \ + libglog_init \ + libmapbufferjni \ + libreact_debug \ + libreact_render_attributedstring \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_mapbuffer \ + libreact_render_mounting \ + libreact_render_telemetry \ + libreact_render_uimanager \ + libreact_utils \ + libreactnativejni \ + libyoga LOCAL_STATIC_LIBRARIES := diff --git a/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp index 76bbc45c9634..6275bd8c442c 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,8 @@ #include "TextMeasureCache.h" +#include + namespace facebook { namespace react { @@ -30,7 +32,7 @@ LineMeasurement::LineMeasurement( Float capHeight, Float ascender, Float xHeight) - : text(text), + : text(std::move(text)), frame(frame), descender(descender), capHeight(capHeight), diff --git a/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h index d0e71872810d..013796ba53de 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h +++ b/ReactCommon/react/renderer/textlayoutmanager/TextMeasureCache.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp b/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp index 439fdb369af7..abc40602f4e0 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,14 +20,14 @@ using namespace facebook::jni; namespace facebook { namespace react { -TextLayoutManager::~TextLayoutManager() {} +TextLayoutManager::~TextLayoutManager() = default; void *TextLayoutManager::getNativeTextLayoutManager() const { return self_; } TextMeasurement TextLayoutManager::measure( - AttributedStringBox attributedStringBox, + AttributedStringBox const &attributedStringBox, ParagraphAttributes paragraphAttributes, LayoutConstraints layoutConstraints) const { auto &attributedString = attributedStringBox.getValue(); @@ -59,7 +59,7 @@ TextMeasurement TextLayoutManager::measure( TextMeasurement TextLayoutManager::measureCachedSpannableById( int64_t cacheId, - ParagraphAttributes paragraphAttributes, + ParagraphAttributes const ¶graphAttributes, LayoutConstraints layoutConstraints) const { auto env = Environment::current(); auto attachmentPositions = env->NewFloatArray(0); @@ -93,8 +93,8 @@ TextMeasurement TextLayoutManager::measureCachedSpannableById( } LinesMeasurements TextLayoutManager::measureLines( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + AttributedString const &attributedString, + ParagraphAttributes const ¶graphAttributes, Size size) const { if (mapBufferSerializationEnabled_) { return measureLinesMapBuffer(attributedString, paragraphAttributes, size); @@ -147,8 +147,8 @@ LinesMeasurements TextLayoutManager::measureLines( } LinesMeasurements TextLayoutManager::measureLinesMapBuffer( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + AttributedString const &attributedString, + ParagraphAttributes const ¶graphAttributes, Size size) const { const jni::global_ref &fabricUIManager = contextContainer_->at>("FabricUIManager"); @@ -189,12 +189,12 @@ LinesMeasurements TextLayoutManager::measureLinesMapBuffer( TextMeasurement TextLayoutManager::doMeasure( AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + ParagraphAttributes const ¶graphAttributes, LayoutConstraints layoutConstraints) const { layoutConstraints.maximumSize.height = std::numeric_limits::infinity(); int attachmentsCount = 0; - for (auto fragment : attributedString.getFragments()) { + for (auto const &fragment : attributedString.getFragments()) { if (fragment.isAttachment()) { attachmentsCount++; } @@ -219,19 +219,21 @@ TextMeasurement TextLayoutManager::doMeasure( maximumSize.height, attachmentPositions); - jfloat *attachmentData = env->GetFloatArrayElements(attachmentPositions, 0); + jfloat *attachmentData = + env->GetFloatArrayElements(attachmentPositions, nullptr); auto attachments = TextMeasurement::Attachments{}; if (attachmentsCount > 0) { folly::dynamic fragments = serializedAttributedString["fragments"]; int attachmentIndex = 0; - for (int i = 0; i < fragments.size(); i++) { - folly::dynamic fragment = fragments[i]; - if (fragment["isAttachment"] == true) { + for (auto const &fragment : fragments) { + auto isAttachment = fragment.find("isAttachment"); + if (isAttachment != fragment.items().end() && + isAttachment->second.getBool()) { float top = attachmentData[attachmentIndex * 2]; float left = attachmentData[attachmentIndex * 2 + 1]; - float width = (float)fragment["width"].getDouble(); - float height = (float)fragment["height"].getDouble(); + auto width = (float)fragment["width"].getDouble(); + auto height = (float)fragment["height"].getDouble(); auto rect = facebook::react::Rect{ {left, top}, facebook::react::Size{width, height}}; @@ -251,12 +253,12 @@ TextMeasurement TextLayoutManager::doMeasure( TextMeasurement TextLayoutManager::doMeasureMapBuffer( AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + ParagraphAttributes const ¶graphAttributes, LayoutConstraints layoutConstraints) const { layoutConstraints.maximumSize.height = std::numeric_limits::infinity(); int attachmentsCount = 0; - for (auto fragment : attributedString.getFragments()) { + for (auto const &fragment : attributedString.getFragments()) { if (fragment.isAttachment()) { attachmentsCount++; } @@ -282,12 +284,13 @@ TextMeasurement TextLayoutManager::doMeasureMapBuffer( maximumSize.height, attachmentPositions); - jfloat *attachmentData = env->GetFloatArrayElements(attachmentPositions, 0); + jfloat *attachmentData = + env->GetFloatArrayElements(attachmentPositions, nullptr); auto attachments = TextMeasurement::Attachments{}; if (attachmentsCount > 0) { int attachmentIndex = 0; - for (auto fragment : attributedString.getFragments()) { + for (const auto &fragment : attributedString.getFragments()) { if (fragment.isAttachment()) { float top = attachmentData[attachmentIndex * 2]; float left = attachmentData[attachmentIndex * 2 + 1]; diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.h index 19ae11b2a7d6..e739e8ba07af 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/android/react/renderer/textlayoutmanager/TextLayoutManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,7 +27,11 @@ using SharedTextLayoutManager = std::shared_ptr; class TextLayoutManager { public: TextLayoutManager(const ContextContainer::Shared &contextContainer) - : contextContainer_(contextContainer) { + : contextContainer_(contextContainer), + measureCache_{ + contextContainer->at("EnableLargeTextMeasureCache") + ? 1024 + : kSimpleThreadSafeCacheSizeCap} { static auto value = contextContainer->at("MapBufferSerializationEnabled"); mapBufferSerializationEnabled_ = value; @@ -38,7 +42,7 @@ class TextLayoutManager { * Measures `attributedString` using native text rendering infrastructure. */ TextMeasurement measure( - AttributedStringBox attributedStringBox, + AttributedStringBox const &attributedStringBox, ParagraphAttributes paragraphAttributes, LayoutConstraints layoutConstraints) const; @@ -48,7 +52,7 @@ class TextLayoutManager { */ TextMeasurement measureCachedSpannableById( int64_t cacheId, - ParagraphAttributes paragraphAttributes, + ParagraphAttributes const ¶graphAttributes, LayoutConstraints layoutConstraints) const; /* @@ -56,8 +60,8 @@ class TextLayoutManager { * infrastructure. */ LinesMeasurements measureLines( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + AttributedString const &attributedString, + ParagraphAttributes const ¶graphAttributes, Size size) const; /* @@ -69,23 +73,23 @@ class TextLayoutManager { private: TextMeasurement doMeasure( AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + ParagraphAttributes const ¶graphAttributes, LayoutConstraints layoutConstraints) const; TextMeasurement doMeasureMapBuffer( AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + ParagraphAttributes const ¶graphAttributes, LayoutConstraints layoutConstraints) const; LinesMeasurements measureLinesMapBuffer( - AttributedString attributedString, - ParagraphAttributes paragraphAttributes, + AttributedString const &attributedString, + ParagraphAttributes const ¶graphAttributes, Size size) const; void *self_; ContextContainer::Shared contextContainer_; bool mapBufferSerializationEnabled_; - TextMeasureCache measureCache_{}; + TextMeasureCache measureCache_; }; } // namespace react diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp index 6d7f07ea6d1e..de9c2c957538 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h index 87c6fdf4bfec..b06e7592c3bc 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/cxx/TextLayoutManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h index 61b1634f435c..a87d67d19230 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m index 3a39ca20f62a..4c4cb670f48f 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/NSTextStorage+FontScaling.m @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h index 3a8ff540741b..b09fd7115ebe 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm index 7e63b2df90b3..1c6aa270ea5e 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTAttributedTextUtils.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -171,9 +171,8 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex if (textAttributes.textDecorationLineType.value_or(TextDecorationLineType::None) != TextDecorationLineType::None) { auto textDecorationLineType = textAttributes.textDecorationLineType.value(); - NSUnderlineStyle style = RCTNSUnderlineStyleFromStyleAndPattern( - textAttributes.textDecorationLineStyle.value_or(TextDecorationLineStyle::Single), - textAttributes.textDecorationLinePattern.value_or(TextDecorationLinePattern::Solid)); + NSUnderlineStyle style = RCTNSUnderlineStyleFromTextDecorationStyle( + textAttributes.textDecorationStyle.value_or(TextDecorationStyle::Solid)); UIColor *textDecorationColor = RCTUIColorFromSharedColor(textAttributes.textDecorationColor); @@ -311,10 +310,10 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex static UIImage *placeholderImage; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - placeholderImage = [[UIImage alloc] init]; + placeholderImage = [UIImage new]; }); - NSMutableAttributedString *nsAttributedString = [[NSMutableAttributedString alloc] init]; + NSMutableAttributedString *nsAttributedString = [NSMutableAttributedString new]; [nsAttributedString beginEditing]; diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h index 3136b6dd5373..eca30e504683 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontProperties.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h index eafaa4e6f086..ad4d7af3dd92 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.mm index a869b66505e5..4f8d5aa07032 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTFontUtils.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h index e37bef5ca59b..15e4c755abc7 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm index 3cd00abda54d..844fcb228510 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h index c78daec7b7a3..235137bde0c1 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/RCTTextPrimitivesConversions.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -57,43 +57,18 @@ inline static RCTFontVariant RCTFontVariantFromFontVariant(FontVariant fontVaria return (RCTFontVariant)fontVariant; } -inline static NSUnderlineStyle RCTNSUnderlineStyleFromStyleAndPattern( - TextDecorationLineStyle textDecorationLineStyle, - TextDecorationLinePattern textDecorationLinePattern) +inline static NSUnderlineStyle RCTNSUnderlineStyleFromTextDecorationStyle(TextDecorationStyle textDecorationStyle) { - NSUnderlineStyle style = NSUnderlineStyleNone; - - switch (textDecorationLineStyle) { - case TextDecorationLineStyle::Single: - style = NSUnderlineStyle(style | NSUnderlineStyleSingle); - break; - case TextDecorationLineStyle::Thick: - style = NSUnderlineStyle(style | NSUnderlineStyleThick); - break; - case TextDecorationLineStyle::Double: - style = NSUnderlineStyle(style | NSUnderlineStyleDouble); - break; - } - - switch (textDecorationLinePattern) { - case TextDecorationLinePattern::Solid: - style = NSUnderlineStyle(style | NSUnderlinePatternSolid); - break; - case TextDecorationLinePattern::Dash: - style = NSUnderlineStyle(style | NSUnderlinePatternDash); - break; - case TextDecorationLinePattern::Dot: - style = NSUnderlineStyle(style | NSUnderlinePatternDot); - break; - case TextDecorationLinePattern::DashDot: - style = NSUnderlineStyle(style | NSUnderlinePatternDashDot); - break; - case TextDecorationLinePattern::DashDotDot: - style = NSUnderlineStyle(style | NSUnderlinePatternDashDotDot); - break; + switch (textDecorationStyle) { + case TextDecorationStyle::Solid: + return NSUnderlineStyleSingle; + case TextDecorationStyle::Double: + return NSUnderlineStyleDouble; + case TextDecorationStyle::Dashed: + return NSUnderlinePatternDash | NSUnderlineStyleSingle; + case TextDecorationStyle::Dotted: + return NSUnderlinePatternDot | NSUnderlineStyleSingle; } - - return style; } inline static UIColor *RCTUIColorFromSharedColor(const SharedColor &sharedColor) diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h index d23a8f9545a3..ec101a3cb20a 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,15 +20,11 @@ namespace react { class TextLayoutManager; -using SharedTextLayoutManager = std::shared_ptr; - /* * Cross platform facade for iOS-specific RCTTTextLayoutManager. */ class TextLayoutManager { public: - using Shared = std::shared_ptr; - TextLayoutManager(ContextContainer::Shared const &contextContainer); /* diff --git a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.mm b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.mm index 887f3726bac3..74e905bbecd0 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.mm +++ b/ReactCommon/react/renderer/textlayoutmanager/platform/ios/TextLayoutManager.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp b/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp index ab4974c76314..40258861855b 100644 --- a/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp +++ b/ReactCommon/react/renderer/textlayoutmanager/tests/TextLayoutManagerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/timeline/Timeline.cpp b/ReactCommon/react/renderer/timeline/Timeline.cpp index 11dd457d8888..ea569370e8d2 100644 --- a/ReactCommon/react/renderer/timeline/Timeline.cpp +++ b/ReactCommon/react/renderer/timeline/Timeline.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/timeline/Timeline.h b/ReactCommon/react/renderer/timeline/Timeline.h index 8eaaf2267767..cc7e1b4bac92 100644 --- a/ReactCommon/react/renderer/timeline/Timeline.h +++ b/ReactCommon/react/renderer/timeline/Timeline.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/ReactCommon/react/renderer/timeline/TimelineController.cpp b/ReactCommon/react/renderer/timeline/TimelineController.cpp index 153650ae092f..01e716741f76 100644 --- a/ReactCommon/react/renderer/timeline/TimelineController.cpp +++ b/ReactCommon/react/renderer/timeline/TimelineController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,7 +25,7 @@ TimelineHandler TimelineController::enable(SurfaceId surfaceId) const { assert(shadowTreePtr); { - std::unique_lock lock(timelinesMutex_); + std::unique_lock lock(timelinesMutex_); auto timeline = std::make_unique(*shadowTreePtr); auto handler = TimelineHandler{*timeline}; @@ -35,7 +35,7 @@ TimelineHandler TimelineController::enable(SurfaceId surfaceId) const { } void TimelineController::disable(TimelineHandler &&handler) const { - std::unique_lock lock(timelinesMutex_); + std::unique_lock lock(timelinesMutex_); auto iterator = timelines_.find(handler.getSurfaceId()); assert(iterator != timelines_.end()); @@ -57,7 +57,7 @@ RootShadowNode::Unshared TimelineController::shadowTreeWillCommit( ShadowTree const &shadowTree, RootShadowNode::Shared const &oldRootShadowNode, RootShadowNode::Unshared const &newRootShadowNode) const noexcept { - std::shared_lock lock(timelinesMutex_); + std::shared_lock lock(timelinesMutex_); assert(uiManager_ && "`uiManager_` must not be `nullptr`."); diff --git a/ReactCommon/react/renderer/timeline/TimelineController.h b/ReactCommon/react/renderer/timeline/TimelineController.h index 0cfed408e7c7..997fb025a1a0 100644 --- a/ReactCommon/react/renderer/timeline/TimelineController.h +++ b/ReactCommon/react/renderer/timeline/TimelineController.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ #include -#include +#include #include #include @@ -65,12 +65,12 @@ class TimelineController final : public UIManagerCommitHook { /* * Protects all the data members. */ - mutable better::shared_mutex timelinesMutex_; + mutable butter::shared_mutex timelinesMutex_; /* * Owning collection of all running `Timeline` instances. */ - mutable better::map> timelines_; + mutable butter::map> timelines_; mutable UIManager const *uiManager_; mutable SurfaceId lastUpdatedSurface_; diff --git a/ReactCommon/react/renderer/timeline/TimelineFrame.cpp b/ReactCommon/react/renderer/timeline/TimelineFrame.cpp index 6b6f7883021f..b23e160cce15 100644 --- a/ReactCommon/react/renderer/timeline/TimelineFrame.cpp +++ b/ReactCommon/react/renderer/timeline/TimelineFrame.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/timeline/TimelineFrame.h b/ReactCommon/react/renderer/timeline/TimelineFrame.h index a6374cb509a6..0dfb2ed9e71d 100644 --- a/ReactCommon/react/renderer/timeline/TimelineFrame.h +++ b/ReactCommon/react/renderer/timeline/TimelineFrame.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/timeline/TimelineHandler.cpp b/ReactCommon/react/renderer/timeline/TimelineHandler.cpp index 953e305d80b8..3deef099f739 100644 --- a/ReactCommon/react/renderer/timeline/TimelineHandler.cpp +++ b/ReactCommon/react/renderer/timeline/TimelineHandler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/timeline/TimelineHandler.h b/ReactCommon/react/renderer/timeline/TimelineHandler.h index 3065eefa7fec..61fa45f3ce8a 100644 --- a/ReactCommon/react/renderer/timeline/TimelineHandler.h +++ b/ReactCommon/react/renderer/timeline/TimelineHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp b/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp index fd460b1ef22f..08d40bd1214c 100644 --- a/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp +++ b/ReactCommon/react/renderer/timeline/TimelineSnapshot.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,13 +9,15 @@ #include +#include + namespace facebook { namespace react { TimelineSnapshot::TimelineSnapshot( - RootShadowNode::Shared const &rootShadowNode, + RootShadowNode::Shared rootShadowNode, int index) noexcept - : rootShadowNode_(rootShadowNode), + : rootShadowNode_(std::move(rootShadowNode)), frame_(TimelineFrame{index, telemetryTimePointNow()}) {} RootShadowNode::Shared TimelineSnapshot::getRootShadowNode() const noexcept { diff --git a/ReactCommon/react/renderer/timeline/TimelineSnapshot.h b/ReactCommon/react/renderer/timeline/TimelineSnapshot.h index 59d022b3f18d..0b293f321365 100644 --- a/ReactCommon/react/renderer/timeline/TimelineSnapshot.h +++ b/ReactCommon/react/renderer/timeline/TimelineSnapshot.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,9 +20,7 @@ class TimelineSnapshot final { public: using List = std::vector; - TimelineSnapshot( - RootShadowNode::Shared const &rootShadowNode, - int index) noexcept; + TimelineSnapshot(RootShadowNode::Shared rootShadowNode, int index) noexcept; TimelineFrame getFrame() const noexcept; RootShadowNode::Shared getRootShadowNode() const noexcept; diff --git a/ReactCommon/react/renderer/uimanager/Android.mk b/ReactCommon/react/renderer/uimanager/Android.mk index 47975cd7dad2..3962f42c036a 100644 --- a/ReactCommon/react/renderer/uimanager/Android.mk +++ b/ReactCommon/react/renderer/uimanager/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_render_uimanager LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH)/ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../ @@ -21,7 +22,23 @@ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libreact_render_graphics libfolly_futures libruntimeexecutor libreact_render_componentregistry glog libreactconfig libfolly_json libjsi libreact_render_core libreact_render_debug librrc_view librrc_root libreact_render_mounting libreact_debug libreact_render_leakchecker +LOCAL_SHARED_LIBRARIES := \ + glog \ + libfolly_futures \ + libfolly_json \ + libjsi \ + libreact_debug \ + libreact_render_componentregistry \ + libreact_render_core \ + libreact_render_debug \ + libreact_render_graphics \ + libreact_render_leakchecker \ + libreact_render_runtimescheduler \ + libreact_render_mounting \ + libreact_config \ + librrc_root \ + librrc_view \ + libruntimeexecutor include $(BUILD_SHARED_LIBRARY) @@ -34,6 +51,7 @@ $(call import-module,react/renderer/components/view) $(call import-module,react/renderer/componentregistry) $(call import-module,react/renderer/core) $(call import-module,react/renderer/leakchecker) +$(call import-module,react/renderer/runtimescheduler) $(call import-module,react/renderer/debug) $(call import-module,react/renderer/graphics) $(call import-module,react/renderer/mounting) diff --git a/ReactCommon/react/renderer/uimanager/BUCK b/ReactCommon/react/renderer/uimanager/BUCK index d518a76c385a..9633c00bdec7 100644 --- a/ReactCommon/react/renderer/uimanager/BUCK +++ b/ReactCommon/react/renderer/uimanager/BUCK @@ -60,6 +60,7 @@ rn_xplat_cxx_library( react_native_xplat_target("react/renderer/componentregistry:componentregistry"), react_native_xplat_target("react/renderer/debug:debug"), react_native_xplat_target("runtimeexecutor:runtimeexecutor"), + react_native_xplat_target("react/renderer/runtimescheduler:runtimescheduler"), ], ) diff --git a/ReactCommon/react/renderer/uimanager/LayoutAnimationStatusDelegate.h b/ReactCommon/react/renderer/uimanager/LayoutAnimationStatusDelegate.h index cad196eb9823..67e36f45efed 100644 --- a/ReactCommon/react/renderer/uimanager/LayoutAnimationStatusDelegate.h +++ b/ReactCommon/react/renderer/uimanager/LayoutAnimationStatusDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp b/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp new file mode 100644 index 000000000000..124fe7b5e41f --- /dev/null +++ b/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.cpp @@ -0,0 +1,105 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "SurfaceRegistryBinding.h" +#include +#include +#include +#include "bindingUtils.h" + +namespace facebook::react { + +void SurfaceRegistryBinding::startSurface( + jsi::Runtime &runtime, + SurfaceId surfaceId, + std::string const &moduleName, + folly::dynamic const &initalProps, + DisplayMode displayMode) { + SystraceSection s("SurfaceRegistryBinding::startSurface"); + folly::dynamic parameters = folly::dynamic::object(); + parameters["rootTag"] = surfaceId; + parameters["initialProps"] = initalProps; + parameters["fabric"] = true; + + if (moduleName != "LogBox" && + runtime.global().hasProperty(runtime, "RN$SurfaceRegistry")) { + auto registry = + runtime.global().getPropertyAsObject(runtime, "RN$SurfaceRegistry"); + auto method = registry.getPropertyAsFunction(runtime, "renderSurface"); + + method.call( + runtime, + {jsi::String::createFromUtf8(runtime, moduleName), + jsi::valueFromDynamic(runtime, parameters), + jsi::Value(runtime, displayModeToInt(displayMode))}); + } else { + callMethodOfModule( + runtime, + "AppRegistry", + "runApplication", + {jsi::String::createFromUtf8(runtime, moduleName), + jsi::valueFromDynamic(runtime, parameters), + jsi::Value(runtime, displayModeToInt(displayMode))}); + } +} + +void SurfaceRegistryBinding::setSurfaceProps( + jsi::Runtime &runtime, + SurfaceId surfaceId, + std::string const &moduleName, + folly::dynamic const &initalProps, + DisplayMode displayMode) { + SystraceSection s("UIManagerBinding::setSurfaceProps"); + folly::dynamic parameters = folly::dynamic::object(); + parameters["rootTag"] = surfaceId; + parameters["initialProps"] = initalProps; + parameters["fabric"] = true; + + if (moduleName != "LogBox" && + runtime.global().hasProperty(runtime, "RN$SurfaceRegistry")) { + auto registry = + runtime.global().getPropertyAsObject(runtime, "RN$SurfaceRegistry"); + auto method = registry.getPropertyAsFunction(runtime, "setSurfaceProps"); + + method.call( + runtime, + {jsi::String::createFromUtf8(runtime, moduleName), + jsi::valueFromDynamic(runtime, parameters), + jsi::Value(runtime, displayModeToInt(displayMode))}); + } else { + callMethodOfModule( + runtime, + "AppRegistry", + "setSurfaceProps", + {jsi::String::createFromUtf8(runtime, moduleName), + jsi::valueFromDynamic(runtime, parameters), + jsi::Value(runtime, displayModeToInt(displayMode))}); + } +} + +void SurfaceRegistryBinding::stopSurface( + jsi::Runtime &runtime, + SurfaceId surfaceId) { + auto global = runtime.global(); + if (global.hasProperty(runtime, "RN$Bridgeless")) { + if (!global.hasProperty(runtime, "RN$stopSurface")) { + // ReactFabric module has not been loaded yet; there's no surface to stop. + return; + } + // Bridgeless mode uses a custom JSI binding instead of callable module. + global.getPropertyAsFunction(runtime, "RN$stopSurface") + .call(runtime, {jsi::Value{surfaceId}}); + } else { + callMethodOfModule( + runtime, + "ReactFabric", + "unmountComponentAtNode", + {jsi::Value{surfaceId}}); + } +} + +} // namespace facebook::react diff --git a/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.h b/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.h new file mode 100644 index 000000000000..b688b0f61b04 --- /dev/null +++ b/ReactCommon/react/renderer/uimanager/SurfaceRegistryBinding.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include +#include + +namespace facebook::react { + +class SurfaceRegistryBinding final { + public: + SurfaceRegistryBinding() = delete; + + /* + * Starts React Native Surface with given id, moduleName, and props. + * Thread synchronization must be enforced externally. + */ + static void startSurface( + jsi::Runtime &runtime, + SurfaceId surfaceId, + std::string const &moduleName, + folly::dynamic const &initalProps, + DisplayMode displayMode); + + /* + * Updates the React Native Surface identified with surfaceId and moduleName + * with the given props. + * Thread synchronization must be enforced externally. + */ + static void setSurfaceProps( + jsi::Runtime &runtime, + SurfaceId surfaceId, + std::string const &moduleName, + folly::dynamic const &initalProps, + DisplayMode displayMode); + + /* + * Stops React Native Surface with given id. + * Thread synchronization must be enforced externally. + */ + static void stopSurface(jsi::Runtime &runtime, SurfaceId surfaceId); +}; + +} // namespace facebook::react diff --git a/ReactCommon/react/renderer/uimanager/UIManager.cpp b/ReactCommon/react/renderer/uimanager/UIManager.cpp index 56bb2bad80af..27172099150e 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,13 +12,23 @@ #include #include #include +#include #include #include #include +#include + namespace facebook::react { +// Explicitly define destructors here, as they to exist in order to act as a +// "key function" for the ShadowNodeWrapper class -- this allow for RTTI to work +// properly across dynamic library boundaries (i.e. dynamic_cast that is used by +// isHostObject method) +ShadowNodeWrapper::~ShadowNodeWrapper() = default; +ShadowNodeListWrapper::~ShadowNodeListWrapper() = default; + static std::unique_ptr constructLeakCheckerIfNeeded( RuntimeExecutor const &runtimeExecutor) { #ifdef REACT_NATIVE_DEBUG @@ -30,11 +40,11 @@ static std::unique_ptr constructLeakCheckerIfNeeded( UIManager::UIManager( RuntimeExecutor const &runtimeExecutor, - BackgroundExecutor const &backgroundExecutor, + BackgroundExecutor backgroundExecutor, ContextContainer::Shared contextContainer) : runtimeExecutor_(runtimeExecutor), - backgroundExecutor_(backgroundExecutor), - contextContainer_(contextContainer), + backgroundExecutor_(std::move(backgroundExecutor)), + contextContainer_(std::move(contextContainer)), leakChecker_(constructLeakCheckerIfNeeded(runtimeExecutor)) {} UIManager::~UIManager() { @@ -81,7 +91,7 @@ SharedShadowNode UIManager::createNode( family); if (delegate_) { - delegate_->uiManagerDidCreateShadowNode(*shadowNode.get()); + delegate_->uiManagerDidCreateShadowNode(*shadowNode); } if (leakChecker_) { leakChecker_->uiManagerDidCreateShadowNodeFamily(family); @@ -112,7 +122,7 @@ SharedShadowNode UIManager::cloneNode( if (delegate_) { delegate_->uiManagerDidCloneShadowNode( - *shadowNode.get(), *clonedShadowNode.get()); + *shadowNode.get(), *clonedShadowNode); } return clonedShadowNode; @@ -169,12 +179,7 @@ void UIManager::startSurface( runtimeExecutor_([=](jsi::Runtime &runtime) { SystraceSection s("UIManager::startSurface::onRuntime"); - auto uiManagerBinding = UIManagerBinding::getBinding(runtime); - if (!uiManagerBinding) { - return; - } - - uiManagerBinding->startSurface( + SurfaceRegistryBinding::startSurface( runtime, surfaceId, moduleName, props, displayMode); }); } @@ -187,12 +192,7 @@ void UIManager::setSurfaceProps( SystraceSection s("UIManager::setSurfaceProps"); runtimeExecutor_([=](jsi::Runtime &runtime) { - auto uiManagerBinding = UIManagerBinding::getBinding(runtime); - if (!uiManagerBinding) { - return; - } - - uiManagerBinding->setSurfaceProps( + SurfaceRegistryBinding::setSurfaceProps( runtime, surfaceId, moduleName, props, displayMode); }); } @@ -212,12 +212,7 @@ ShadowTree::Unique UIManager::stopSurface(SurfaceId surfaceId) const { // the JavaScript side will not be able to reference a `ShadowTree` and will // fail silently. runtimeExecutor_([=](jsi::Runtime &runtime) { - auto uiManagerBinding = UIManagerBinding::getBinding(runtime); - if (!uiManagerBinding) { - return; - } - - uiManagerBinding->stopSurface(runtime, surfaceId); + SurfaceRegistryBinding::stopSurface(runtime, surfaceId); }); if (leakChecker_) { @@ -333,7 +328,7 @@ void UIManager::updateState(StateUpdate const &stateUpdate) const { void UIManager::dispatchCommand( const ShadowNode::Shared &shadowNode, std::string const &commandName, - folly::dynamic const args) const { + folly::dynamic const &args) const { if (delegate_) { delegate_->uiManagerDidDispatchCommand(shadowNode, commandName, args); } @@ -375,7 +370,8 @@ UIManagerDelegate *UIManager::getDelegate() { } void UIManager::visitBinding( - std::function callback, + std::function const + &callback, jsi::Runtime &runtime) const { auto uiManagerBinding = UIManagerBinding::getBinding(runtime); if (uiManagerBinding) { @@ -389,7 +385,7 @@ ShadowTreeRegistry const &UIManager::getShadowTreeRegistry() const { void UIManager::registerCommitHook( UIManagerCommitHook const &commitHook) const { - std::unique_lock lock(commitHookMutex_); + std::unique_lock lock(commitHookMutex_); react_native_assert( std::find(commitHooks_.begin(), commitHooks_.end(), &commitHook) == commitHooks_.end()); @@ -399,7 +395,7 @@ void UIManager::registerCommitHook( void UIManager::unregisterCommitHook( UIManagerCommitHook const &commitHook) const { - std::unique_lock lock(commitHookMutex_); + std::unique_lock lock(commitHookMutex_); auto iterator = std::find(commitHooks_.begin(), commitHooks_.end(), &commitHook); react_native_assert(iterator != commitHooks_.end()); @@ -413,7 +409,7 @@ RootShadowNode::Unshared UIManager::shadowTreeWillCommit( ShadowTree const &shadowTree, RootShadowNode::Shared const &oldRootShadowNode, RootShadowNode::Unshared const &newRootShadowNode) const { - std::shared_lock lock(commitHookMutex_); + std::shared_lock lock(commitHookMutex_); auto resultRootShadowNode = newRootShadowNode; for (auto const *commitHook : commitHooks_) { @@ -446,13 +442,12 @@ void UIManager::stopSurfaceForAnimationDelegate(SurfaceId surfaceId) const { } } -void UIManager::animationTick() { +void UIManager::animationTick() const { if (animationDelegate_ != nullptr && animationDelegate_->shouldAnimateFrame()) { - shadowTreeRegistry_.enumerate( - [&](ShadowTree const &shadowTree, bool &stop) { - shadowTree.notifyDelegatesOfUpdates(); - }); + shadowTreeRegistry_.enumerate([](ShadowTree const &shadowTree) { + shadowTree.notifyDelegatesOfUpdates(); + }); } } diff --git a/ReactCommon/react/renderer/uimanager/UIManager.h b/ReactCommon/react/renderer/uimanager/UIManager.h index e24434cc9bcc..16553adea458 100644 --- a/ReactCommon/react/renderer/uimanager/UIManager.h +++ b/ReactCommon/react/renderer/uimanager/UIManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -34,7 +34,7 @@ class UIManager final : public ShadowTreeDelegate { public: UIManager( RuntimeExecutor const &runtimeExecutor, - BackgroundExecutor const &backgroundExecutor, + BackgroundExecutor backgroundExecutor, ContextContainer::Shared contextContainer); ~UIManager(); @@ -62,7 +62,7 @@ class UIManager final : public ShadowTreeDelegate { */ void stopSurfaceForAnimationDelegate(SurfaceId surfaceId) const; - void animationTick(); + void animationTick() const; /* * Provides access to a UIManagerBindging. @@ -71,7 +71,8 @@ class UIManager final : public ShadowTreeDelegate { * The callback is called synchronously on the same thread. */ void visitBinding( - std::function callback, + std::function const + &callback, jsi::Runtime &runtime) const; /* @@ -167,7 +168,7 @@ class UIManager final : public ShadowTreeDelegate { void dispatchCommand( const ShadowNode::Shared &shadowNode, std::string const &commandName, - folly::dynamic const args) const; + folly::dynamic const &args) const; void sendAccessibilityEvent( const ShadowNode::Shared &shadowNode, @@ -193,7 +194,7 @@ class UIManager final : public ShadowTreeDelegate { BackgroundExecutor const backgroundExecutor_{}; ContextContainer::Shared contextContainer_; - mutable better::shared_mutex commitHookMutex_; + mutable butter::shared_mutex commitHookMutex_; mutable std::vector commitHooks_; std::unique_ptr leakChecker_; diff --git a/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h b/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h index dc4417df99a1..d20f43c23506 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerAnimationDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp index cbc68035ad82..da6eeb68ffbc 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,54 +12,19 @@ #include #include #include +#include #include -namespace facebook::react { - -static jsi::Value getModule( - jsi::Runtime &runtime, - std::string const &moduleName) { - auto batchedBridge = - runtime.global().getPropertyAsObject(runtime, "__fbBatchedBridge"); - auto getCallableModule = - batchedBridge.getPropertyAsFunction(runtime, "getCallableModule"); - auto moduleAsValue = getCallableModule.callWithThis( - runtime, - batchedBridge, - {jsi::String::createFromUtf8(runtime, moduleName)}); - if (!moduleAsValue.isObject()) { - LOG(ERROR) << "getModule of " << moduleName << " is not an object"; - } - react_native_assert(moduleAsValue.isObject()); - return moduleAsValue; -} +#include -static bool checkBatchedBridgeIsActive(jsi::Runtime &runtime) { - if (!runtime.global().hasProperty(runtime, "__fbBatchedBridge")) { - LOG(ERROR) - << "getPropertyAsObject: property '__fbBatchedBridge' is undefined, expected an Object"; - return false; - } - return true; -} +#include "bindingUtils.h" -static bool checkGetCallableModuleIsActive(jsi::Runtime &runtime) { - if (!checkBatchedBridgeIsActive(runtime)) { - return false; - } - auto batchedBridge = - runtime.global().getPropertyAsObject(runtime, "__fbBatchedBridge"); - if (!batchedBridge.hasProperty(runtime, "getCallableModule")) { - LOG(ERROR) - << "getPropertyAsFunction: function 'getCallableModule' is undefined, expected a Function"; - return false; - } - return true; -} +namespace facebook::react { -std::shared_ptr UIManagerBinding::createAndInstallIfNeeded( +void UIManagerBinding::createAndInstallIfNeeded( jsi::Runtime &runtime, - RuntimeExecutor const &runtimeExecutor) { + RuntimeExecutor const &runtimeExecutor, + std::shared_ptr const &uiManager) { auto uiManagerModuleName = "nativeFabricUIManager"; auto uiManagerValue = @@ -67,17 +32,12 @@ std::shared_ptr UIManagerBinding::createAndInstallIfNeeded( if (uiManagerValue.isUndefined()) { // The global namespace does not have an instance of the binding; // we need to create, install and return it. - auto uiManagerBinding = std::make_shared(runtimeExecutor); + auto uiManagerBinding = + std::make_shared(uiManager, runtimeExecutor); auto object = jsi::Object::createFromHostObject(runtime, uiManagerBinding); runtime.global().setProperty( runtime, uiManagerModuleName, std::move(object)); - return uiManagerBinding; } - - // The global namespace already has an instance of the binding; - // we need to return that. - auto uiManagerObject = uiManagerValue.asObject(runtime); - return uiManagerObject.getHostObject(runtime); } std::shared_ptr UIManagerBinding::getBinding( @@ -94,41 +54,17 @@ std::shared_ptr UIManagerBinding::getBinding( return uiManagerObject.getHostObject(runtime); } -UIManagerBinding::UIManagerBinding(RuntimeExecutor const &runtimeExecutor) - : runtimeExecutor_(runtimeExecutor) {} +UIManagerBinding::UIManagerBinding( + std::shared_ptr uiManager, + RuntimeExecutor runtimeExecutor) + : uiManager_(std::move(uiManager)), + runtimeExecutor_(std::move(runtimeExecutor)) {} UIManagerBinding::~UIManagerBinding() { LOG(WARNING) << "UIManagerBinding::~UIManagerBinding() was called (address: " << this << ")."; } -void UIManagerBinding::attach(std::shared_ptr const &uiManager) { - uiManager_ = uiManager; -} - -static jsi::Value callMethodOfModule( - jsi::Runtime &runtime, - std::string const &moduleName, - std::string const &methodName, - std::initializer_list args) { - if (checkGetCallableModuleIsActive(runtime)) { - auto module = getModule(runtime, moduleName.c_str()); - if (module.isObject()) { - jsi::Object object = module.asObject(runtime); - react_native_assert(object.hasProperty(runtime, methodName.c_str())); - if (object.hasProperty(runtime, methodName.c_str())) { - auto method = object.getPropertyAsFunction(runtime, methodName.c_str()); - return method.callWithThis(runtime, object, args); - } else { - LOG(ERROR) << "getPropertyAsFunction: property '" << methodName - << "' is undefined, expected a Function"; - } - } - } - - return jsi::Value::undefined(); -} - jsi::Value UIManagerBinding::getInspectorDataForInstance( jsi::Runtime &runtime, EventEmitter const &eventEmitter) const { @@ -156,94 +92,6 @@ jsi::Value UIManagerBinding::getInspectorDataForInstance( {std::move(instanceHandle)}); } -void UIManagerBinding::startSurface( - jsi::Runtime &runtime, - SurfaceId surfaceId, - std::string const &moduleName, - folly::dynamic const &initalProps, - DisplayMode displayMode) const { - SystraceSection s("UIManagerBinding::startSurface"); - folly::dynamic parameters = folly::dynamic::object(); - parameters["rootTag"] = surfaceId; - parameters["initialProps"] = initalProps; - parameters["fabric"] = true; - - if (moduleName.compare("LogBox") != 0 && - runtime.global().hasProperty(runtime, "RN$SurfaceRegistry")) { - auto registry = - runtime.global().getPropertyAsObject(runtime, "RN$SurfaceRegistry"); - auto method = registry.getPropertyAsFunction(runtime, "renderSurface"); - - method.call( - runtime, - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } else { - callMethodOfModule( - runtime, - "AppRegistry", - "runApplication", - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } -} - -void UIManagerBinding::setSurfaceProps( - jsi::Runtime &runtime, - SurfaceId surfaceId, - std::string const &moduleName, - folly::dynamic const &initalProps, - DisplayMode displayMode) const { - SystraceSection s("UIManagerBinding::setSurfaceProps"); - folly::dynamic parameters = folly::dynamic::object(); - parameters["rootTag"] = surfaceId; - parameters["initialProps"] = initalProps; - parameters["fabric"] = true; - - if (moduleName.compare("LogBox") != 0 && - runtime.global().hasProperty(runtime, "RN$SurfaceRegistry")) { - auto registry = - runtime.global().getPropertyAsObject(runtime, "RN$SurfaceRegistry"); - auto method = registry.getPropertyAsFunction(runtime, "setSurfaceProps"); - - method.call( - runtime, - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } else { - callMethodOfModule( - runtime, - "AppRegistry", - "setSurfaceProps", - {jsi::String::createFromUtf8(runtime, moduleName), - jsi::valueFromDynamic(runtime, parameters), - jsi::Value(runtime, displayModeToInt(displayMode))}); - } -} - -void UIManagerBinding::stopSurface(jsi::Runtime &runtime, SurfaceId surfaceId) - const { - auto global = runtime.global(); - if (global.hasProperty(runtime, "RN$Bridgeless")) { - if (!global.hasProperty(runtime, "RN$stopSurface")) { - // ReactFabric module has not been loaded yet; there's no surface to stop. - return; - } - // Bridgeless mode uses a custom JSI binding instead of callable module. - global.getPropertyAsFunction(runtime, "RN$stopSurface") - .call(runtime, {jsi::Value{surfaceId}}); - } else { - callMethodOfModule( - runtime, - "ReactFabric", - "unmountComponentAtNode", - {jsi::Value{surfaceId}}); - } -} - void UIManagerBinding::dispatchEvent( jsi::Runtime &runtime, EventTarget const *eventTarget, @@ -276,6 +124,10 @@ void UIManagerBinding::dispatchEvent( }() : jsi::Value::null(); + if (instanceHandle.isNull()) { + LOG(WARNING) << "instanceHandle is null, event will be dropped"; + } + auto &eventHandlerWrapper = static_cast(*eventHandler_); @@ -531,20 +383,32 @@ jsi::Value UIManagerBinding::get( } if (methodName == "completeRoot") { - if (uiManager->backgroundExecutor_) { - std::weak_ptr weakUIManager = uiManager_; - // Enhanced version of the method that uses `backgroundExecutor` and - // captures a shared pointer to `UIManager`. - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [weakUIManager, uiManager]( - jsi::Runtime &runtime, - jsi::Value const &thisValue, - jsi::Value const *arguments, - size_t count) noexcept -> jsi::Value { - auto surfaceId = surfaceIdFromValue(runtime, arguments[0]); + std::weak_ptr weakUIManager = uiManager_; + // Enhanced version of the method that uses `backgroundExecutor` and + // captures a shared pointer to `UIManager`. + return jsi::Function::createFromHostFunction( + runtime, + name, + 2, + [weakUIManager, uiManager]( + jsi::Runtime &runtime, + jsi::Value const &thisValue, + jsi::Value const *arguments, + size_t count) noexcept -> jsi::Value { + auto runtimeSchedulerBinding = + RuntimeSchedulerBinding::getBinding(runtime); + auto surfaceId = surfaceIdFromValue(runtime, arguments[0]); + + if (runtimeSchedulerBinding && + runtimeSchedulerBinding->getIsSynchronous()) { + auto weakShadowNodeList = + weakShadowNodeListFromValue(runtime, arguments[1]); + auto shadowNodeList = + shadowNodeListFromWeakList(weakShadowNodeList); + if (shadowNodeList) { + uiManager->completeSurface(surfaceId, shadowNodeList, {true}); + } + } else { auto weakShadowNodeList = weakShadowNodeListFromValue(runtime, arguments[1]); static std::atomic_uint_fast8_t completeRootEventCounter{0}; @@ -571,29 +435,10 @@ jsi::Value UIManagerBinding::get( surfaceId, shadowNodeList, {true, shouldYield}); } }); + } - return jsi::Value::undefined(); - }); - } else { - // Basic version of the method that does *not* use `backgroundExecutor` - // and does *not* capture a shared pointer to `UIManager`. - return jsi::Function::createFromHostFunction( - runtime, - name, - 2, - [uiManager]( - jsi::Runtime &runtime, - jsi::Value const &thisValue, - jsi::Value const *arguments, - size_t count) noexcept -> jsi::Value { - uiManager->completeSurface( - surfaceIdFromValue(runtime, arguments[0]), - shadowNodeListFromValue(runtime, arguments[1]), - {true, {}}); - - return jsi::Value::undefined(); - }); - } + return jsi::Value::undefined(); + }); } if (methodName == "registerEventHandler") { diff --git a/ReactCommon/react/renderer/uimanager/UIManagerBinding.h b/ReactCommon/react/renderer/uimanager/UIManagerBinding.h index 947e3ecf43e6..9ddd53d77e22 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerBinding.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerBinding.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,13 +24,12 @@ class UIManagerBinding : public jsi::HostObject { /* * Installs UIManagerBinding into JavaScript runtime if needed. * Creates and sets `UIManagerBinding` into the global namespace. - * In case if the global namespace already has a `UIManagerBinding` installed, - * returns that. * Thread synchronization must be enforced externally. */ - static std::shared_ptr createAndInstallIfNeeded( + static void createAndInstallIfNeeded( jsi::Runtime &runtime, - RuntimeExecutor const &runtimeExecutor); + RuntimeExecutor const &runtimeExecutor, + std::shared_ptr const &uiManager); /* * Returns a pointer to UIManagerBinding previously installed into a runtime. @@ -38,50 +37,16 @@ class UIManagerBinding : public jsi::HostObject { */ static std::shared_ptr getBinding(jsi::Runtime &runtime); - UIManagerBinding(RuntimeExecutor const &runtimeExecutor); + UIManagerBinding( + std::shared_ptr uiManager, + RuntimeExecutor runtimeExecutor); ~UIManagerBinding(); - /* - * Establish a relationship between `UIManager` and `UIManagerBinding` by - * setting internal pointers to each other. - * Must be called on JavaScript thread or during VM destruction. - */ - void attach(std::shared_ptr const &uiManager); - - /* - * Starts React Native Surface with given id, moduleName, and props. - * Thread synchronization must be enforced externally. - */ - void startSurface( - jsi::Runtime &runtime, - SurfaceId surfaceId, - std::string const &moduleName, - folly::dynamic const &initalProps, - DisplayMode displayMode) const; - - /* - * Updates the React Native Surface identified with surfaceId and moduleName - * with the given props. - * Thread synchronization must be enforced externally. - */ - void setSurfaceProps( - jsi::Runtime &runtime, - SurfaceId surfaceId, - std::string const &moduleName, - folly::dynamic const &props, - DisplayMode displayMode) const; - jsi::Value getInspectorDataForInstance( jsi::Runtime &runtime, EventEmitter const &eventEmitter) const; - /* - * Stops React Native Surface with given id. - * Thread synchronization must be enforced externally. - */ - void stopSurface(jsi::Runtime &runtime, SurfaceId surfaceId) const; - /* * Delivers raw event data to JavaScript. * Thread synchronization must be enforced externally. diff --git a/ReactCommon/react/renderer/uimanager/UIManagerCommitHook.h b/ReactCommon/react/renderer/uimanager/UIManagerCommitHook.h index 50fa5ebb6678..c6fdfaab4e05 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerCommitHook.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerCommitHook.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h b/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h index 91d8bf551074..a36feaed21cd 100644 --- a/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h +++ b/ReactCommon/react/renderer/uimanager/UIManagerDelegate.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -47,7 +47,7 @@ class UIManagerDelegate { virtual void uiManagerDidDispatchCommand( const ShadowNode::Shared &shadowNode, std::string const &commandName, - folly::dynamic const args) = 0; + folly::dynamic const &args) = 0; /* * Called when UIManager wants to dispatch some accessibility event diff --git a/ReactCommon/react/renderer/uimanager/bindingUtils.cpp b/ReactCommon/react/renderer/uimanager/bindingUtils.cpp new file mode 100644 index 000000000000..48bc18083951 --- /dev/null +++ b/ReactCommon/react/renderer/uimanager/bindingUtils.cpp @@ -0,0 +1,79 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#include "bindingUtils.h" + +#include +#include + +namespace facebook::react { + +static jsi::Value getModule( + jsi::Runtime &runtime, + std::string const &moduleName) { + auto batchedBridge = + runtime.global().getPropertyAsObject(runtime, "__fbBatchedBridge"); + auto getCallableModule = + batchedBridge.getPropertyAsFunction(runtime, "getCallableModule"); + auto moduleAsValue = getCallableModule.callWithThis( + runtime, + batchedBridge, + {jsi::String::createFromUtf8(runtime, moduleName)}); + if (!moduleAsValue.isObject()) { + LOG(ERROR) << "getModule of " << moduleName << " is not an object"; + } + react_native_assert(moduleAsValue.isObject()); + return moduleAsValue; +} + +static bool checkBatchedBridgeIsActive(jsi::Runtime &runtime) { + if (!runtime.global().hasProperty(runtime, "__fbBatchedBridge")) { + LOG(ERROR) + << "getPropertyAsObject: property '__fbBatchedBridge' is undefined, expected an Object"; + return false; + } + return true; +} + +static bool checkGetCallableModuleIsActive(jsi::Runtime &runtime) { + if (!checkBatchedBridgeIsActive(runtime)) { + return false; + } + auto batchedBridge = + runtime.global().getPropertyAsObject(runtime, "__fbBatchedBridge"); + if (!batchedBridge.hasProperty(runtime, "getCallableModule")) { + LOG(ERROR) + << "getPropertyAsFunction: function 'getCallableModule' is undefined, expected a Function"; + return false; + } + return true; +} + +jsi::Value callMethodOfModule( + jsi::Runtime &runtime, + std::string const &moduleName, + std::string const &methodName, + std::initializer_list args) { + if (checkGetCallableModuleIsActive(runtime)) { + auto module = getModule(runtime, moduleName); + if (module.isObject()) { + jsi::Object object = module.asObject(runtime); + react_native_assert(object.hasProperty(runtime, methodName.c_str())); + if (object.hasProperty(runtime, methodName.c_str())) { + auto method = object.getPropertyAsFunction(runtime, methodName.c_str()); + return method.callWithThis(runtime, object, args); + } else { + LOG(ERROR) << "getPropertyAsFunction: property '" << methodName + << "' is undefined, expected a Function"; + } + } + } + + return jsi::Value::undefined(); +} + +} // namespace facebook::react diff --git a/ReactCommon/react/renderer/uimanager/bindingUtils.h b/ReactCommon/react/renderer/uimanager/bindingUtils.h new file mode 100644 index 000000000000..17c978f8cddb --- /dev/null +++ b/ReactCommon/react/renderer/uimanager/bindingUtils.h @@ -0,0 +1,20 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include + +namespace facebook::react { + +jsi::Value callMethodOfModule( + jsi::Runtime &runtime, + std::string const &moduleName, + std::string const &methodName, + std::initializer_list args); + +} // namespace facebook::react diff --git a/ReactCommon/react/renderer/uimanager/primitives.h b/ReactCommon/react/renderer/uimanager/primitives.h index 749fca7f2810..cc2f925a5f13 100644 --- a/ReactCommon/react/renderer/uimanager/primitives.h +++ b/ReactCommon/react/renderer/uimanager/primitives.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,6 +30,11 @@ struct ShadowNodeWrapper : public jsi::HostObject { ShadowNodeWrapper(SharedShadowNode shadowNode) : shadowNode(std::move(shadowNode)) {} + // The below method needs to be implemented out-of-line in order for the class + // to have at least one "key function" (see + // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable) + ~ShadowNodeWrapper() override; + ShadowNode::Shared shadowNode; }; @@ -37,6 +42,11 @@ struct ShadowNodeListWrapper : public jsi::HostObject { ShadowNodeListWrapper(SharedShadowNodeUnsharedList shadowNodeList) : shadowNodeList(shadowNodeList) {} + // The below method needs to be implemented out-of-line in order for the class + // to have at least one "key function" (see + // https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vague-vtable) + ~ShadowNodeListWrapper() override; + SharedShadowNodeUnsharedList shadowNodeList; }; diff --git a/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp b/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp index de35870cd304..c842a454b659 100644 --- a/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp +++ b/ReactCommon/react/renderer/uimanager/tests/FabricUIManagerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/test_utils/BUCK b/ReactCommon/react/test_utils/BUCK index 55a8cac9d0f5..1b467742a75c 100644 --- a/ReactCommon/react/test_utils/BUCK +++ b/ReactCommon/react/test_utils/BUCK @@ -42,7 +42,7 @@ rn_xplat_cxx_library( visibility = ["PUBLIC"], deps = [ "//xplat/jsi:jsi", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), ], exported_deps = [ diff --git a/ReactCommon/react/test_utils/Entropy.h b/ReactCommon/react/test_utils/Entropy.h index 7bbaf91012f2..e9fb4eb66a53 100644 --- a/ReactCommon/react/test_utils/Entropy.h +++ b/ReactCommon/react/test_utils/Entropy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/test_utils/MockClock.h b/ReactCommon/react/test_utils/MockClock.h index a5155207b207..00419695b04d 100644 --- a/ReactCommon/react/test_utils/MockClock.h +++ b/ReactCommon/react/test_utils/MockClock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/test_utils/MockSurfaceHandler.h b/ReactCommon/react/test_utils/MockSurfaceHandler.h index c6f678ce4848..ce3d15001256 100644 --- a/ReactCommon/react/test_utils/MockSurfaceHandler.h +++ b/ReactCommon/react/test_utils/MockSurfaceHandler.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -19,6 +19,7 @@ class MockSurfaceHandler : public SurfaceHandler { MockSurfaceHandler() : SurfaceHandler("moduleName", 0){}; MOCK_QUALIFIED_METHOD1(setDisplayMode, const noexcept, void(DisplayMode)); + MOCK_QUALIFIED_METHOD0(getSurfaceId, const noexcept, SurfaceId()); }; } // namespace react diff --git a/ReactCommon/react/test_utils/shadowTreeGeneration.h b/ReactCommon/react/test_utils/shadowTreeGeneration.h index f2897cb5e187..d4be32be5861 100644 --- a/ReactCommon/react/test_utils/shadowTreeGeneration.h +++ b/ReactCommon/react/test_utils/shadowTreeGeneration.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/Android.mk b/ReactCommon/react/utils/Android.mk index 471b15e6cff3..c77ab5ac3bdf 100644 --- a/ReactCommon/react/utils/Android.mk +++ b/ReactCommon/react/utils/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -10,6 +10,7 @@ include $(CLEAR_VARS) LOCAL_MODULE := react_utils LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/../../ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../ @@ -20,7 +21,11 @@ LOCAL_CFLAGS := \ LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := libreact_debug libreact_render_mapbuffer libglog libglog_init +LOCAL_SHARED_LIBRARIES := \ + libglog \ + libglog_init \ + libreact_debug \ + libreact_render_mapbuffer include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/react/utils/BUCK b/ReactCommon/react/utils/BUCK index 6525d5b9b5de..99a0f1eff0bb 100644 --- a/ReactCommon/react/utils/BUCK +++ b/ReactCommon/react/utils/BUCK @@ -58,7 +58,7 @@ rn_xplat_cxx_library( "//xplat/folly:memory", "//xplat/folly:molly", "//xplat/jsi:jsi", - react_native_xplat_target("better:better"), + react_native_xplat_target("butter:butter"), react_native_xplat_target("react/debug:debug"), ], ) diff --git a/ReactCommon/react/utils/CalledOnceMovableOnlyFunction.h b/ReactCommon/react/utils/CalledOnceMovableOnlyFunction.h index 4d4d2c0d056d..09aa8812ffcb 100644 --- a/ReactCommon/react/utils/CalledOnceMovableOnlyFunction.h +++ b/ReactCommon/react/utils/CalledOnceMovableOnlyFunction.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,7 +26,7 @@ class CalledOnceMovableOnlyFunction { bool wasMovedFrom_; public: - CalledOnceMovableOnlyFunction(std::function &&function) + explicit CalledOnceMovableOnlyFunction(std::function &&function) : function_(std::move(function)) { wasCalled_ = false; wasMovedFrom_ = false; diff --git a/ReactCommon/react/utils/ContextContainer.h b/ReactCommon/react/utils/ContextContainer.h index 1431fe1af831..bbf99a248919 100644 --- a/ReactCommon/react/utils/ContextContainer.h +++ b/ReactCommon/react/utils/ContextContainer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,9 +11,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include @@ -42,7 +42,7 @@ class ContextContainer final { */ template void insert(std::string const &key, T const &instance) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); instances_.insert({key, std::make_shared(instance)}); } @@ -52,7 +52,7 @@ class ContextContainer final { * Does nothing if the instance was not found. */ void erase(std::string const &key) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); instances_.erase(key); } @@ -63,7 +63,7 @@ class ContextContainer final { * values from the given container. */ void update(ContextContainer const &contextContainer) const { - std::unique_lock lock(mutex_); + std::unique_lock lock(mutex_); for (auto const &pair : contextContainer.instances_) { instances_.erase(pair.first); @@ -78,7 +78,7 @@ class ContextContainer final { */ template T at(std::string const &key) const { - std::shared_lock lock(mutex_); + std::shared_lock lock(mutex_); react_native_assert( instances_.find(key) != instances_.end() && @@ -92,8 +92,8 @@ class ContextContainer final { * Returns an empty optional if the instance could not be found. */ template - better::optional find(std::string const &key) const { - std::shared_lock lock(mutex_); + butter::optional find(std::string const &key) const { + std::shared_lock lock(mutex_); auto iterator = instances_.find(key); if (iterator == instances_.end()) { @@ -104,9 +104,9 @@ class ContextContainer final { } private: - mutable better::shared_mutex mutex_; + mutable butter::shared_mutex mutex_; // Protected by mutex_`. - mutable better::map> instances_; + mutable butter::map> instances_; }; } // namespace react diff --git a/ReactCommon/react/utils/FloatComparison.h b/ReactCommon/react/utils/FloatComparison.h index 4dce8a8b5958..aa198b442a5d 100644 --- a/ReactCommon/react/utils/FloatComparison.h +++ b/ReactCommon/react/utils/FloatComparison.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/LayoutManager.h b/ReactCommon/react/utils/LayoutManager.h index bc901971a3cb..95b7147c0f9a 100644 --- a/ReactCommon/react/utils/LayoutManager.h +++ b/ReactCommon/react/utils/LayoutManager.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/ManagedObjectWrapper.h b/ReactCommon/react/utils/ManagedObjectWrapper.h index f91cd3e99d81..cd04022cb066 100644 --- a/ReactCommon/react/utils/ManagedObjectWrapper.h +++ b/ReactCommon/react/utils/ManagedObjectWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/ManagedObjectWrapper.mm b/ReactCommon/react/utils/ManagedObjectWrapper.mm index ede1d30aad84..69bde90f422c 100644 --- a/ReactCommon/react/utils/ManagedObjectWrapper.mm +++ b/ReactCommon/react/utils/ManagedObjectWrapper.mm @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/RunLoopObserver.cpp b/ReactCommon/react/utils/RunLoopObserver.cpp index d24c3ede72bb..c957c43b42f6 100644 --- a/ReactCommon/react/utils/RunLoopObserver.cpp +++ b/ReactCommon/react/utils/RunLoopObserver.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/RunLoopObserver.h b/ReactCommon/react/utils/RunLoopObserver.h index 5bd7bd7a4c84..469d8c266261 100644 --- a/ReactCommon/react/utils/RunLoopObserver.h +++ b/ReactCommon/react/utils/RunLoopObserver.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/react/utils/SharedFunction.h b/ReactCommon/react/utils/SharedFunction.h index 180f284d94a6..a4a958798bef 100644 --- a/ReactCommon/react/utils/SharedFunction.h +++ b/ReactCommon/react/utils/SharedFunction.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ #include #include -#include +#include namespace facebook { namespace react { @@ -31,7 +31,7 @@ class SharedFunction { struct Pair { Pair(std::function &&function) : function(std::move(function)) {} std::function function; - better::shared_mutex mutex{}; + butter::shared_mutex mutex{}; }; public: @@ -45,12 +45,12 @@ class SharedFunction { SharedFunction &operator=(SharedFunction &&other) noexcept = default; void assign(std::function function) const { - std::unique_lock lock(pair_->mutex); + std::unique_lock lock(pair_->mutex); pair_->function = function; } ReturnT operator()(ArgumentT... args) const { - std::shared_lock lock(pair_->mutex); + std::shared_lock lock(pair_->mutex); return pair_->function(args...); } diff --git a/ReactCommon/react/utils/SimpleThreadSafeCache.h b/ReactCommon/react/utils/SimpleThreadSafeCache.h index b500535bb7fa..f5b71fec4990 100644 --- a/ReactCommon/react/utils/SimpleThreadSafeCache.h +++ b/ReactCommon/react/utils/SimpleThreadSafeCache.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ #include #include -#include +#include #include namespace facebook { @@ -22,6 +22,7 @@ template class SimpleThreadSafeCache { public: SimpleThreadSafeCache() : map_{maxSize} {} + SimpleThreadSafeCache(unsigned long size) : map_{size} {} /* * Returns a value from the map with a given key. @@ -47,7 +48,7 @@ class SimpleThreadSafeCache { * If the value wasn't found in the cache, returns empty optional. * Can be called from any thread. */ - better::optional get(const KeyT &key) const { + butter::optional get(const KeyT &key) const { std::lock_guard lock(mutex_); auto iterator = map_.find(key); if (iterator == map_.end()) { diff --git a/ReactCommon/react/utils/Telemetry.h b/ReactCommon/react/utils/Telemetry.h index 10a82e07f043..f86e7a297fba 100644 --- a/ReactCommon/react/utils/Telemetry.h +++ b/ReactCommon/react/utils/Telemetry.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/reactperflogger/Android.mk b/ReactCommon/reactperflogger/Android.mk index a65bfd18ee02..863a865a25d2 100644 --- a/ReactCommon/reactperflogger/Android.mk +++ b/ReactCommon/reactperflogger/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -20,6 +20,7 @@ LOCAL_MODULE := reactperflogger # Compile all local c++ files under ./ReactCommon LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/reactperflogger/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) # Build the files in this directory as a shared library include $(BUILD_STATIC_LIBRARY) diff --git a/ReactCommon/reactperflogger/React-perflogger.podspec b/ReactCommon/reactperflogger/React-perflogger.podspec index 2be907ca3ae5..f1f1650256aa 100644 --- a/ReactCommon/reactperflogger/React-perflogger.podspec +++ b/ReactCommon/reactperflogger/React-perflogger.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp index f23256bf5cef..7c0da26878a1 100644 --- a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp +++ b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h index 9ac83b9615e8..c9593ec86f39 100644 --- a/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h +++ b/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h b/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h index 54def97671cd..2cb386b48afb 100644 --- a/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h +++ b/ReactCommon/reactperflogger/reactperflogger/NativeModulePerfLogger.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/runtimeexecutor/Android.mk b/ReactCommon/runtimeexecutor/Android.mk index 6b39530804df..147b1b2034a9 100644 --- a/ReactCommon/runtimeexecutor/Android.mk +++ b/ReactCommon/runtimeexecutor/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -16,4 +16,4 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall -include $(BUILD_STATIC_LIBRARY) +include $(BUILD_SHARED_LIBRARY) diff --git a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec index fd11178e5ac1..b5a5c126f82f 100644 --- a/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec +++ b/ReactCommon/runtimeexecutor/React-runtimeexecutor.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.h b/ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.h index 3e06081e45a8..1c5180918d64 100644 --- a/ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.h +++ b/ReactCommon/runtimeexecutor/ReactCommon/RuntimeExecutor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/Android.mk b/ReactCommon/yoga/Android.mk index d4ec34f9b322..adc1816307e4 100644 --- a/ReactCommon/yoga/Android.mk +++ b/ReactCommon/yoga/Android.mk @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -11,6 +11,7 @@ LOCAL_MODULE := yogacore LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/yoga/*.cpp) LOCAL_SRC_FILES += $(wildcard $(LOCAL_PATH)/yoga/*/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES) diff --git a/ReactCommon/yoga/Yoga.podspec b/ReactCommon/yoga/Yoga.podspec index 701e93301a68..bdaefc340ed6 100644 --- a/ReactCommon/yoga/Yoga.podspec +++ b/ReactCommon/yoga/Yoga.podspec @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/BitUtils.h b/ReactCommon/yoga/yoga/BitUtils.h index 2161effc7bb6..b17751ad3319 100644 --- a/ReactCommon/yoga/yoga/BitUtils.h +++ b/ReactCommon/yoga/yoga/BitUtils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/CompactValue.h b/ReactCommon/yoga/yoga/CompactValue.h index f398668e2e13..6879ca146ff7 100644 --- a/ReactCommon/yoga/yoga/CompactValue.h +++ b/ReactCommon/yoga/yoga/CompactValue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/Utils.cpp b/ReactCommon/yoga/yoga/Utils.cpp index eaa74b0629ac..f2af12b2305d 100644 --- a/ReactCommon/yoga/yoga/Utils.cpp +++ b/ReactCommon/yoga/yoga/Utils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/Utils.h b/ReactCommon/yoga/yoga/Utils.h index 57e1d45d992b..d21e8ecb32be 100644 --- a/ReactCommon/yoga/yoga/Utils.h +++ b/ReactCommon/yoga/yoga/Utils.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGConfig.cpp b/ReactCommon/yoga/yoga/YGConfig.cpp index fb72e80cfcff..915da52af77a 100644 --- a/ReactCommon/yoga/yoga/YGConfig.cpp +++ b/ReactCommon/yoga/yoga/YGConfig.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGConfig.h b/ReactCommon/yoga/yoga/YGConfig.h index e87d67586be0..607408ace4b4 100644 --- a/ReactCommon/yoga/yoga/YGConfig.h +++ b/ReactCommon/yoga/yoga/YGConfig.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGEnums.cpp b/ReactCommon/yoga/yoga/YGEnums.cpp index c01d3d94b3f1..b97342d8c279 100644 --- a/ReactCommon/yoga/yoga/YGEnums.cpp +++ b/ReactCommon/yoga/yoga/YGEnums.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGEnums.h b/ReactCommon/yoga/yoga/YGEnums.h index 3dc458dcb31a..c14daaa1a678 100644 --- a/ReactCommon/yoga/yoga/YGEnums.h +++ b/ReactCommon/yoga/yoga/YGEnums.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGFloatOptional.h b/ReactCommon/yoga/yoga/YGFloatOptional.h index e4cf0284bab0..4aa9e76e2993 100644 --- a/ReactCommon/yoga/yoga/YGFloatOptional.h +++ b/ReactCommon/yoga/yoga/YGFloatOptional.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGLayout.cpp b/ReactCommon/yoga/yoga/YGLayout.cpp index e43213cdc66a..9aadcd4aecd0 100644 --- a/ReactCommon/yoga/yoga/YGLayout.cpp +++ b/ReactCommon/yoga/yoga/YGLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGLayout.h b/ReactCommon/yoga/yoga/YGLayout.h index b7604d8e2dbe..6c23934207e9 100644 --- a/ReactCommon/yoga/yoga/YGLayout.h +++ b/ReactCommon/yoga/yoga/YGLayout.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGMacros.h b/ReactCommon/yoga/yoga/YGMacros.h index c6917f1b1d9a..9211c87b317b 100644 --- a/ReactCommon/yoga/yoga/YGMacros.h +++ b/ReactCommon/yoga/yoga/YGMacros.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGNode.cpp b/ReactCommon/yoga/yoga/YGNode.cpp index f4c14bf3d8c9..32eabd1d5f92 100644 --- a/ReactCommon/yoga/yoga/YGNode.cpp +++ b/ReactCommon/yoga/yoga/YGNode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGNode.h b/ReactCommon/yoga/yoga/YGNode.h index 4b6e6277af8a..8c511236770a 100644 --- a/ReactCommon/yoga/yoga/YGNode.h +++ b/ReactCommon/yoga/yoga/YGNode.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGNodePrint.cpp b/ReactCommon/yoga/yoga/YGNodePrint.cpp index 72d147dbb7b2..d46373c4b814 100644 --- a/ReactCommon/yoga/yoga/YGNodePrint.cpp +++ b/ReactCommon/yoga/yoga/YGNodePrint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGNodePrint.h b/ReactCommon/yoga/yoga/YGNodePrint.h index 3db504b46021..0e25b9728b04 100644 --- a/ReactCommon/yoga/yoga/YGNodePrint.h +++ b/ReactCommon/yoga/yoga/YGNodePrint.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGStyle.cpp b/ReactCommon/yoga/yoga/YGStyle.cpp index e8033bdf4c87..f8bba25d5e5f 100644 --- a/ReactCommon/yoga/yoga/YGStyle.cpp +++ b/ReactCommon/yoga/yoga/YGStyle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGStyle.h b/ReactCommon/yoga/yoga/YGStyle.h index aab7599ccd96..b463623abc98 100644 --- a/ReactCommon/yoga/yoga/YGStyle.h +++ b/ReactCommon/yoga/yoga/YGStyle.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGValue.cpp b/ReactCommon/yoga/yoga/YGValue.cpp index 37383a555735..89ff41bab117 100644 --- a/ReactCommon/yoga/yoga/YGValue.cpp +++ b/ReactCommon/yoga/yoga/YGValue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/YGValue.h b/ReactCommon/yoga/yoga/YGValue.h index a20009784ea8..11beb3ec8b74 100644 --- a/ReactCommon/yoga/yoga/YGValue.h +++ b/ReactCommon/yoga/yoga/YGValue.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/Yoga-internal.h b/ReactCommon/yoga/yoga/Yoga-internal.h index acd173be83f2..08f9da171c07 100644 --- a/ReactCommon/yoga/yoga/Yoga-internal.h +++ b/ReactCommon/yoga/yoga/Yoga-internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 2c68674a7429..99862797b9bb 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/Yoga.h b/ReactCommon/yoga/yoga/Yoga.h index 86cd65e2f08f..3444658bbe0d 100644 --- a/ReactCommon/yoga/yoga/Yoga.h +++ b/ReactCommon/yoga/yoga/Yoga.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/event/event.cpp b/ReactCommon/yoga/yoga/event/event.cpp index 3af3e83a0659..152c4e16f5c9 100644 --- a/ReactCommon/yoga/yoga/event/event.cpp +++ b/ReactCommon/yoga/yoga/event/event.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/event/event.h b/ReactCommon/yoga/yoga/event/event.h index 404ec3766c5f..a5978914a9b9 100644 --- a/ReactCommon/yoga/yoga/event/event.h +++ b/ReactCommon/yoga/yoga/event/event.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/internal/experiments-inl.h b/ReactCommon/yoga/yoga/internal/experiments-inl.h index 959d9c3327e3..442355901619 100644 --- a/ReactCommon/yoga/yoga/internal/experiments-inl.h +++ b/ReactCommon/yoga/yoga/internal/experiments-inl.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/internal/experiments.cpp b/ReactCommon/yoga/yoga/internal/experiments.cpp index 16f196d5ed0e..016ea208709d 100644 --- a/ReactCommon/yoga/yoga/internal/experiments.cpp +++ b/ReactCommon/yoga/yoga/internal/experiments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/internal/experiments.h b/ReactCommon/yoga/yoga/internal/experiments.h index 1bdb7014b02a..2298e247224d 100644 --- a/ReactCommon/yoga/yoga/internal/experiments.h +++ b/ReactCommon/yoga/yoga/internal/experiments.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/log.cpp b/ReactCommon/yoga/yoga/log.cpp index eb3da039c3d0..dbf7b4376e66 100644 --- a/ReactCommon/yoga/yoga/log.cpp +++ b/ReactCommon/yoga/yoga/log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/ReactCommon/yoga/yoga/log.h b/ReactCommon/yoga/yoga/log.h index ae33744c583c..1d270e82e40b 100644 --- a/ReactCommon/yoga/yoga/log.h +++ b/ReactCommon/yoga/yoga/log.h @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/Releases.md b/Releases.md deleted file mode 100644 index b76de5877ae9..000000000000 --- a/Releases.md +++ /dev/null @@ -1,214 +0,0 @@ -# Releases Guide - -This document serves as guide for release coordinators. You can find a list of releases and their release notes at https://github.com/facebook/react-native/releases - -## Release schedule - -React Native follows a monthly release train. Every month, a new branch created off `main` enters the Release Candidate phase, and the previous Release Candidate branch is released and considered stable. - - -| Version | RC release | Stable release | -| ------- | ------------------- | ---------------- | -| 0.38.0 | week of November 7 | November 21 | -| 0.39.0 | week of November 21 | December 2 | -| 0.40.0 | 1st of December | 1st of January | -| 0.41.0 | 1st of January | 1st of February | -| 0.42.0 | 1st of February | 1st of March | -| ... | ... | ... | -| 0.56.0 | 1st of June | 1st of July | -| 0.57.0 | 1st of July | 1st of August | -| 0.58.0 | 1st of August | 1st of September | -| ... | ... | ... | - -------------------- - -## How to cut a new release branch - -### Prerequisites - -The following are required for the local test suite to run: - -- macOS with [Android dev environment set up](https://github.com/facebook/react-native/blob/HEAD/ReactAndroid/README.md) -- [react-native-cli](https://www.npmjs.com/package/react-native-cli) installed globally (v0.2.0 or newer) - -### Step 1: Check everything works - -Before cutting a release branch, make sure [Circle](https://circleci.com/gh/facebook/react-native) CI system is green. - -Before executing the following script, make sure you have: - -- An Android emulator / Genymotion device running -- No packager running in any of the projects - -```bash -./scripts/test-manual-e2e.sh -``` - -This script bundles a react-native package locally and passes it to the `react-native` cli that creates a test project inside `/tmp` folder using that version. - -After `npm install` completes, the script prints a set of manual checks you have to do to ensure the release you are preparing is working as expected on both platforms. - -### Step 2: Cut a release branch and push to GitHub - -Run: - -```bash -git checkout -b -stable -# e.g. git checkout -b 0.57-stable - -./scripts/bump-oss-version.js -v -# e.g. ./scripts/bump-oss-version.js -v 0.57.0-rc.0 -# or ./scripts/bump-oss-version.js -v 0.58.0 -``` - -Circle CI will automatically run the tests and publish to npm with the version you have specified (e.g `0.57.0-rc.0`) and tag `next` meaning that this version will not be installed for users by default. - -### Step 3: Write the release notes - -Write the release notes, or post in [React Native Core Contributors](https://www.facebook.com/groups/reactnativeoss/) that the RC is ready to find a volunteer. You can also use [react-native-release-notes](https://github.com/knowbody/react-native-release-notes) to generate a draft of release notes. - -To go through all the commits that went into a release, one way is to use the GitHub compare view: - -``` -https://github.com/facebook/react-native/compare/0.49-stable...0.50-stable -``` - -**Note**: This only shows **250** commits, if there are more use git. - -When making a list of changes, ignore docs, showcase updates and minor typos. - -Sometimes commit messages might be really short / confusing - try rewording them where it makes sense. Below are few examples: - -- `Fix logging reported by RUN_JS_BUNDLE` -> `Fix systrace logging of RUN_JS_BUNDLE event` -- `Fixes hot code reloading issue` -> `Fix an edge case in hot module reloading` - -Open a pull request against CHANGELOG.md at https://github.com/react-native-community/react-native-releases and ask for feedback. - -Once everything is ready, create a new release at https://github.com/facebook/react-native/releases and link to the release notes. - -**Important**: For release candidate releases, make sure to check "This is a pre-release". - -### Step 4: Update `Breaking Changes` document - -Once the release is cut, go to the [page](https://github.com/facebook/react-native/wiki/Breaking-Changes) where all breaking changes are listed and create section for the release. Don't forget to move all breaking changes from `main` that are now part of the release. - -When finished and there are breaking changes, include them in the release notes you just created. - -### Step 5: Tweet about the RC release - -Tweet about it! Link to release notes and say "please report issues" and link to the main issue to track bugs you created. - -### Step 6: IMPORTANT: Track bug reports from the community during the following month, ping owners to get them fixed - -Now that the release is out in the open, go ahead and create a GitHub issue titled "[[0.XX-RC] Commits to cherry-pick](https://github.com/facebook/react-native/issues/14713)" where 0.XX matches the release version. Use this issue to track bugs that have been reported for this particular release, including commits that should be cherry-picked in cases that a fix cannot wait until the next release. - -------------------- - -## How to release an RC update (e.g. 0.57.0-rc.1, 0.57.0-rc.2) - -The release is now in the open, people are finding bugs, and fixes have landed in `main`. People have been nominating fixes in the issue you created above. Use your best judgment to decide which commits merit an RC update. It's a good idea to do a new RC release when several small and non-risky bugs have been fixed. Having a few RC releases can also help people bisect in case we cherry-pick a bad commit by mistake. - -**Only cherry-pick small and non-risky bug fixes**. **Don't pick new features into the release** as this greatly increases the risk of something breaking. The main point of the RC is to let people to use it for a month and fix the most serious bugs. - - -### Step 1: Check out the release branch - -Follow these steps to check out the release branch: - -```bash -git checkout -stable -# e.g. git checkout 0.57-stable - -git pull origin -stable -# e.g. git pull origin 0.57-stable -``` - -> If you don't have a local checkout of the release branch, you can run the following instead: -> `git checkout -b -stable -t origin/-stable` - -### Step 2: Cherry-pick commits - -Now, cherry-pick those commits: - -``` -git cherry-pick commitHash1 -``` - -### Step 3: IMPORTANT: Test everything again (Chrome debugging, Reload JS, Hot Module Reloading) - -Go through the same process as earlier to test the release: - -``` -./scripts/test-manual-e2e.sh -``` - -### Step 4: Bump the version number - -If everything worked, run the following to bump the version number: - -```bash -./scripts/bump-oss-version.js -v -# e.g. ./scripts/bump-oss-version.js -v 0.57.0-rc.1 -``` - -Again, Circle CI will automatically run the tests and publish to npm with the version you have specified (e.g `0.57.0-rc.1`). - -### Step 5: Update the release notes - -Go to https://github.com/facebook/react-native/releases and find the release notes for this release candidate. Edit them so that they now point to the tag that you've just created. We want single release notes per version. For example, if there is v0.57.0-rc and you just released v0.57.0-rc.1, the release notes should live on the v0.57.0-rc.1 tag at https://github.com/facebook/react-native/tags - -------------------- - -## How to do the final stable release (e.g. 0.57.0, 0.57.1) - -A stable release is promoted roughly a month after the release branch is cut (refer to the schedule above). The release may be delayed for several reasons, including major issues in the release candidate. Make sure that all bug fixes that have been nominated in your tracking issue have been addressed as needed. Avoid cherry-picking commits that have not been vetted in the release candidate phase at this point. - -Once you are sure that the release is solid, perform the following steps. Note that they're similar to the steps you may have followed earlier when patching the release candidate, but we're not cherry-picking any additional commits at this point. - -### Step 1: Check out the release branch - -```bash -git checkout -stable -# e.g. git checkout 0.57-stable - -git pull origin -stable -# e.g. git pull origin 0.57-stable -``` - -> If you don't have a local checkout of the release branch, you can run the following instead: -> `git checkout -b -stable -t origin/-stable` - -### Step 2: IMPORTANT: Test everything again (Chrome debugging, Reload JS, Hot Module Reloading) - -It's **important** to test everything again: you don't want to cut a release with a major blocking issue! - -``` -./scripts/test-manual-e2e.sh -``` - -### Step 3: Bump the version number - -If everything worked: - -```bash -./scripts/bump-oss-version.js -v -# e.g. ./scripts/bump-oss-version.js -v 0.57.0 -``` - -As with the release candidate, Circle CI will automatically run the tests and publish to npm with the version you have specified (e.g `0.57.0`). - -Go to [Circle CI](https://circleci.com/gh/facebook/react-native) and look for the build triggered by your push (e.g. _0.57-stable, [0.57.0] Bump version numbers_), then scroll down to the npm publish step to verify the package was published successfully (the build will be red if not). - -This will now become the latest release, and will be installed by users by default. At this point, the website will be updated and the docs for this release will be displayed by default. - -### Step 4: Update the release notes - -Go to https://github.com/facebook/react-native/releases and find the release notes for this release candidate. Edit them so that they now point to the tag that you've just created. We want single release notes per version. For example, if there is v0.57.0 and you just released v0.57.1, the release notes should live on the v0.57.1 tag at https://github.com/facebook/react-native/tags - -For non-RC releases: Uncheck the box "This is a pre-release" and publish the notes. - -### Supporting the release - -Sometimes things don't go well and a major issue is missed during the release candidate phase. If a fix cannot wait until the next release is cut, it may be necessary to cherry-pick it into the current stable release. Go back to your `[0.XX-RC] Commits to cherry-pick` issue and rename it to `[0.XX] Commits to cherry-pick`, then add a comment stating that any cherry-pick requests from then on will be applied to the stable release. - -**The same guidelines for RC cherry-picks apply here. If anything, the bar for cherry-picking into a stable release is higher.** Stick to commits that fix blocking issues. Examples may be RedBoxes on newly generated projects, broken upgrade flows with no workaround, or bugs affecting the compiling and/or building of projects. diff --git a/bots/code-analysis-bot.js b/bots/code-analysis-bot.js index 5da10c52175f..2b95ae2dd05f 100644 --- a/bots/code-analysis-bot.js +++ b/bots/code-analysis-bot.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -30,8 +30,7 @@ function push(arr, key, value) { const converterSummary = { eslint: '`eslint` found some issues. Run `yarn lint --fix` to automatically fix problems.', - flow: - '`flow` found some issues. Run `yarn flow check` to analyze your code and address any errors.', + flow: '`flow` found some issues. Run `yarn flow check` to analyze your code and address any errors.', shellcheck: '`shellcheck` found some issues. Run `yarn shellcheck` to analyze shell scripts.', 'google-java-format': @@ -51,20 +50,20 @@ const converterSummary = { * is an array of objects of the shape message and line. */ const converters = { - raw: function(output, input) { + raw: function (output, input) { for (let key in input) { - input[key].forEach(function(message) { + input[key].forEach(function (message) { push(output, key, message); }); } }, - 'google-java-format': function(output, input) { + 'google-java-format': function (output, input) { if (!input) { return; } - input.forEach(function(change) { + input.forEach(function (change) { push(output, change.file, { message: `\`google-java-format\` suggested changes: \`\`\`diff @@ -77,12 +76,12 @@ ${change.description} }); }, - flow: function(output, input) { + flow: function (output, input) { if (!input || !input.errors) { return; } - input.errors.forEach(function(error) { + input.errors.forEach(function (error) { push(output, error.message[0].path, { message: error.message.map(message => message.descr).join(' '), line: error.message[0].line, @@ -91,13 +90,13 @@ ${change.description} }); }, - eslint: function(output, input) { + eslint: function (output, input) { if (!input) { return; } - input.forEach(function(file) { - file.messages.forEach(function(message) { + input.forEach(function (file) { + file.messages.forEach(function (message) { push(output, file.filePath, { message: message.ruleId + ': ' + message.message, line: message.line, @@ -107,12 +106,12 @@ ${change.description} }); }, - shellcheck: function(output, input) { + shellcheck: function (output, input) { if (!input) { return; } - input.forEach(function(report) { + input.forEach(function (report) { push(output, report.file, { message: '**[SC' + @@ -231,6 +230,7 @@ async function main(messages, owner, repo, pull_number) { const {Octokit} = require('@octokit/rest'); const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN, + userAgent: 'react-native-code-analysis-bot', }); const opts = { @@ -285,10 +285,10 @@ async function main(messages, owner, repo, pull_number) { let content = ''; process.stdin.resume(); -process.stdin.on('data', function(buf) { +process.stdin.on('data', function (buf) { content += buf.toString(); }); -process.stdin.on('end', function() { +process.stdin.on('end', function () { let messages = {}; // Since we send a few http requests to setup the process, we don't want diff --git a/bots/dangerfile.js b/bots/dangerfile.js index 428652b80208..30545cbd078b 100644 --- a/bots/dangerfile.js +++ b/bots/dangerfile.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,13 +12,18 @@ const {danger, fail, message, warn} = require('danger'); const includes = require('lodash.includes'); +const isFromPhabricator = + danger.github.pr.body && + danger.github.pr.body.toLowerCase().includes('differential revision:'); + // Provides advice if a summary section is missing, or body is too short const includesSummary = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('## summary'); if (!danger.github.pr.body || danger.github.pr.body.length < 50) { fail(':grey_question: This pull request needs a description.'); -} else if (!includesSummary) { +} else if (!includesSummary && !isFromPhabricator) { + // PRs from Phabricator always includes the Summary by default. const title = ':clipboard: Missing Summary'; const idea = 'Can you add a Summary? ' + @@ -41,7 +46,8 @@ if (packageChanged) { const includesTestPlan = danger.github.pr.body && danger.github.pr.body.toLowerCase().includes('## test plan'); -if (!includesTestPlan) { +if (!includesTestPlan && !isFromPhabricator) { + // PRs from Phabricator never exports the Test Plan so let's disable this check. const title = ':clipboard: Missing Test Plan'; const idea = 'Can you add a Test Plan? ' + @@ -51,12 +57,15 @@ if (!includesTestPlan) { } // Regex looks for given categories, types, a file/framework/component, and a message - broken into 4 capture groups -const changelogRegex = /\[\s?(ANDROID|GENERAL|IOS|JS|JAVASCRIPT|INTERNAL)\s?\]\s?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?-?\s*?(.*)/gi; +const changelogRegex = + /\[\s?(ANDROID|GENERAL|IOS|JS|JAVASCRIPT|INTERNAL)\s?\]\s?\[\s?(ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY)\s?\]\s*?-?\s*?(.*)/gi; const internalChangelogRegex = /\[\s?(INTERNAL)\s?\].*/gi; const includesChangelog = danger.github.pr.body && (danger.github.pr.body.toLowerCase().includes('## changelog') || - danger.github.pr.body.toLowerCase().includes('release notes')); + danger.github.pr.body.toLowerCase().includes('release notes') || + // PR exports from Phabricator have a `Changelog:` entry for the changelog. + danger.github.pr.body.toLowerCase().includes('changelog:')); const correctlyFormattedChangelog = changelogRegex.test(danger.github.pr.body); const containsInternalChangelog = internalChangelogRegex.test( danger.github.pr.body, @@ -80,16 +89,26 @@ if (!includesChangelog) { // Warns if the PR is opened against stable, as commits need to be cherry picked and tagged by a release maintainer. // Fails if the PR is opened against anything other than `main` or `-stable`. -const isMergeRefMaster = danger.github.pr.base.ref === 'main'; +const isMergeRefMain = danger.github.pr.base.ref === 'main'; const isMergeRefStable = danger.github.pr.base.ref.indexOf('-stable') !== -1; -if (!isMergeRefMaster && isMergeRefStable) { - const title = ':grey_question: Base Branch'; - const idea = - 'The base branch for this PR is something other than `main`. Are you sure you want to merge these changes into a stable release? If you are interested in backporting updates to an older release, the suggested approach is to land those changes on `main` first and then cherry-pick the commits into the branch for that release. The [Releases Guide](https://github.com/facebook/react-native/blob/HEAD/Releases.md) has more information.'; - warn(`${title} - ${idea}`); -} else if (!isMergeRefMaster && !isMergeRefStable) { +if (!isMergeRefMain && !isMergeRefStable) { const title = ':exclamation: Base Branch'; const idea = - 'The base branch for this PR is something other than `main`. [Are you sure you want to target something other than the `main` branch?](https://reactnative.dev/docs/contributing.html#pull-requests)'; + 'The base branch for this PR is something other than `main` or a `-stable` branch. [Are you sure you want to target something other than the `main` branch?](https://reactnative.dev/docs/contributing#pull-requests)'; fail(`${title} - ${idea}`); } + +// If the PR is opened against stable should add `Pick Request` label +if (isMergeRefStable) { + const {owner, repo, number: issueNumber} = danger.github.thisPR; + + danger.github.api.request( + 'POST /repos/{owner}/{repo}/issues/{issueNumber}/labels', + { + owner, + repo, + issueNumber, + labels: ['Pick Request'], + }, + ); +} diff --git a/bots/datastore.js b/bots/datastore.js index ca04ca66d408..962b49c09a21 100644 --- a/bots/datastore.js +++ b/bots/datastore.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -92,12 +92,14 @@ function getBinarySizesCollection(db) { * @param {firebase.firestore.CollectionReference} collection * @param {string} sha The Git SHA used to identify the entry * @param {firebase.firestore.UpdateData} data The data to be inserted/updated + * @param {string} branch The Git branch where this data was computed for * @returns {Promise} */ -function createOrUpdateDocument(collectionRef, sha, data) { +function createOrUpdateDocument(collectionRef, sha, data, branch) { const stampedData = { ...data, timestamp: firestore.Timestamp.now(), + branch, }; const docRef = firestore.doc(collectionRef, sha); return firestore.updateDoc(docRef, stampedData).catch(async error => { @@ -115,14 +117,16 @@ function createOrUpdateDocument(collectionRef, sha, data) { * Returns the latest document in collection. * * @param {firebase.firestore.CollectionReference} collection + * @param {string} branch The Git branch for the data * @returns {Promise} */ -async function getLatestDocument(collectionRef) { +async function getLatestDocument(collectionRef, branch) { try { const querySnapshot = await firestore.getDocs( firestore.query( collectionRef, firestore.orderBy('timestamp', 'desc'), + firestore.where('branch', '==', branch), firestore.limit(1), ), ); diff --git a/bots/make-comment.js b/bots/make-comment.js index 0ab9b4f2b591..5d117867ce0f 100644 --- a/bots/make-comment.js +++ b/bots/make-comment.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,6 +36,7 @@ async function updateComment(octokit, issueParams, body, replacePattern) { const authedUserId = authenticatedUser.data.id; const pattern = new RegExp(replacePattern, 'g'); const comment = comments.data.find( + // eslint-disable-next-line no-shadow ({user, body}) => user.id === authedUserId && pattern.test(body), ); if (!comment) { @@ -52,20 +53,58 @@ async function updateComment(octokit, issueParams, body, replacePattern) { /** * Creates or updates a comment with specified pattern. + * @param {{ auth: string; owner: string; repo: string; issue_number: string; }} params * @param {string} body Comment body * @param {string} replacePattern Pattern for finding the comment to update */ -async function createOrUpdateComment(body, replacePattern) { +async function createOrUpdateComment( + {auth, ...issueParams}, + body, + replacePattern, +) { + if (!body) { + return; + } + + const {Octokit} = require('@octokit/rest'); + const octokit = new Octokit({auth}); + + if (await updateComment(octokit, issueParams, body, replacePattern)) { + return; + } + + // We found no comments to replace, so we'll create a new one. + + octokit.issues.createComment({ + ...issueParams, + body, + }); +} + +/** + * Validates that required environment variables are set. + * @returns {boolean} `true` if everything is in order; `false` otherwise. + */ +function validateEnvironment() { const { GITHUB_TOKEN, GITHUB_OWNER, GITHUB_REPO, GITHUB_PR_NUMBER, + GITHUB_REF, } = process.env; - if (!GITHUB_TOKEN || !GITHUB_OWNER || !GITHUB_REPO || !GITHUB_PR_NUMBER) { + + // We need the following variables to post a comment on a PR + if ( + !GITHUB_TOKEN || + !GITHUB_OWNER || + !GITHUB_REPO || + !GITHUB_PR_NUMBER || + !GITHUB_REF + ) { if (!GITHUB_TOKEN) { console.error( - 'Missing GITHUB_TOKEN. Example: 5fd88b964fa214c4be2b144dc5af5d486a2f8c1e. PR feedback cannot be provided on GitHub without a valid token.', + 'Missing GITHUB_TOKEN. Example: ghp_5fd88b964fa214c4be2b144dc5af5d486a2. PR feedback cannot be provided on GitHub without a valid token.', ); } if (!GITHUB_OWNER) { @@ -79,34 +118,22 @@ async function createOrUpdateComment(body, replacePattern) { 'Missing GITHUB_PR_NUMBER. Example: 4687. PR feedback cannot be provided on GitHub without a valid pull request number.', ); } - process.exit(1); - } - - if (!body) { - return; - } - - const {Octokit} = require('@octokit/rest'); - const octokit = new Octokit({auth: GITHUB_TOKEN}); - - const issueParams = { - owner: GITHUB_OWNER, - repo: GITHUB_REPO, - issue_number: GITHUB_PR_NUMBER, - }; + if (!GITHUB_REF) { + console.error("Missing GITHUB_REF. This should've been set by the CI."); + } - if (await updateComment(octokit, issueParams, body, replacePattern)) { - return; + return false; } + console.log(' GITHUB_TOKEN=REDACTED'); + console.log(` GITHUB_OWNER=${GITHUB_OWNER}`); + console.log(` GITHUB_REPO=${GITHUB_REPO}`); + console.log(` GITHUB_PR_NUMBER=${GITHUB_PR_NUMBER}`); + console.log(` GITHUB_REF=${GITHUB_REF}`); - // We found no comments to replace, so we'll create a new one. - - octokit.issues.createComment({ - ...issueParams, - body, - }); + return true; } module.exports = { createOrUpdateComment, + validateEnvironment, }; diff --git a/bots/package.json b/bots/package.json index bd720cc62ef7..8be650b4bdf5 100644 --- a/bots/package.json +++ b/bots/package.json @@ -9,7 +9,7 @@ "minimatch": "^3.0.4" }, "dependencies": { - "@octokit/rest": "^16.43.0", + "@octokit/rest": "^18.12.0", "firebase": "^9.0.2" } } diff --git a/bots/post-artifacts-link.js b/bots/post-artifacts-link.js index f658d2b3cee2..314f782b1a2b 100644 --- a/bots/post-artifacts-link.js +++ b/bots/post-artifacts-link.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,27 +9,27 @@ 'use strict'; -const {GITHUB_TOKEN, CIRCLE_BUILD_URL, GITHUB_SHA} = process.env; -if (!GITHUB_TOKEN || !CIRCLE_BUILD_URL) { - if (!GITHUB_TOKEN) { - console.error("Missing GITHUB_TOKEN. This should've been set by the CI."); - } - if (!CIRCLE_BUILD_URL) { - console.error( - "Missing CIRCLE_BUILD_URL. This should've been set by the CI.", - ); - } - process.exit(1); -} +const { + CIRCLE_BUILD_URL, + GITHUB_OWNER, + GITHUB_PR_NUMBER, + GITHUB_REPO, + GITHUB_SHA, + GITHUB_TOKEN, +} = process.env; -const {createOrUpdateComment} = require('./make-comment'); +const { + createOrUpdateComment, + validateEnvironment: validateEnvironmentForMakeComment, +} = require('./make-comment'); /** * Creates or updates a comment with specified pattern. + * @param {{ auth: string; owner: string; repo: string; issue_number: string; }} params * @param {string} buildURL link to circleCI build * @param {string} commitSha github sha of PR */ -function postArtifactLink(buildUrl, commitSha) { +function postArtifactLink(params, buildUrl, commitSha) { // build url link is redirected by CircleCI so appending `/artifacts` doesn't work const artifactLink = buildUrl; const comment = [ @@ -38,11 +38,48 @@ function postArtifactLink(buildUrl, commitSha) { } is ready.`, `To use, download tarball from "Artifacts" tab in [this CircleCI job](${artifactLink}) then run \`yarn add \` in your React Native project.`, ].join('\n'); - createOrUpdateComment(comment); + createOrUpdateComment(params, comment); +} + +/** + * Validates that required environment variables are set. + * @returns {boolean} `true` if everything is in order; `false` otherwise. + */ +function validateEnvironment() { + if ( + !validateEnvironmentForMakeComment() || + !CIRCLE_BUILD_URL || + !GITHUB_SHA + ) { + if (!GITHUB_SHA) { + console.error("Missing GITHUB_SHA. This should've been set by the CI."); + } + if (!CIRCLE_BUILD_URL) { + console.error( + "Missing CIRCLE_BUILD_URL. This should've been set by the CI.", + ); + } + return false; + } + + console.log(` GITHUB_SHA=${GITHUB_SHA}`); + console.log(` CIRCLE_BUILD_URL=${CIRCLE_BUILD_URL}`); + + return true; +} + +if (!validateEnvironment()) { + process.exit(1); } try { - postArtifactLink(CIRCLE_BUILD_URL, GITHUB_SHA); + const params = { + auth: GITHUB_TOKEN, + owner: GITHUB_OWNER, + repo: GITHUB_REPO, + issue_number: GITHUB_PR_NUMBER, + }; + postArtifactLink(params, CIRCLE_BUILD_URL, GITHUB_SHA); } catch (error) { console.error(error); process.exitCode = 1; diff --git a/bots/report-bundle-size.js b/bots/report-bundle-size.js index 5d422483909e..35d1f468c423 100644 --- a/bots/report-bundle-size.js +++ b/bots/report-bundle-size.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,23 +9,24 @@ 'use strict'; -const {GITHUB_REF, GITHUB_SHA} = process.env; -if (!GITHUB_REF || !GITHUB_SHA) { - if (!GITHUB_REF) { - console.error("Missing GITHUB_REF. This should've been set by the CI."); - } - if (!GITHUB_SHA) { - console.error("Missing GITHUB_SHA. This should've been set by the CI."); - } - process.exit(1); -} +const { + GITHUB_TOKEN, + GITHUB_OWNER, + GITHUB_REPO, + GITHUB_PR_NUMBER, + GITHUB_REF, + GITHUB_SHA, +} = process.env; const fs = require('fs'); const datastore = require('./datastore'); -const {createOrUpdateComment} = require('./make-comment'); +const { + createOrUpdateComment, + validateEnvironment: validateEnvironmentForMakeComment, +} = require('./make-comment'); /** - * Generates and submits a comment. If this is run on main branch, data is + * Generates and submits a comment. If this is run on the main or release branch, data is * committed to the store instead. * @param {{ 'android-hermes-arm64-v8a'?: number; @@ -47,7 +48,7 @@ async function reportSizeStats(stats, replacePattern) { ); const collection = datastore.getBinarySizesCollection(store); - if (GITHUB_REF === 'main') { + if (!isPullRequest(GITHUB_REF)) { // Ensure we only store numbers greater than zero. const validatedStats = Object.keys(stats).reduce((validated, key) => { const value = stats[key]; @@ -58,63 +59,92 @@ async function reportSizeStats(stats, replacePattern) { validated[key] = value; return validated; }, {}); + if (Object.keys(validatedStats).length > 0) { + // Print out the new stats + const document = + (await datastore.getLatestDocument(collection, GITHUB_REF)) || {}; + const formattedStats = formatBundleStats(document, validatedStats); + console.log(formattedStats); + await datastore.createOrUpdateDocument( collection, GITHUB_SHA, validatedStats, + GITHUB_REF, ); } } else { - const document = await datastore.getLatestDocument(collection); - - const diffFormatter = new Intl.NumberFormat('en', {signDisplay: 'always'}); - const sizeFormatter = new Intl.NumberFormat('en', {}); - - // | Platform | Engine | Arch | Size (bytes) | Diff | - // |:---------|:-------|:------------|-------------:|-----:| - // | android | hermes | arm64-v8a | 9437184 | ±0 | - // | android | hermes | armeabi-v7a | 9015296 | ±0 | - // | android | hermes | x86 | 9498624 | ±0 | - // | android | hermes | x86_64 | 9965568 | ±0 | - // | android | jsc | arm64-v8a | 9236480 | ±0 | - // | android | jsc | armeabi-v7a | 8814592 | ±0 | - // | android | jsc | x86 | 9297920 | ±0 | - // | android | jsc | x86_64 | 9764864 | ±0 | - // | android | jsc | x86_64 | 9764864 | ±0 | - // | ios | - | universal | 10715136 | ±0 | - const comment = [ - '| Platform | Engine | Arch | Size (bytes) | Diff |', - '|:---------|:-------|:-----|-------------:|-----:|', - ...Object.keys(stats).map(identifier => { - const [size, diff] = (() => { - const statSize = stats[identifier]; - if (!statSize) { - return ['n/a', '--']; - } else if (!(identifier in document)) { - return [statSize, 'n/a']; - } else { - return [ - sizeFormatter.format(statSize), - diffFormatter.format(statSize - document[identifier]), - ]; - } - })(); - - const [platform, engineOrArch, ...archParts] = identifier.split('-'); - const arch = archParts.join('-') || engineOrArch; - const engine = arch === engineOrArch ? '-' : engineOrArch; // e.g. 'ios-universal' - return `| ${platform} | ${engine} | ${arch} | ${size} | ${diff} |`; - }), - '', - `Base commit: ${document.commit}`, - ].join('\n'); - createOrUpdateComment(comment, replacePattern); + const params = { + auth: GITHUB_TOKEN, + owner: GITHUB_OWNER, + repo: GITHUB_REPO, + issue_number: GITHUB_PR_NUMBER, + }; + + // For PRs, always compare vs main. + const document = + (await datastore.getLatestDocument(collection, 'main')) || {}; + const comment = formatBundleStats(document, stats); + createOrUpdateComment(params, comment, replacePattern); } await datastore.terminateStore(store); } +/** + * Format the new bundle stats as compared to the latest stored entry. + * @param {firebase.firestore.DocumentData} document the latest entry to compare against + * @param {firebase.firestore.UpdateData} stats The stats to be formatted + * @returns {string} + */ +function formatBundleStats(document, stats) { + const diffFormatter = new Intl.NumberFormat('en', {signDisplay: 'always'}); + const sizeFormatter = new Intl.NumberFormat('en', {}); + + // | Platform | Engine | Arch | Size (bytes) | Diff | + // |:---------|:-------|:------------|-------------:|-----:| + // | android | hermes | arm64-v8a | 9437184 | ±0 | + // | android | hermes | armeabi-v7a | 9015296 | ±0 | + // | android | hermes | x86 | 9498624 | ±0 | + // | android | hermes | x86_64 | 9965568 | ±0 | + // | android | jsc | arm64-v8a | 9236480 | ±0 | + // | android | jsc | armeabi-v7a | 8814592 | ±0 | + // | android | jsc | x86 | 9297920 | ±0 | + // | android | jsc | x86_64 | 9764864 | ±0 | + // | android | jsc | x86_64 | 9764864 | ±0 | + // | ios | - | universal | 10715136 | ±0 | + const formatted = [ + '| Platform | Engine | Arch | Size (bytes) | Diff |', + '|:---------|:-------|:-----|-------------:|-----:|', + ...Object.keys(stats).map(identifier => { + const [size, diff] = (() => { + const statSize = stats[identifier]; + if (!statSize) { + return ['n/a', '--']; + } else if (!(identifier in document)) { + return [statSize, 'n/a']; + } else { + return [ + sizeFormatter.format(statSize), + diffFormatter.format(statSize - document[identifier]), + ]; + } + })(); + + const [platform, engineOrArch, ...archParts] = identifier.split('-'); + const arch = archParts.join('-') || engineOrArch; + const engine = arch === engineOrArch ? '-' : engineOrArch; // e.g. 'ios-universal' + return `| ${platform} | ${engine} | ${arch} | ${size} | ${diff} |`; + }), + '', + `Base commit: ${document.commit || ''}`, + `Branch: ${document.branch || ''}`, + ].join('\n'); + + return formatted; +} + /** * Returns the size of the file at specified path in bytes. * @param {fs.PathLike} path @@ -140,6 +170,38 @@ function android_getApkSize(engine, arch) { ); } +/** + * Returns whether the specified ref points to a pull request. + */ +function isPullRequest(ref) { + return ref !== 'main' && !/^\d+\.\d+-stable$/.test(ref); +} + +/** + * Validates that required environment variables are set. + * @returns {boolean} `true` if everything is in order; `false` otherwise. + */ +function validateEnvironment() { + if (!GITHUB_REF) { + console.error("Missing GITHUB_REF. This should've been set by the CI."); + return false; + } + + if (isPullRequest(GITHUB_REF)) { + if (!validateEnvironmentForMakeComment()) { + return false; + } + } else if (!GITHUB_SHA) { + // To update the data store, we need the SHA associated with the build + console.error("Missing GITHUB_SHA. This should've been set by the CI."); + return false; + } + + console.log(` GITHUB_SHA=${GITHUB_SHA}`); + + return true; +} + /** * Reports app bundle size. * @param {string} target @@ -185,6 +247,10 @@ async function report(target) { } } +if (!validateEnvironment()) { + process.exit(1); +} + const {[2]: target} = process.argv; report(target).catch(error => { console.error(error); diff --git a/bots/yarn.lock b/bots/yarn.lock index 6a3a5ad20aaa..cfde2dcbc8d4 100644 --- a/bots/yarn.lock +++ b/bots/yarn.lock @@ -4,7 +4,7 @@ "@babel/polyfill@^7.2.5": version "7.2.5" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.2.5.tgz#6c54b964f71ad27edddc567d065e57e87ed7fa7d" + resolved "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.2.5.tgz" integrity sha512-8Y/t3MWThtMLYr0YNC/Q76tqN1w30+b0uQMeFUYauG2UGTR19zyUtFrAzT23zNtBxPp+LbE5E/nwV/q/r3y6ug== dependencies: core-js "^2.5.7" @@ -12,7 +12,7 @@ "@firebase/analytics-compat@0.1.1": version "0.1.1" - resolved "https://registry.yarnpkg.com/@firebase/analytics-compat/-/analytics-compat-0.1.1.tgz#77a3e5d28f15df303c3836db4740a43955fcfcac" + resolved "https://registry.npmjs.org/@firebase/analytics-compat/-/analytics-compat-0.1.1.tgz" integrity sha512-pMTrA8cxMXFRv7bwZEXXz0NCepnyH2Jay/32RZ7xAufij2VJhF5S1BtfCO0wuri3FB94rlM8SmSEbwxxHcAtVg== dependencies: "@firebase/analytics" "0.7.0" @@ -23,12 +23,12 @@ "@firebase/analytics-types@0.7.0": version "0.7.0" - resolved "https://registry.yarnpkg.com/@firebase/analytics-types/-/analytics-types-0.7.0.tgz#91960e7c87ce8bf18cf8dd9e55ccbf5dc3989b5d" + resolved "https://registry.npmjs.org/@firebase/analytics-types/-/analytics-types-0.7.0.tgz" integrity sha512-DNE2Waiwy5+zZnCfintkDtBfaW6MjIG883474v6Z0K1XZIvl76cLND4iv0YUb48leyF+PJK1KO2XrgHb/KpmhQ== "@firebase/analytics@0.7.0": version "0.7.0" - resolved "https://registry.yarnpkg.com/@firebase/analytics/-/analytics-0.7.0.tgz#7f4450936a2cac3227cc6439130c09b9a0a7d83e" + resolved "https://registry.npmjs.org/@firebase/analytics/-/analytics-0.7.0.tgz" integrity sha512-YEPyeW6CV8xbIvWaJMvfRdWUPKe/xchJ1bjV6GpLfkYRX+ZE1/YSNU14pX292M4bZ6Qg+bbu2DuWp8fEpa/YQg== dependencies: "@firebase/component" "0.5.6" @@ -39,7 +39,7 @@ "@firebase/app-check-compat@0.1.1": version "0.1.1" - resolved "https://registry.yarnpkg.com/@firebase/app-check-compat/-/app-check-compat-0.1.1.tgz#84c7ef29bb683fd3dea66a66f82b799474c904ee" + resolved "https://registry.npmjs.org/@firebase/app-check-compat/-/app-check-compat-0.1.1.tgz" integrity sha512-XTV5Ns0Lpwn5GgXV5T0soOkoOGACaw9xiNvAXcISQYFBIse0k7fKo8V5J9VUS1ppzGpyTRCg0m9efz4CNrwPyQ== dependencies: "@firebase/app-check" "0.4.0" @@ -50,12 +50,12 @@ "@firebase/app-check-interop-types@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/app-check-interop-types/-/app-check-interop-types-0.1.0.tgz#83afd9d41f99166c2bdb2d824e5032e9edd8fe53" + resolved "https://registry.npmjs.org/@firebase/app-check-interop-types/-/app-check-interop-types-0.1.0.tgz" integrity sha512-uZfn9s4uuRsaX5Lwx+gFP3B6YsyOKUE+Rqa6z9ojT4VSRAsZFko9FRn6OxQUA1z5t5d08fY4pf+/+Dkd5wbdbA== "@firebase/app-check@0.4.0": version "0.4.0" - resolved "https://registry.yarnpkg.com/@firebase/app-check/-/app-check-0.4.0.tgz#a048fc396b2a97ef8eba77fe909efbff07a5c75c" + resolved "https://registry.npmjs.org/@firebase/app-check/-/app-check-0.4.0.tgz" integrity sha512-KQ/k8cukzZbH/LC9Iu5/Dbhr7w6byu8bYjfCA38B6v8aISgASYfP/nirxRD+hSuDoxXtAnPGEuv+v0YU3D1R2w== dependencies: "@firebase/component" "0.5.6" @@ -65,7 +65,7 @@ "@firebase/app-compat@0.1.1": version "0.1.1" - resolved "https://registry.yarnpkg.com/@firebase/app-compat/-/app-compat-0.1.1.tgz#47d5f5ac350f59ea4b721f17e01b1e46a1a3154a" + resolved "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.1.1.tgz" integrity sha512-AoUO7PnQlDPyMAvAE972kBhrwXRZRLGdHM8obyIeTzPNqIiEoULD4Rdq5TBB4UmV2HYAlYdrS+dk4nuWx67w6A== dependencies: "@firebase/app" "0.7.0" @@ -76,12 +76,12 @@ "@firebase/app-types@0.7.0": version "0.7.0" - resolved "https://registry.yarnpkg.com/@firebase/app-types/-/app-types-0.7.0.tgz#c9e16d1b8bed1a991840b8d2a725fb58d0b5899f" + resolved "https://registry.npmjs.org/@firebase/app-types/-/app-types-0.7.0.tgz" integrity sha512-6fbHQwDv2jp/v6bXhBw2eSRbNBpxHcd1NBF864UksSMVIqIyri9qpJB1Mn6sGZE+bnDsSQBC5j2TbMxYsJQkQg== "@firebase/app@0.7.0": version "0.7.0" - resolved "https://registry.yarnpkg.com/@firebase/app/-/app-0.7.0.tgz#989e9f354951de2a8ac806f6e3fa0afd9f80b470" + resolved "https://registry.npmjs.org/@firebase/app/-/app-0.7.0.tgz" integrity sha512-l4Pd69re6JyjumQrl719dnY5JSKROSYda/0N2wzOhSzqg8DsZOIErr8+xj6QAE6BtNsoIEk7ma9WMS/2r02MhA== dependencies: "@firebase/component" "0.5.6" @@ -91,7 +91,7 @@ "@firebase/auth-compat@0.1.2": version "0.1.2" - resolved "https://registry.yarnpkg.com/@firebase/auth-compat/-/auth-compat-0.1.2.tgz#a971cb7859eb4d45c233043bea102993376d9fca" + resolved "https://registry.npmjs.org/@firebase/auth-compat/-/auth-compat-0.1.2.tgz" integrity sha512-0eqWSV4XoyOltT4HVJUzh8hBFNO5f78ZGDplRQImQ97/6wR45x6Q/9R19KTWOd109+3Axw6Orfq2cSNY0opgEA== dependencies: "@firebase/auth" "0.17.2" @@ -104,17 +104,17 @@ "@firebase/auth-interop-types@0.1.6": version "0.1.6" - resolved "https://registry.yarnpkg.com/@firebase/auth-interop-types/-/auth-interop-types-0.1.6.tgz#5ce13fc1c527ad36f1bb1322c4492680a6cf4964" + resolved "https://registry.npmjs.org/@firebase/auth-interop-types/-/auth-interop-types-0.1.6.tgz" integrity sha512-etIi92fW3CctsmR9e3sYM3Uqnoq861M0Id9mdOPF6PWIg38BXL5k4upCNBggGUpLIS0H1grMOvy/wn1xymwe2g== "@firebase/auth-types@0.11.0": version "0.11.0" - resolved "https://registry.yarnpkg.com/@firebase/auth-types/-/auth-types-0.11.0.tgz#b9c73c60ca07945b3bbd7a097633e5f78fa9e886" + resolved "https://registry.npmjs.org/@firebase/auth-types/-/auth-types-0.11.0.tgz" integrity sha512-q7Bt6cx+ySj9elQHTsKulwk3+qDezhzRBFC9zlQ1BjgMueUOnGMcvqmU0zuKlQ4RhLSH7MNAdBV2znVaoN3Vxw== "@firebase/auth@0.17.2": version "0.17.2" - resolved "https://registry.yarnpkg.com/@firebase/auth/-/auth-0.17.2.tgz#54ad76cfdc2f6d1201fb780365cf7d362586f3c6" + resolved "https://registry.npmjs.org/@firebase/auth/-/auth-0.17.2.tgz" integrity sha512-t1iHB5Eg7vAbyOEzMMarsyJNGiO2xP8Zag0hLRVXWVaWymXZnyVKp62sXqyonvz4eVT8+iGBjDySB9zKIb5Pqg== dependencies: "@firebase/component" "0.5.6" @@ -126,7 +126,7 @@ "@firebase/component@0.5.6": version "0.5.6" - resolved "https://registry.yarnpkg.com/@firebase/component/-/component-0.5.6.tgz#6b7c7aff69866e0925721543a2ef5f47b0f97cbe" + resolved "https://registry.npmjs.org/@firebase/component/-/component-0.5.6.tgz" integrity sha512-GyQJ+2lrhsDqeGgd1VdS7W+Y6gNYyI0B51ovNTxeZVG/W8I7t9MwEiCWsCvfm5wQgfsKp9dkzOcJrL5k8oVO/Q== dependencies: "@firebase/util" "1.3.0" @@ -134,7 +134,7 @@ "@firebase/database-compat@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/database-compat/-/database-compat-0.1.0.tgz#f02abaa9f493fd14aaae6e2b34262bafc5d033c7" + resolved "https://registry.npmjs.org/@firebase/database-compat/-/database-compat-0.1.0.tgz" integrity sha512-jLN0JMYnYijg8f3QFtSuPGNuKAt3yYVRsHHlR8sADgx8MptByRRwVmMOk7QPc/DY7qscZIJow3hXFwvbeApFLA== dependencies: "@firebase/component" "0.5.6" @@ -146,7 +146,7 @@ "@firebase/database-types@0.9.0": version "0.9.0" - resolved "https://registry.yarnpkg.com/@firebase/database-types/-/database-types-0.9.0.tgz#dad3db745531f40b60f7726a76b2bf6bbf6c6471" + resolved "https://registry.npmjs.org/@firebase/database-types/-/database-types-0.9.0.tgz" integrity sha512-x2TeTVnMZGPvT3y4Nayio4WprQA/zGwqMrPMQwSdF+PFnaFJAhA/eLgUB6cmWFzFYO9VvmuRkFzDzo6ezTo1Zw== dependencies: "@firebase/app-types" "0.7.0" @@ -154,7 +154,7 @@ "@firebase/database@0.12.0": version "0.12.0" - resolved "https://registry.yarnpkg.com/@firebase/database/-/database-0.12.0.tgz#2aa33138128cfcaf74388efe13e0eda10825d564" + resolved "https://registry.npmjs.org/@firebase/database/-/database-0.12.0.tgz" integrity sha512-/gl6z6fAxAAFAdDllzidzweGpuXJu0b9AusSLrdW4LpP6KCuxJbhonMJuSGpHLzAHzx6Q9uitbvqHqBb17sttQ== dependencies: "@firebase/auth-interop-types" "0.1.6" @@ -166,7 +166,7 @@ "@firebase/firestore-compat@0.1.2": version "0.1.2" - resolved "https://registry.yarnpkg.com/@firebase/firestore-compat/-/firestore-compat-0.1.2.tgz#af9e28735376ee04c147ea3ac11b592b3f7a68ac" + resolved "https://registry.npmjs.org/@firebase/firestore-compat/-/firestore-compat-0.1.2.tgz" integrity sha512-xtjj2qOBN0+S5KlXmWa5UozGmYJ1OAGBNT0qkCSvzQitHED5/B2fNwKnpy7Em+Zu3Yc3r/eM94OGx93USFXifg== dependencies: "@firebase/component" "0.5.6" @@ -177,12 +177,12 @@ "@firebase/firestore-types@2.5.0": version "2.5.0" - resolved "https://registry.yarnpkg.com/@firebase/firestore-types/-/firestore-types-2.5.0.tgz#16fca40b6980fdb000de86042d7a96635f2bcdd7" + resolved "https://registry.npmjs.org/@firebase/firestore-types/-/firestore-types-2.5.0.tgz" integrity sha512-I6c2m1zUhZ5SH0cWPmINabDyH5w0PPFHk2UHsjBpKdZllzJZ2TwTkXbDtpHUZNmnc/zAa0WNMNMvcvbb/xJLKA== "@firebase/firestore@3.0.2": version "3.0.2" - resolved "https://registry.yarnpkg.com/@firebase/firestore/-/firestore-3.0.2.tgz#594130bb125803b6e28611075c2f396f59ba8186" + resolved "https://registry.npmjs.org/@firebase/firestore/-/firestore-3.0.2.tgz" integrity sha512-AWh1pugDifwCXHaQalZHp+Hr/3o+cxYvlbgQrPB35bh1A3do4I1xim/8Pba7gtpTzlClDryd5pK/XbK0TC/2kg== dependencies: "@firebase/component" "0.5.6" @@ -196,7 +196,7 @@ "@firebase/functions-compat@0.1.2": version "0.1.2" - resolved "https://registry.yarnpkg.com/@firebase/functions-compat/-/functions-compat-0.1.2.tgz#557461ed4f2928747461c6b2d246ac328aea3248" + resolved "https://registry.npmjs.org/@firebase/functions-compat/-/functions-compat-0.1.2.tgz" integrity sha512-eisJazUrqOL/pAZJPqamYiaAyV3ch6GQMx8Sso792tvRr8SFsNCFbN9eVun0U0ubWAON5qdLoruoc6npXg6FIg== dependencies: "@firebase/component" "0.5.6" @@ -207,12 +207,12 @@ "@firebase/functions-types@0.5.0": version "0.5.0" - resolved "https://registry.yarnpkg.com/@firebase/functions-types/-/functions-types-0.5.0.tgz#b50ba95ccce9e96f7cda453228ffe1684645625b" + resolved "https://registry.npmjs.org/@firebase/functions-types/-/functions-types-0.5.0.tgz" integrity sha512-qza0M5EwX+Ocrl1cYI14zoipUX4gI/Shwqv0C1nB864INAD42Dgv4v94BCyxGHBg2kzlWy8PNafdP7zPO8aJQA== "@firebase/functions@0.7.1": version "0.7.1" - resolved "https://registry.yarnpkg.com/@firebase/functions/-/functions-0.7.1.tgz#aa95aaed34649d0656d50df0ed21802f117cca88" + resolved "https://registry.npmjs.org/@firebase/functions/-/functions-0.7.1.tgz" integrity sha512-F6XZVVBpqupCX7/YXpdzyXKYCeLVmHO/jxAKbN9I4B+c8doDqVtGkO23DPzf4ppzR4FuXDiKEEU9ZZ85kqZ1QA== dependencies: "@firebase/app-check-interop-types" "0.1.0" @@ -225,7 +225,7 @@ "@firebase/installations@0.5.0": version "0.5.0" - resolved "https://registry.yarnpkg.com/@firebase/installations/-/installations-0.5.0.tgz#4a21e1c7467795802b031af413df2555b17cf1b1" + resolved "https://registry.npmjs.org/@firebase/installations/-/installations-0.5.0.tgz" integrity sha512-wF1CKIx+SoiEbtNdutulxW4z80B5lGXW+8JdAtcKQwgKxF0VtlCaDFsd9AEB3aTtzIve5UkGak8hQOMvvOpydg== dependencies: "@firebase/component" "0.5.6" @@ -235,12 +235,12 @@ "@firebase/logger@0.2.6": version "0.2.6" - resolved "https://registry.yarnpkg.com/@firebase/logger/-/logger-0.2.6.tgz#3aa2ca4fe10327cabf7808bd3994e88db26d7989" + resolved "https://registry.npmjs.org/@firebase/logger/-/logger-0.2.6.tgz" integrity sha512-KIxcUvW/cRGWlzK9Vd2KB864HlUnCfdTH0taHE0sXW5Xl7+W68suaeau1oKNEqmc3l45azkd4NzXTCWZRZdXrw== "@firebase/messaging-compat@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/messaging-compat/-/messaging-compat-0.1.0.tgz#ab164540f6ba954c8d150b2e96dc6bf8c1536eb4" + resolved "https://registry.npmjs.org/@firebase/messaging-compat/-/messaging-compat-0.1.0.tgz" integrity sha512-58qQmKwOiXhxZwrRwwjQDbjlRx1uMVVuV/DNbDzqilDJDdoYXMdK6RBTF9Bs51qy/Z1BI2Q9B1JX01QYlgZpxQ== dependencies: "@firebase/component" "0.5.6" @@ -250,12 +250,12 @@ "@firebase/messaging-interop-types@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/messaging-interop-types/-/messaging-interop-types-0.1.0.tgz#bdac02dd31edd5cb9eec37b1db698ea5e2c1a631" + resolved "https://registry.npmjs.org/@firebase/messaging-interop-types/-/messaging-interop-types-0.1.0.tgz" integrity sha512-DbvUl/rXAZpQeKBnwz0NYY5OCqr2nFA0Bj28Fmr3NXGqR4PAkfTOHuQlVtLO1Nudo3q0HxAYLa68ZDAcuv2uKQ== "@firebase/messaging@0.9.0": version "0.9.0" - resolved "https://registry.yarnpkg.com/@firebase/messaging/-/messaging-0.9.0.tgz#a868bea75d0c26210903178cf22d31c47bc84584" + resolved "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.9.0.tgz" integrity sha512-NTUB+gVJsgL/f6wqwUlgadaNuLZvyk1IlTcRvR3391t8jDSWOT2efwzNqcI7Xv4nhzaiPhzAQ4ncH/m8kfUUXQ== dependencies: "@firebase/component" "0.5.6" @@ -267,7 +267,7 @@ "@firebase/performance-compat@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/performance-compat/-/performance-compat-0.1.0.tgz#c1edeccd9b60d83de26d8e645e0d2ddd64e9a2d7" + resolved "https://registry.npmjs.org/@firebase/performance-compat/-/performance-compat-0.1.0.tgz" integrity sha512-H+/A5+y/15hFn5FHRP8lcogDzO6qm9YoACNEXn71UN4PiGQ+/BbHkQafDEXxD6wLfqfqR8u8oclHPFIYxMBF7Q== dependencies: "@firebase/component" "0.5.6" @@ -279,12 +279,12 @@ "@firebase/performance-types@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/performance-types/-/performance-types-0.1.0.tgz#5e6efa9dc81860aee2cb7121b39ae8fa137e69fc" + resolved "https://registry.npmjs.org/@firebase/performance-types/-/performance-types-0.1.0.tgz" integrity sha512-6p1HxrH0mpx+622Ql6fcxFxfkYSBpE3LSuwM7iTtYU2nw91Hj6THC8Bc8z4nboIq7WvgsT/kOTYVVZzCSlXl8w== "@firebase/performance@0.5.0": version "0.5.0" - resolved "https://registry.yarnpkg.com/@firebase/performance/-/performance-0.5.0.tgz#cc237e65791c75dba856ace8971b94d7adcbc60b" + resolved "https://registry.npmjs.org/@firebase/performance/-/performance-0.5.0.tgz" integrity sha512-E+L18eJKshr/ijnWZMexEEddwkp2T4Ye2dJSK4TcOKRYfrmfZJ95RRZ+MPNp1ES7RH2JYiyym1NIQKPcNNvhug== dependencies: "@firebase/component" "0.5.6" @@ -295,7 +295,7 @@ "@firebase/polyfill@0.3.36": version "0.3.36" - resolved "https://registry.yarnpkg.com/@firebase/polyfill/-/polyfill-0.3.36.tgz#c057cce6748170f36966b555749472b25efdb145" + resolved "https://registry.npmjs.org/@firebase/polyfill/-/polyfill-0.3.36.tgz" integrity sha512-zMM9oSJgY6cT2jx3Ce9LYqb0eIpDE52meIzd/oe/y70F+v9u1LDqk5kUF5mf16zovGBWMNFmgzlsh6Wj0OsFtg== dependencies: core-js "3.6.5" @@ -304,7 +304,7 @@ "@firebase/remote-config-compat@0.1.0": version "0.1.0" - resolved "https://registry.yarnpkg.com/@firebase/remote-config-compat/-/remote-config-compat-0.1.0.tgz#8eb2582d1909dd4d5023383e43d73ad605d56daa" + resolved "https://registry.npmjs.org/@firebase/remote-config-compat/-/remote-config-compat-0.1.0.tgz" integrity sha512-PpCh5f5hUUaDCmiJsuu/u9a0g0G5WH3YSbfH1jPejVOaJ1lS82615E7WOzco4zMllLYfX62VaUYD2vvcLyXE/w== dependencies: "@firebase/component" "0.5.6" @@ -316,12 +316,12 @@ "@firebase/remote-config-types@0.2.0": version "0.2.0" - resolved "https://registry.yarnpkg.com/@firebase/remote-config-types/-/remote-config-types-0.2.0.tgz#1e2759fc01f20b58c564db42196f075844c3d1fd" + resolved "https://registry.npmjs.org/@firebase/remote-config-types/-/remote-config-types-0.2.0.tgz" integrity sha512-hqK5sCPeZvcHQ1D6VjJZdW6EexLTXNMJfPdTwbD8NrXUw6UjWC4KWhLK/TSlL0QPsQtcKRkaaoP+9QCgKfMFPw== "@firebase/remote-config@0.2.0": version "0.2.0" - resolved "https://registry.yarnpkg.com/@firebase/remote-config/-/remote-config-0.2.0.tgz#aa2bd7b34e0e40a259c3f0409a5084864f234f0f" + resolved "https://registry.npmjs.org/@firebase/remote-config/-/remote-config-0.2.0.tgz" integrity sha512-hNZ+BqsTmfe8ogpeow95NSwQmKIeetKdPxKpyC6RZBeFUae782+2HrUx4/Quep6OZjOHQF6xZ5d3VOxu2ZKEfg== dependencies: "@firebase/component" "0.5.6" @@ -332,7 +332,7 @@ "@firebase/storage-compat@0.1.2": version "0.1.2" - resolved "https://registry.yarnpkg.com/@firebase/storage-compat/-/storage-compat-0.1.2.tgz#98e6b3516a70799935618c32e6b8937370587929" + resolved "https://registry.npmjs.org/@firebase/storage-compat/-/storage-compat-0.1.2.tgz" integrity sha512-eff0e2qcDX188mqr7aKrqr4TIS25/cE6E7Xo9WRLe3c17nqGgmrYM4DDS3VDttNbf1j5XaoEnZVZafE9/BR3Rg== dependencies: "@firebase/component" "0.5.6" @@ -343,12 +343,12 @@ "@firebase/storage-types@0.6.0": version "0.6.0" - resolved "https://registry.yarnpkg.com/@firebase/storage-types/-/storage-types-0.6.0.tgz#0b1af64a2965af46fca138e5b70700e9b7e6312a" + resolved "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.6.0.tgz" integrity sha512-1LpWhcCb1ftpkP/akhzjzeFxgVefs6eMD2QeKiJJUGH1qOiows2w5o0sKCUSQrvrRQS1lz3SFGvNR1Ck/gqxeA== "@firebase/storage@0.8.2": version "0.8.2" - resolved "https://registry.yarnpkg.com/@firebase/storage/-/storage-0.8.2.tgz#e08c05d070a468f0976a3d0cd32318655f0ae3b7" + resolved "https://registry.npmjs.org/@firebase/storage/-/storage-0.8.2.tgz" integrity sha512-I9mVYhQ/DkWI1MKHhYvI4dnguXdXC50S5ryehOcR/JmSwyYjh1+T+IFQp0hHb1VWTixShzWoSGo1PhbrolFmIA== dependencies: "@firebase/component" "0.5.6" @@ -358,26 +358,26 @@ "@firebase/util@1.3.0": version "1.3.0" - resolved "https://registry.yarnpkg.com/@firebase/util/-/util-1.3.0.tgz#e71113bdd5073e9736ceca665b54d9f6df232b20" + resolved "https://registry.npmjs.org/@firebase/util/-/util-1.3.0.tgz" integrity sha512-SESvmYwuKOVCZ1ZxLbberbx+9cnbxpCa4CG2FUSQYqN6Ab8KyltegMDIsqMw5KyIBZ4n1phfHoOa22xo5NzAlQ== dependencies: tslib "^2.1.0" "@firebase/webchannel-wrapper@0.5.1": version "0.5.1" - resolved "https://registry.yarnpkg.com/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.5.1.tgz#a64d1af3c62e3bb89576ec58af880980a562bf4e" + resolved "https://registry.npmjs.org/@firebase/webchannel-wrapper/-/webchannel-wrapper-0.5.1.tgz" integrity sha512-dZMzN0uAjwJXWYYAcnxIwXqRTZw3o14hGe7O6uhwjD1ZQWPVYA5lASgnNskEBra0knVBsOXB4KXg+HnlKewN/A== "@grpc/grpc-js@^1.3.2": version "1.3.7" - resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.3.7.tgz#58b687aff93b743aafde237fd2ee9a3259d7f2d8" + resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.3.7.tgz" integrity sha512-CKQVuwuSPh40tgOkR7c0ZisxYRiN05PcKPW72mQL5y++qd7CwBRoaJZvU5xfXnCJDFBmS3qZGQ71Frx6Ofo2XA== dependencies: "@types/node" ">=12.12.47" "@grpc/proto-loader@^0.6.0": version "0.6.5" - resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.6.5.tgz#f23c7cb3e7076a8702f40c2b6678f06fb9950a55" + resolved "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.5.tgz" integrity sha512-GZdzyVQI1Bln/kCzIYgTKu+rQJ5dno0gVrfmLe4jqQu7T2e7svSwJzpCBqVU5hhBSJP3peuPjOMWsj5GR61YmQ== dependencies: "@types/long" "^4.0.1" @@ -386,104 +386,118 @@ protobufjs "^6.10.0" yargs "^16.1.1" -"@octokit/auth-token@^2.4.0": - version "2.4.0" - resolved "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-2.4.0.tgz#b64178975218b99e4dfe948253f0673cbbb59d9f" - integrity sha512-eoOVMjILna7FVQf96iWc3+ZtE/ZT6y8ob8ZzcqKY1ibSQCnu4O/B7pJvzMx5cyZ/RjAff6DAdEb0O0Cjcxidkg== - dependencies: - "@octokit/types" "^2.0.0" - -"@octokit/endpoint@^3.1.1": - version "3.1.2" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-3.1.2.tgz#22b5aa8596482fbefc3f1ce22c24ad217aed60fa" - integrity sha512-iRx4kDYybAv9tOrHDBE6HwlgiFi8qmbZl8SHliZWtxbUFuXLZXh2yv8DxGIK9wzD9J0wLDMZneO8vNYJNUSJ9Q== - dependencies: - deepmerge "3.1.0" - is-plain-object "^2.0.4" - universal-user-agent "^2.0.1" - url-template "^2.0.8" - -"@octokit/endpoint@^5.5.0": - version "5.5.2" - resolved "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-5.5.2.tgz#ed19d01fe85ac58bc2b774661658f9e5429b8164" - integrity sha512-ICDcRA0C2vtTZZGud1nXRrBLXZqFayodXAKZfo3dkdcLNqcHsgaz3YSTupbURusYeucSVRjjG+RTcQhx6HPPcg== - dependencies: - "@octokit/types" "^2.0.0" - is-plain-object "^3.0.0" - universal-user-agent "^4.0.0" +"@octokit/auth-token@^2.4.0", "@octokit/auth-token@^2.4.4": + version "2.5.0" + resolved "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz" + integrity sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g== + dependencies: + "@octokit/types" "^6.0.3" + +"@octokit/core@^3.5.1": + version "3.5.1" + resolved "https://registry.npmjs.org/@octokit/core/-/core-3.5.1.tgz" + integrity sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw== + dependencies: + "@octokit/auth-token" "^2.4.4" + "@octokit/graphql" "^4.5.8" + "@octokit/request" "^5.6.0" + "@octokit/request-error" "^2.0.5" + "@octokit/types" "^6.0.3" + before-after-hook "^2.2.0" + universal-user-agent "^6.0.0" + +"@octokit/endpoint@^6.0.1": + version "6.0.12" + resolved "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz" + integrity sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA== + dependencies: + "@octokit/types" "^6.0.3" + is-plain-object "^5.0.0" + universal-user-agent "^6.0.0" + +"@octokit/graphql@^4.5.8": + version "4.8.0" + resolved "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz" + integrity sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg== + dependencies: + "@octokit/request" "^5.6.0" + "@octokit/types" "^6.0.3" + universal-user-agent "^6.0.0" + +"@octokit/openapi-types@^11.2.0": + version "11.2.0" + resolved "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-11.2.0.tgz" + integrity sha512-PBsVO+15KSlGmiI8QAzaqvsNlZlrDlyAJYcrXBCvVUxCp7VnXjkwPoFHgjEJXx3WF9BAwkA6nfCUA7i9sODzKA== "@octokit/plugin-paginate-rest@^1.1.1": version "1.1.2" - resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz#004170acf8c2be535aba26727867d692f7b488fc" + resolved "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-1.1.2.tgz" integrity sha512-jbsSoi5Q1pj63sC16XIUboklNw+8tL9VOnJsWycWYR78TKss5PVpIPb1TUUcMQ+bBh7cY579cVAWmf5qG+dw+Q== dependencies: "@octokit/types" "^2.0.1" -"@octokit/plugin-request-log@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.0.tgz#eef87a431300f6148c39a7f75f8cfeb218b2547e" - integrity sha512-ywoxP68aOT3zHCLgWZgwUJatiENeHE7xJzYjfz8WI0goynp96wETBF+d95b8g/uL4QmS6owPVlaxiz3wyMAzcw== +"@octokit/plugin-paginate-rest@^2.16.8": + version "2.17.0" + resolved "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.17.0.tgz" + integrity sha512-tzMbrbnam2Mt4AhuyCHvpRkS0oZ5MvwwcQPYGtMv4tUa5kkzG58SVB0fcsLulOZQeRnOgdkZWkRUiyBlh0Bkyw== + dependencies: + "@octokit/types" "^6.34.0" + +"@octokit/plugin-request-log@^1.0.0", "@octokit/plugin-request-log@^1.0.4": + version "1.0.4" + resolved "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-1.0.4.tgz" + integrity sha512-mLUsMkgP7K/cnFEw07kWqXGF5LKrOkD+lhCrKvPHXWDywAwuDUeDwWBpc69XK3pNX0uKiVt8g5z96PJ6z9xCFA== "@octokit/plugin-rest-endpoint-methods@2.4.0": version "2.4.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz#3288ecf5481f68c494dd0602fc15407a59faf61e" + resolved "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-2.4.0.tgz" integrity sha512-EZi/AWhtkdfAYi01obpX0DF7U6b1VRr30QNQ5xSFPITMdLSfhcBqjamE3F+sKcxPbD7eZuMHu3Qkk2V+JGxBDQ== dependencies: "@octokit/types" "^2.0.1" deprecation "^2.3.1" -"@octokit/request-error@^1.0.1", "@octokit/request-error@^1.0.2": +"@octokit/plugin-rest-endpoint-methods@^5.12.0": + version "5.13.0" + resolved "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.13.0.tgz" + integrity sha512-uJjMTkN1KaOIgNtUPMtIXDOjx6dGYysdIFhgA52x4xSadQCz3b/zJexvITDVpANnfKPW/+E0xkOvLntqMYpviA== + dependencies: + "@octokit/types" "^6.34.0" + deprecation "^2.3.1" + +"@octokit/request-error@^1.0.2": version "1.2.1" - resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-1.2.1.tgz#ede0714c773f32347576c25649dc013ae6b31801" + resolved "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.2.1.tgz" integrity sha512-+6yDyk1EES6WK+l3viRDElw96MvwfJxCt45GvmjDUKWjYIb3PJZQkq3i46TwGwoPD4h8NmTrENmtyA1FwbmhRA== dependencies: "@octokit/types" "^2.0.0" deprecation "^2.0.0" once "^1.4.0" -"@octokit/request@2.3.0": - version "2.3.0" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-2.3.0.tgz#da2672308bcf0b9376ef66f51bddbe5eb87cc00a" - integrity sha512-5YRqYNZOAaL7+nt7w3Scp6Sz4P2g7wKFP9npx1xdExMomk8/M/ICXVLYVam2wzxeY0cIc6wcKpjC5KI4jiNbGw== - dependencies: - "@octokit/endpoint" "^3.1.1" - is-plain-object "^2.0.4" - node-fetch "^2.3.0" - universal-user-agent "^2.0.1" - -"@octokit/request@^5.2.0": - version "5.3.1" - resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.3.1.tgz#3a1ace45e6f88b1be4749c5da963b3a3b4a2f120" - integrity sha512-5/X0AL1ZgoU32fAepTfEoggFinO3rxsMLtzhlUX+RctLrusn/CApJuGFCd0v7GMFhF+8UiCsTTfsu7Fh1HnEJg== +"@octokit/request-error@^2.0.5", "@octokit/request-error@^2.1.0": + version "2.1.0" + resolved "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz" + integrity sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg== dependencies: - "@octokit/endpoint" "^5.5.0" - "@octokit/request-error" "^1.0.1" - "@octokit/types" "^2.0.0" + "@octokit/types" "^6.0.3" deprecation "^2.0.0" - is-plain-object "^3.0.0" - node-fetch "^2.3.0" once "^1.4.0" - universal-user-agent "^4.0.0" -"@octokit/rest@^16.14.1": - version "16.15.0" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.15.0.tgz#648a88d5de055bcf38976709c5b2bdf1227b926f" - integrity sha512-Un+e7rgh38RtPOTe453pT/KPM/p2KZICimBmuZCd2wEo8PacDa4h6RqTPZs+f2DPazTTqdM7QU4LKlUjgiBwWw== +"@octokit/request@^5.2.0", "@octokit/request@^5.6.0": + version "5.6.2" + resolved "https://registry.npmjs.org/@octokit/request/-/request-5.6.2.tgz" + integrity sha512-je66CvSEVf0jCpRISxkUcCa0UkxmFs6eGDRSbfJtAVwbLH5ceqF+YEyC8lj8ystKyZTy8adWr0qmkY52EfOeLA== dependencies: - "@octokit/request" "2.3.0" - before-after-hook "^1.2.0" - btoa-lite "^1.0.0" - lodash.get "^4.4.2" - lodash.set "^4.3.2" - lodash.uniq "^4.5.0" - octokit-pagination-methods "^1.1.0" - universal-user-agent "^2.0.0" - url-template "^2.0.8" + "@octokit/endpoint" "^6.0.1" + "@octokit/request-error" "^2.1.0" + "@octokit/types" "^6.16.1" + is-plain-object "^5.0.0" + node-fetch "^2.6.1" + universal-user-agent "^6.0.0" -"@octokit/rest@^16.43.0": - version "16.43.1" - resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-16.43.1.tgz#3b11e7d1b1ac2bbeeb23b08a17df0b20947eda6b" - integrity sha512-gfFKwRT/wFxq5qlNjnW2dh+qh74XgTQ2B179UX5K1HYCluioWj8Ndbgqw2PVqa1NnVJkGHp2ovMpVn/DImlmkw== +"@octokit/rest@^16.14.1": + version "16.43.2" + resolved "https://registry.npmjs.org/@octokit/rest/-/rest-16.43.2.tgz" + integrity sha512-ngDBevLbBTFfrHZeiS7SAMAZ6ssuVmXuya+F/7RaVvlysgGa1JKJkKWY+jV6TCJYcW0OALfJ7nTIGXcBXzycfQ== dependencies: "@octokit/auth-token" "^2.4.0" "@octokit/plugin-paginate-rest" "^1.1.1" @@ -502,36 +516,53 @@ once "^1.4.0" universal-user-agent "^4.0.0" +"@octokit/rest@^18.12.0": + version "18.12.0" + resolved "https://registry.npmjs.org/@octokit/rest/-/rest-18.12.0.tgz" + integrity sha512-gDPiOHlyGavxr72y0guQEhLsemgVjwRePayJ+FcKc2SJqKUbxbkvf5kAZEWA/MKvsfYlQAMVzNJE3ezQcxMJ2Q== + dependencies: + "@octokit/core" "^3.5.1" + "@octokit/plugin-paginate-rest" "^2.16.8" + "@octokit/plugin-request-log" "^1.0.4" + "@octokit/plugin-rest-endpoint-methods" "^5.12.0" + "@octokit/types@^2.0.0", "@octokit/types@^2.0.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@octokit/types/-/types-2.1.1.tgz#77e80d1b663c5f1f829e5377b728fa3c4fe5a97d" - integrity sha512-89LOYH+d/vsbDX785NOfLxTW88GjNd0lWRz1DVPVsZgg9Yett5O+3MOvwo7iHgvUwbFz0mf/yPIjBkUbs4kxoQ== + version "2.16.2" + resolved "https://registry.npmjs.org/@octokit/types/-/types-2.16.2.tgz" + integrity sha512-O75k56TYvJ8WpAakWwYRN8Bgu60KrmX0z1KqFp1kNiFNkgW+JW+9EBKZ+S33PU6SLvbihqd+3drvPxKK68Ee8Q== dependencies: "@types/node" ">= 8" +"@octokit/types@^6.0.3", "@octokit/types@^6.16.1", "@octokit/types@^6.34.0": + version "6.34.0" + resolved "https://registry.npmjs.org/@octokit/types/-/types-6.34.0.tgz" + integrity sha512-s1zLBjWhdEI2zwaoSgyOFoKSl109CUcVBCc7biPJ3aAf6LGLU6szDvi31JPU7bxfla2lqfhjbbg/5DdFNxOwHw== + dependencies: + "@octokit/openapi-types" "^11.2.0" + "@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + resolved "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz" integrity sha1-m4sMxmPWaafY9vXQiToU00jzD78= "@protobufjs/base64@^1.1.2": version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + resolved "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz" integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== "@protobufjs/codegen@^2.0.4": version "2.0.4" - resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + resolved "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz" integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== "@protobufjs/eventemitter@^1.1.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + resolved "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz" integrity sha1-NVy8mLr61ZePntCV85diHx0Ga3A= "@protobufjs/fetch@^1.1.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + resolved "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz" integrity sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU= dependencies: "@protobufjs/aspromise" "^1.1.1" @@ -539,123 +570,118 @@ "@protobufjs/float@^1.0.2": version "1.0.2" - resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + resolved "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz" integrity sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E= "@protobufjs/inquire@^1.1.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + resolved "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz" integrity sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik= "@protobufjs/path@^1.1.2": version "1.1.2" - resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + resolved "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz" integrity sha1-bMKyDFya1q0NzP0hynZz2Nf79o0= "@protobufjs/pool@^1.1.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + resolved "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz" integrity sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q= "@protobufjs/utf8@^1.1.0": version "1.1.0" - resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + resolved "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz" integrity sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA= "@types/long@^4.0.1": version "4.0.1" - resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.1.tgz#459c65fa1867dafe6a8f322c4c51695663cc55e9" + resolved "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz" integrity sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w== -"@types/node@>= 8": - version "13.7.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.1.tgz#238eb34a66431b71d2aaddeaa7db166f25971a0d" - integrity sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA== - -"@types/node@>=12.12.47", "@types/node@>=13.7.0": +"@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0": version "16.9.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-16.9.1.tgz#0611b37db4246c937feef529ddcc018cf8e35708" + resolved "https://registry.npmjs.org/@types/node/-/node-16.9.1.tgz" integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g== agent-base@4, agent-base@^4.1.0: version "4.2.1" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9" + resolved "https://registry.npmjs.org/agent-base/-/agent-base-4.2.1.tgz" integrity sha512-JVwXMr9nHYTUXsBFKUqhJwvlcYU/blreOEUkhNR2eXZIvwd+c+o5V4MgDPKWnMS/56awN3TRzIP+KoPn+roQtg== dependencies: es6-promisify "^5.0.0" ansi-regex@^2.0.0: version "2.1.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz" integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= ansi-regex@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz" integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= ansi-regex@^5.0.0: version "5.0.1" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + resolved "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz" integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== ansi-styles@^3.2.1: version "3.2.1" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" ansi-styles@^4.0.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + resolved "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz" integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== dependencies: color-convert "^2.0.1" arr-diff@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" + resolved "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz" integrity sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA= arr-flatten@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + resolved "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz" integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== arr-union@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" + resolved "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= array-unique@^0.3.2: version "0.3.2" - resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" + resolved "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= assign-symbols@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/assign-symbols/-/assign-symbols-1.0.0.tgz#59667f41fadd4f20ccbc2bb96b8d4f7f78ec0367" + resolved "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz" integrity sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c= atob-lite@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/atob-lite/-/atob-lite-2.0.0.tgz#0fef5ad46f1bd7a8502c65727f0367d5ee43d696" + resolved "https://registry.npmjs.org/atob-lite/-/atob-lite-2.0.0.tgz" integrity sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY= atob@^2.1.1: version "2.1.2" - resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" + resolved "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== balanced-match@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" + resolved "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= base@^0.11.1: version "0.11.2" - resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" + resolved "https://registry.npmjs.org/base/-/base-0.11.2.tgz" integrity sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg== dependencies: cache-base "^1.0.1" @@ -666,19 +692,14 @@ base@^0.11.1: mixin-deep "^1.2.0" pascalcase "^0.1.1" -before-after-hook@^1.2.0: - version "1.3.2" - resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-1.3.2.tgz#7bfbf844ad670aa7a96b5a4e4e15bd74b08ed66b" - integrity sha512-zyPgY5dgbf99c0uGUjhY4w+mxqEGxPKg9RQDl34VvrVh2bM31lFN+mwR1ZHepq/KA3VCPk1gwJZL6IIJqjLy2w== - -before-after-hook@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" - integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== +before-after-hook@^2.0.0, before-after-hook@^2.2.0: + version "2.2.2" + resolved "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz" + integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ== brace-expansion@^1.1.7: version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + resolved "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" @@ -686,7 +707,7 @@ brace-expansion@^1.1.7: braces@^2.3.1: version "2.3.2" - resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" + resolved "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz" integrity sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w== dependencies: arr-flatten "^1.1.0" @@ -702,17 +723,17 @@ braces@^2.3.1: btoa-lite@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337" + resolved "https://registry.npmjs.org/btoa-lite/-/btoa-lite-1.0.0.tgz" integrity sha1-M3dm2hWAEhD92VbCLpxokaudAzc= buffer-equal-constant-time@1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + resolved "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz" integrity sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk= cache-base@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/cache-base/-/cache-base-1.0.1.tgz#0a7f46416831c8b662ee36fe4e7c59d76f666ab2" + resolved "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz" integrity sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ== dependencies: collection-visit "^1.0.0" @@ -727,12 +748,12 @@ cache-base@^1.0.1: camelcase@^4.1.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" + resolved "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= chalk@^2.3.0: version "2.4.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" + resolved "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== dependencies: ansi-styles "^3.2.1" @@ -741,7 +762,7 @@ chalk@^2.3.0: class-utils@^0.3.5: version "0.3.6" - resolved "https://registry.yarnpkg.com/class-utils/-/class-utils-0.3.6.tgz#f93369ae8b9a7ce02fd41faad0ca83033190c463" + resolved "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz" integrity sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg== dependencies: arr-union "^3.1.0" @@ -751,7 +772,7 @@ class-utils@^0.3.5: cliui@^4.0.0: version "4.1.0" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-4.1.0.tgz#348422dbe82d800b3022eef4f6ac10bf2e4d1b49" + resolved "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz" integrity sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ== dependencies: string-width "^2.1.1" @@ -760,7 +781,7 @@ cliui@^4.0.0: cliui@^7.0.2: version "7.0.4" - resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz" integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== dependencies: string-width "^4.2.0" @@ -769,12 +790,12 @@ cliui@^7.0.2: code-point-at@^1.0.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" + resolved "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz" integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= collection-visit@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + resolved "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz" integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= dependencies: map-visit "^1.0.0" @@ -782,66 +803,66 @@ collection-visit@^1.0.0: color-convert@^1.9.0: version "1.9.3" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz" integrity sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg== dependencies: color-name "1.1.3" color-convert@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + resolved "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz" integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== dependencies: color-name "~1.1.4" color-name@1.1.3: version "1.1.3" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= color-name@~1.1.4: version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== commander@^2.18.0: version "2.19.0" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" + resolved "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== component-emitter@^1.2.1: version "1.3.0" - resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + resolved "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz" integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== concat-map@0.0.1: version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= copy-descriptor@^0.1.0: version "0.1.1" - resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + resolved "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= core-js@3.6.5: version "3.6.5" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a" + resolved "https://registry.npmjs.org/core-js/-/core-js-3.6.5.tgz" integrity sha512-vZVEEwZoIsI+vPEuoF9Iqf5H7/M3eeQqWlQnYa8FSKKePuYTf5MWnxb5SDAzCa60b3JBRS5g9b+Dq7b1y/RCrA== core-js@^2.5.7: version "2.6.4" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.4.tgz#b8897c062c4d769dd30a0ac5c73976c47f92ea0d" + resolved "https://registry.npmjs.org/core-js/-/core-js-2.6.4.tgz" integrity sha512-05qQ5hXShcqGkPZpXEFLIpxayZscVD2kuMBZewxiIPPEagukO4mqgPA9CWhUvFBJfy3ODdK2p9xyHh7FTU9/7A== core-util-is@~1.0.0: version "1.0.2" - resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" + resolved "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= cross-spawn@^5.0.1: version "5.1.0" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz" integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= dependencies: lru-cache "^4.0.1" @@ -850,7 +871,7 @@ cross-spawn@^5.0.1: cross-spawn@^6.0.0: version "6.0.5" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" + resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz" integrity sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ== dependencies: nice-try "^1.0.4" @@ -861,7 +882,7 @@ cross-spawn@^6.0.0: danger@^7.1.4: version "7.1.4" - resolved "https://registry.yarnpkg.com/danger/-/danger-7.1.4.tgz#de068b9277143505a7aaa698f27aac90c00303ae" + resolved "https://registry.npmjs.org/danger/-/danger-7.1.4.tgz" integrity sha512-Q6Qi7GZ58k2kyGbZkToGquM8ELtY9GR2CsfHeKGzIa77cRzaTMvn/x1W4FH3Vd0WPIASDV1yFp0xjvbK9sPcpg== dependencies: "@babel/polyfill" "^7.2.5" @@ -901,64 +922,59 @@ danger@^7.1.4: debug@3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" + resolved "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz" integrity sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g== dependencies: ms "2.0.0" debug@^2.2.0, debug@^2.3.3: version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + resolved "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz" integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== dependencies: ms "2.0.0" debug@^3.1.0: version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + resolved "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz" integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== dependencies: ms "^2.1.1" debug@^4.1.1: version "4.1.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" + resolved "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: ms "^2.1.1" decamelize@^1.1.1: version "1.2.0" - resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" + resolved "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= decode-uri-component@^0.2.0: version "0.2.0" - resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" + resolved "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz" integrity sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU= -deepmerge@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/deepmerge/-/deepmerge-3.1.0.tgz#a612626ce4803da410d77554bfd80361599c034d" - integrity sha512-/TnecbwXEdycfbsM2++O3eGiatEFHjjNciHEwJclM+T5Kd94qD1AP+2elP/Mq0L5b9VZJao5znR01Mz6eX8Seg== - define-property@^0.2.5: version "0.2.5" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + resolved "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz" integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= dependencies: is-descriptor "^0.1.0" define-property@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + resolved "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz" integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= dependencies: is-descriptor "^1.0.0" define-property@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + resolved "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz" integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== dependencies: is-descriptor "^1.0.2" @@ -966,49 +982,56 @@ define-property@^2.0.2: deprecation@^2.0.0, deprecation@^2.3.1: version "2.3.1" - resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919" + resolved "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz" integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ== ecdsa-sig-formatter@1.0.10: version "1.0.10" - resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz#1c595000f04a8897dfb85000892a0f4c33af86c3" + resolved "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.10.tgz" integrity sha1-HFlQAPBKiJffuFAAiSoPTDOvhsM= dependencies: safe-buffer "^5.0.1" emoji-regex@^8.0.0: version "8.0.0" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + es6-promise@^4.0.3: version "4.2.5" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.5.tgz#da6d0d5692efb461e082c14817fe2427d8f5d054" + resolved "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.5.tgz" integrity sha512-n6wvpdE43VFtJq+lUDYDBFUwV8TZbuGXLV4D6wKafg13ldznKsyEvatubnmUe31zcvelSzOHF+XbaT+Bl9ObDg== es6-promisify@^5.0.0: version "5.0.0" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" + resolved "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz" integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= dependencies: es6-promise "^4.0.3" escalade@^3.1.1: version "3.1.1" - resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz" integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== escape-string-regexp@^1.0.5: version "1.0.5" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + resolved "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -execa@^0.10.0: - version "0.10.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.10.0.tgz#ff456a8f53f90f8eccc71a96d11bdfc7f082cb50" - integrity sha512-7XOMnz8Ynx1gGo/3hyV9loYNPWM94jG3+3T3Y8tsfSstFmETmENCMU/A/zj8Lyaj1lkgEepKepvd6240tBRvlw== +execa@^0.7.0: + version "0.7.0" + resolved "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz" + integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= dependencies: - cross-spawn "^6.0.0" + cross-spawn "^5.0.1" get-stream "^3.0.0" is-stream "^1.1.0" npm-run-path "^2.0.0" @@ -1016,13 +1039,13 @@ execa@^0.10.0: signal-exit "^3.0.0" strip-eof "^1.0.0" -execa@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777" - integrity sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c= +execa@^1.0.0: + version "1.0.0" + resolved "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz" + integrity sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA== dependencies: - cross-spawn "^5.0.1" - get-stream "^3.0.0" + cross-spawn "^6.0.0" + get-stream "^4.0.0" is-stream "^1.1.0" npm-run-path "^2.0.0" p-finally "^1.0.0" @@ -1031,7 +1054,7 @@ execa@^0.7.0: expand-brackets@^2.1.4: version "2.1.4" - resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" + resolved "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz" integrity sha1-t3c14xXOMPa27/D4OwQVGiJEliI= dependencies: debug "^2.3.3" @@ -1044,21 +1067,21 @@ expand-brackets@^2.1.4: expand-tilde@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/expand-tilde/-/expand-tilde-2.0.2.tgz#97e801aa052df02454de46b02bf621642cdc8502" + resolved "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz" integrity sha1-l+gBqgUt8CRU3kawK/YhZCzchQI= dependencies: homedir-polyfill "^1.0.1" extend-shallow@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + resolved "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz" integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= dependencies: is-extendable "^0.1.0" extend-shallow@^3.0.0, extend-shallow@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-3.0.2.tgz#26a71aaf073b39fb2127172746131c2704028db8" + resolved "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz" integrity sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg= dependencies: assign-symbols "^1.0.0" @@ -1066,7 +1089,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: extglob@^2.0.4: version "2.0.4" - resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" + resolved "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz" integrity sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw== dependencies: array-unique "^0.3.2" @@ -1080,14 +1103,14 @@ extglob@^2.0.4: faye-websocket@0.11.3: version "0.11.3" - resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.3.tgz#5c0e9a8968e8912c286639fde977a8b209f2508e" + resolved "https://registry.npmjs.org/faye-websocket/-/faye-websocket-0.11.3.tgz" integrity sha512-D2y4bovYpzziGgbHYtGCMjlJM36vAl/y+xUyn1C+FVx8szd1E+86KwVw6XvYSzOP8iMpm1X0I4xJD+QtUb36OA== dependencies: websocket-driver ">=0.5.1" fill-range@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" + resolved "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz" integrity sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc= dependencies: extend-shallow "^2.0.1" @@ -1097,14 +1120,14 @@ fill-range@^4.0.0: find-up@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" + resolved "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz" integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c= dependencies: locate-path "^2.0.0" firebase@^9.0.2: version "9.0.2" - resolved "https://registry.yarnpkg.com/firebase/-/firebase-9.0.2.tgz#092019326f1c9a67ec00ec78d50f80244581c705" + resolved "https://registry.npmjs.org/firebase/-/firebase-9.0.2.tgz" integrity sha512-+wdsD3Sk3fOgplzv4yzBmJ3Pdr01QiFF38Zq+8hzd+Dv6ZKMrgiq5CRljCaWenhZ/j8nuvHlq82u64ZARaXC+w== dependencies: "@firebase/analytics" "0.7.0" @@ -1136,54 +1159,61 @@ firebase@^9.0.2: for-in@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + resolved "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz" integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= fragment-cache@^0.2.1: version "0.2.1" - resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" + resolved "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz" integrity sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk= dependencies: map-cache "^0.2.2" fs-exists-sync@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz#982d6893af918e72d08dec9e8673ff2b5a8d6add" + resolved "https://registry.npmjs.org/fs-exists-sync/-/fs-exists-sync-0.1.0.tgz" integrity sha1-mC1ok6+RjnLQjeyehnP/K1qNat0= fs.realpath@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= get-caller-file@^1.0.1: version "1.0.3" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz" integrity sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w== get-caller-file@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-stdin@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" + resolved "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz" integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== get-stream@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz" integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= +get-stream@^4.0.0: + version "4.1.0" + resolved "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz" + integrity sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w== + dependencies: + pump "^3.0.0" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" - resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" + resolved "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz" integrity sha1-3BXKHGcjh8p2vTesCjlbogQqLCg= git-config-path@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/git-config-path/-/git-config-path-1.0.1.tgz#6d33f7ed63db0d0e118131503bab3aca47d54664" + resolved "https://registry.npmjs.org/git-config-path/-/git-config-path-1.0.1.tgz" integrity sha1-bTP37WPbDQ4RgTFQO6s6ykfVRmQ= dependencies: extend-shallow "^2.0.1" @@ -1192,7 +1222,7 @@ git-config-path@^1.0.1: glob@^7.1.3: version "7.1.6" - resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.6.tgz#141f33b81a7c2492e125594307480c46679278a6" + resolved "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz" integrity sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA== dependencies: fs.realpath "^1.0.0" @@ -1204,17 +1234,17 @@ glob@^7.1.3: has-flag@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz" integrity sha1-6CB68cx7MNRGzHC3NLXovhj4jVE= has-flag@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= has-value@^0.3.1: version "0.3.1" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-0.3.1.tgz#7b1f58bada62ca827ec0a2078025654845995e1f" + resolved "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz" integrity sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8= dependencies: get-value "^2.0.3" @@ -1223,7 +1253,7 @@ has-value@^0.3.1: has-value@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/has-value/-/has-value-1.0.0.tgz#18b281da585b1c5c51def24c930ed29a0be6b177" + resolved "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz" integrity sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc= dependencies: get-value "^2.0.6" @@ -1232,12 +1262,12 @@ has-value@^1.0.0: has-values@^0.1.4: version "0.1.4" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-0.1.4.tgz#6d61de95d91dfca9b9a02089ad384bff8f62b771" + resolved "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz" integrity sha1-bWHeldkd/Km5oCCJrThL/49it3E= has-values@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/has-values/-/has-values-1.0.0.tgz#95b0b63fec2146619a6fe57fe75628d5a39efe4f" + resolved "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz" integrity sha1-lbC2P+whRmGab+V/51Yo1aOe/k8= dependencies: is-number "^3.0.0" @@ -1245,19 +1275,19 @@ has-values@^1.0.0: homedir-polyfill@^1.0.0, homedir-polyfill@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" + resolved "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz" integrity sha1-TCu8inWJmP7r9e1oWA921GdotLw= dependencies: parse-passwd "^1.0.0" "http-parser-js@>=0.4.0 <0.4.11": version "0.4.10" - resolved "https://registry.yarnpkg.com/http-parser-js/-/http-parser-js-0.4.10.tgz#92c9c1374c35085f75db359ec56cc257cbb93fa4" + resolved "https://registry.npmjs.org/http-parser-js/-/http-parser-js-0.4.10.tgz" integrity sha1-ksnBN0w1CF912zWexWzCV8u5P6Q= http-proxy-agent@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz#e4821beef5b2142a2026bd73926fe537631c5405" + resolved "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz" integrity sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg== dependencies: agent-base "4" @@ -1265,7 +1295,7 @@ http-proxy-agent@^2.1.0: https-proxy-agent@^2.2.1: version "2.2.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" + resolved "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz" integrity sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ== dependencies: agent-base "^4.1.0" @@ -1273,22 +1303,22 @@ https-proxy-agent@^2.2.1: hyperlinker@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/hyperlinker/-/hyperlinker-1.0.0.tgz#23dc9e38a206b208ee49bc2d6c8ef47027df0c0e" + resolved "https://registry.npmjs.org/hyperlinker/-/hyperlinker-1.0.0.tgz" integrity sha512-Ty8UblRWFEcfSuIaajM34LdPXIhbs1ajEX/BBPv24J+enSVaEVY63xQ6lTO9VRYS5LAoghIG0IDJ+p+IPzKUQQ== idb@3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/idb/-/idb-3.0.2.tgz#c8e9122d5ddd40f13b60ae665e4862f8b13fa384" + resolved "https://registry.npmjs.org/idb/-/idb-3.0.2.tgz" integrity sha512-+FLa/0sTXqyux0o6C+i2lOR0VoS60LU/jzUo5xjfY6+7sEEgy4Gz1O7yFBXvjd7N0NyIGWIRg8DcQSLEG+VSPw== immediate@~3.0.5: version "3.0.6" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b" + resolved "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz" integrity sha1-nbHb0Pr43m++D13V5Wu2BigN5ps= inflight@^1.0.4: version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + resolved "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz" integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" @@ -1296,55 +1326,55 @@ inflight@^1.0.4: inherits@2, inherits@~2.0.3: version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== ini@^1.3.5: version "1.3.5" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" + resolved "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz" integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== invert-kv@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" + resolved "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz" integrity sha1-EEqOSqym09jNFXqO+L+rLXo//bY= is-accessor-descriptor@^0.1.6: version "0.1.6" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + resolved "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz" integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= dependencies: kind-of "^3.0.2" is-accessor-descriptor@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + resolved "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz" integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== dependencies: kind-of "^6.0.0" is-buffer@^1.1.5: version "1.1.6" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== is-data-descriptor@^0.1.4: version "0.1.4" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + resolved "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz" integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= dependencies: kind-of "^3.0.2" is-data-descriptor@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + resolved "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz" integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== dependencies: kind-of "^6.0.0" is-descriptor@^0.1.0: version "0.1.6" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + resolved "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz" integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== dependencies: is-accessor-descriptor "^0.1.6" @@ -1353,7 +1383,7 @@ is-descriptor@^0.1.0: is-descriptor@^1.0.0, is-descriptor@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + resolved "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz" integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== dependencies: is-accessor-descriptor "^1.0.0" @@ -1362,94 +1392,87 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + resolved "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz" integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= is-extendable@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-1.0.1.tgz#a7470f9e426733d81bd81e1155264e3a3507cab4" + resolved "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz" integrity sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA== dependencies: is-plain-object "^2.0.4" is-fullwidth-code-point@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz" integrity sha1-754xOG8DGn8NZDr4L95QxFfvAMs= dependencies: number-is-nan "^1.0.0" is-fullwidth-code-point@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz" integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= is-fullwidth-code-point@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz" integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-number@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + resolved "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz" integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= dependencies: kind-of "^3.0.2" is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: version "2.0.4" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz" integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== dependencies: isobject "^3.0.1" -is-plain-object@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-3.0.0.tgz#47bfc5da1b5d50d64110806c199359482e75a928" - integrity sha512-tZIpofR+P05k8Aocp7UI/2UTa9lTJSebCXpFFoR9aibpokDj/uXBsJ8luUu0tTVYKkMU6URDUuOfJZ7koewXvg== - dependencies: - isobject "^4.0.0" +is-plain-object@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz" + integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q== is-stream@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" + resolved "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= is-windows@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + resolved "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== isarray@1.0.0, isarray@~1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" + resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= isexe@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= isobject@^2.0.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-2.1.0.tgz#f065561096a3f1da2ef46272f815c840d87e0c89" + resolved "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz" integrity sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk= dependencies: isarray "1.0.0" isobject@^3.0.0, isobject@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + resolved "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isobject@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" - integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== - jsome@^2.3.25: version "2.5.0" - resolved "https://registry.yarnpkg.com/jsome/-/jsome-2.5.0.tgz#5e417eef4341ffeb83ee8bfa9265b36d56fe49ed" + resolved "https://registry.npmjs.org/jsome/-/jsome-2.5.0.tgz" integrity sha1-XkF+70NB/+uD7ov6kmWzbVb+Se0= dependencies: chalk "^2.3.0" @@ -1458,24 +1481,24 @@ jsome@^2.3.25: json-stringify-safe@^5.0.1: version "5.0.1" - resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + resolved "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" integrity sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus= json5@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.0.tgz#e7a0c62c48285c628d20a10b85c89bb807c32850" + resolved "https://registry.npmjs.org/json5/-/json5-2.1.0.tgz" integrity sha512-8Mh9h6xViijj36g7Dxi+Y4S6hNGV96vcJZr/SrlHh1LR/pEn/8j/+qIBbs44YKl69Lrfctp4QD+AdWLTMqEZAQ== dependencies: minimist "^1.2.0" jsonpointer@^4.0.1: version "4.0.1" - resolved "https://registry.yarnpkg.com/jsonpointer/-/jsonpointer-4.0.1.tgz#4fd92cb34e0e9db3c89c8622ecf51f9b978c6cb9" + resolved "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz" integrity sha1-T9kss04OnbPInIYi7PUfm5eMbLk= jsonwebtoken@^8.4.0: version "8.4.0" - resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-8.4.0.tgz#8757f7b4cb7440d86d5e2f3becefa70536c8e46a" + resolved "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.4.0.tgz" integrity sha512-coyXjRTCy0pw5WYBpMvWOMN+Kjaik2MwTUIq9cna/W7NpO9E+iYbumZONAz3hcr+tXFJECoQVrtmIoC3Oz0gvg== dependencies: jws "^3.1.5" @@ -1490,7 +1513,7 @@ jsonwebtoken@^8.4.0: jszip@^3.5.0, jszip@^3.6.0: version "3.7.1" - resolved "https://registry.yarnpkg.com/jszip/-/jszip-3.7.1.tgz#bd63401221c15625a1228c556ca8a68da6fda3d9" + resolved "https://registry.npmjs.org/jszip/-/jszip-3.7.1.tgz" integrity sha512-ghL0tz1XG9ZEmRMcEN2vt7xabrDdqHHeykgARpmZ0BiIctWxM47Vt63ZO2dnp4QYt/xJVLLy5Zv1l/xRdh2byg== dependencies: lie "~3.3.0" @@ -1500,7 +1523,7 @@ jszip@^3.5.0, jszip@^3.6.0: jwa@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.2.0.tgz#606da70c1c6d425cad329c77c99f2df2a981489a" + resolved "https://registry.npmjs.org/jwa/-/jwa-1.2.0.tgz" integrity sha512-Grku9ZST5NNQ3hqNUodSkDfEBqAmGA1R8yiyPHOnLzEKI0GaCQC/XhFmsheXYuXzFQJdILbh+lYBiliqG5R/Vg== dependencies: buffer-equal-constant-time "1.0.1" @@ -1509,7 +1532,7 @@ jwa@^1.2.0: jws@^3.1.5: version "3.2.1" - resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.1.tgz#d79d4216a62c9afa0a3d5e8b5356d75abdeb2be5" + resolved "https://registry.npmjs.org/jws/-/jws-3.2.1.tgz" integrity sha512-bGA2omSrFUkd72dhh05bIAN832znP4wOU3lfuXtRBuGTbsmNmDXMQg28f0Vsxaxgk4myF5YkKQpz6qeRpMgX9g== dependencies: jwa "^1.2.0" @@ -1517,45 +1540,45 @@ jws@^3.1.5: kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0: version "3.2.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz" integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= dependencies: is-buffer "^1.1.5" kind-of@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-4.0.0.tgz#20813df3d712928b207378691a45066fae72dd57" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz" integrity sha1-IIE989cSkosgc3hpGkUGb65y3Vc= dependencies: is-buffer "^1.1.5" kind-of@^5.0.0: version "5.1.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz" integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== kind-of@^6.0.0, kind-of@^6.0.2: version "6.0.2" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz" integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== lcid@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835" + resolved "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz" integrity sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU= dependencies: invert-kv "^1.0.0" lie@~3.3.0: version "3.3.0" - resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" + resolved "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz" integrity sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ== dependencies: immediate "~3.0.5" locate-path@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-2.0.0.tgz#2b568b265eec944c6d9c0de9c3dbbbca0354cd8e" + resolved "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz" integrity sha1-K1aLJl7slExtnA3pw9u7ygNUzY4= dependencies: p-locate "^2.0.0" @@ -1563,134 +1586,129 @@ locate-path@^2.0.0: lodash.camelcase@^4.3.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" + resolved "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz" integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= lodash.find@^4.6.0: version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.find/-/lodash.find-4.6.0.tgz#cb0704d47ab71789ffa0de8b97dd926fb88b13b1" + resolved "https://registry.npmjs.org/lodash.find/-/lodash.find-4.6.0.tgz" integrity sha1-ywcE1Hq3F4n/oN6Ll92Sb7iLE7E= lodash.get@^4.4.2: version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" + resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= lodash.includes@^4.3.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" + resolved "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz" integrity sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8= lodash.isboolean@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" + resolved "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz" integrity sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY= lodash.isinteger@^4.0.4: version "4.0.4" - resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" + resolved "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz" integrity sha1-YZwK89A/iwTDH1iChAt3sRzWg0M= lodash.isnumber@^3.0.3: version "3.0.3" - resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" + resolved "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz" integrity sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w= lodash.isobject@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/lodash.isobject/-/lodash.isobject-3.0.2.tgz#3c8fb8d5b5bf4bf90ae06e14f2a530a4ed935e1d" + resolved "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz" integrity sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0= lodash.isplainobject@^4.0.6: version "4.0.6" - resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + resolved "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz" integrity sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs= lodash.isstring@^4.0.1: version "4.0.1" - resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + resolved "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz" integrity sha1-1SfftUVuynzJu5XV2ur4i6VKVFE= lodash.keys@^4.0.8: version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.keys/-/lodash.keys-4.2.0.tgz#a08602ac12e4fb83f91fc1fb7a360a4d9ba35205" + resolved "https://registry.npmjs.org/lodash.keys/-/lodash.keys-4.2.0.tgz" integrity sha1-oIYCrBLk+4P5H8H7ejYKTZujUgU= lodash.mapvalues@^4.6.0: version "4.6.0" - resolved "https://registry.yarnpkg.com/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz#1bafa5005de9dd6f4f26668c30ca37230cc9689c" + resolved "https://registry.npmjs.org/lodash.mapvalues/-/lodash.mapvalues-4.6.0.tgz" integrity sha1-G6+lAF3p3W9PJmaMMMo3IwzJaJw= lodash.memoize@^4.1.2: version "4.1.2" - resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" + resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= lodash.once@^4.0.0: version "4.1.1" - resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" + resolved "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz" integrity sha1-DdOXEhPHxW34gJd9UEyI+0cal6w= lodash.set@^4.3.2: version "4.3.2" - resolved "https://registry.yarnpkg.com/lodash.set/-/lodash.set-4.3.2.tgz#d8757b1da807dde24816b0d6a84bea1a76230b23" + resolved "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz" integrity sha1-2HV7HagH3eJIFrDWqEvqGnYjCyM= lodash.uniq@^4.5.0: version "4.5.0" - resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" + resolved "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz" integrity sha1-0CJTc662Uq3BvILklFM5qEJ1R3M= long@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" + resolved "https://registry.npmjs.org/long/-/long-4.0.0.tgz" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== lru-cache@^4.0.1: version "4.1.5" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + resolved "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz" integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== dependencies: pseudomap "^1.0.2" yallist "^2.1.2" -macos-release@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.0.0.tgz#7dddf4caf79001a851eb4fba7fb6034f251276ab" - integrity sha512-iCM3ZGeqIzlrH7KxYK+fphlJpCCczyHXc+HhRVbEu9uNTCrzYJjvvtefzeKTCVHd5AP/aD/fzC80JZ4ZP+dQ/A== - macos-release@^2.2.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/macos-release/-/macos-release-2.3.0.tgz#eb1930b036c0800adebccd5f17bc4c12de8bb71f" - integrity sha512-OHhSbtcviqMPt7yfw5ef5aghS2jzFVKEFyCJndQt2YpSQ9qRVSEv2axSJI1paVThEu+FFGs584h/1YhxjVqajA== + version "2.5.0" + resolved "https://registry.npmjs.org/macos-release/-/macos-release-2.5.0.tgz" + integrity sha512-EIgv+QZ9r+814gjJj0Bt5vSLJLzswGmSUbUpbi9AIr/fsN2IWFBl2NucV9PAiek+U1STK468tEkxmVYUtuAN3g== map-cache@^0.2.2: version "0.2.2" - resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" + resolved "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz" integrity sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8= map-visit@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + resolved "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz" integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= dependencies: object-visit "^1.0.0" mem@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/mem/-/mem-1.1.0.tgz#5edd52b485ca1d900fe64895505399a0dfa45f76" + resolved "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz" integrity sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y= dependencies: mimic-fn "^1.0.0" memfs-or-file-map-to-github-branch@^1.1.0: version "1.1.2" - resolved "https://registry.yarnpkg.com/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.1.2.tgz#9d46c02481b7eca8e5ee8a94f170b7e0138cad67" + resolved "https://registry.npmjs.org/memfs-or-file-map-to-github-branch/-/memfs-or-file-map-to-github-branch-1.1.2.tgz" integrity sha512-D2JKK2DTuVYQqquBWco3K6UfSVyVwmd58dgNqh+TgxHOZdTmR8I130gjMbVCkemDl/EzqDA62417cJxKL3/FFA== micromatch@^3.1.10: version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" + resolved "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz" integrity sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg== dependencies: arr-diff "^4.0.0" @@ -1709,24 +1727,24 @@ micromatch@^3.1.10: mimic-fn@^1.0.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" + resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz" integrity sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ== minimatch@^3.0.4: version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= mixin-deep@^1.2.0: version "1.3.1" - resolved "https://registry.yarnpkg.com/mixin-deep/-/mixin-deep-1.3.1.tgz#a49e7268dce1a0d9698e45326c5626df3543d0fe" + resolved "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz" integrity sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ== dependencies: for-in "^1.0.2" @@ -1734,17 +1752,17 @@ mixin-deep@^1.2.0: ms@2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + resolved "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz" integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= ms@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.1.tgz#30a5864eb3ebb0a66f2ebe6d727af06a09d86e0a" + resolved "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz" integrity sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg== nanomatch@^1.2.9: version "1.2.13" - resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" + resolved "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz" integrity sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA== dependencies: arr-diff "^4.0.0" @@ -1761,39 +1779,39 @@ nanomatch@^1.2.9: nice-try@^1.0.4: version "1.0.5" - resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366" + resolved "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz" integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ== node-cleanup@^2.1.2: version "2.1.2" - resolved "https://registry.yarnpkg.com/node-cleanup/-/node-cleanup-2.1.2.tgz#7ac19abd297e09a7f72a71545d951b517e4dde2c" + resolved "https://registry.npmjs.org/node-cleanup/-/node-cleanup-2.1.2.tgz" integrity sha1-esGavSl+Caf3KnFUXZUbUX5N3iw= -node-fetch@2.6.1: +node-fetch@2.6.1, node-fetch@^2.6.1: version "2.6.1" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw== node-fetch@^2.3.0: version "2.3.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5" + resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.3.0.tgz" integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA== npm-run-path@^2.0.0: version "2.0.2" - resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + resolved "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz" integrity sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8= dependencies: path-key "^2.0.0" number-is-nan@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" + resolved "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz" integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= object-copy@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + resolved "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz" integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= dependencies: copy-descriptor "^0.1.0" @@ -1802,50 +1820,42 @@ object-copy@^0.1.0: object-visit@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + resolved "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz" integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= dependencies: isobject "^3.0.0" object.pick@^1.3.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" + resolved "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz" integrity sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c= dependencies: isobject "^3.0.1" octokit-pagination-methods@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz#cf472edc9d551055f9ef73f6e42b4dbb4c80bea4" + resolved "https://registry.npmjs.org/octokit-pagination-methods/-/octokit-pagination-methods-1.1.0.tgz" integrity sha512-fZ4qZdQ2nxJvtcasX7Ghl+WlWS/d9IgnBIwFZXVNNZUmzpno91SX5bc5vuxiuKoCtK78XxGGNuSCrDC7xYB3OQ== -once@^1.3.0, once@^1.4.0: +once@^1.3.0, once@^1.3.1, once@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" os-locale@^2.0.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.1.0.tgz#42bc2900a6b5b8bd17376c8e882b65afccf24bf2" + resolved "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz" integrity sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA== dependencies: execa "^0.7.0" lcid "^1.0.0" mem "^1.1.0" -os-name@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/os-name/-/os-name-3.0.0.tgz#e1434dbfddb8e74b44c98b56797d951b7648a5d9" - integrity sha512-7c74tib2FsdFbQ3W+qj8Tyd1R3Z6tuVRNNxXjJcZ4NgjIEQU9N/prVMqcW29XZPXGACqaXN3jq58/6hoaoXH6g== - dependencies: - macos-release "^2.0.0" - windows-release "^3.1.0" - os-name@^3.1.0: version "3.1.0" - resolved "https://registry.yarnpkg.com/os-name/-/os-name-3.1.0.tgz#dec19d966296e1cd62d701a5a66ee1ddeae70801" + resolved "https://registry.npmjs.org/os-name/-/os-name-3.1.0.tgz" integrity sha512-h8L+8aNjNcMpo/mAIBPn5PXCM16iyPGjHNWo6U1YO8sJTMHtEtyczI6QJnLoplswm6goopQkqc7OAnjhWcugVg== dependencies: macos-release "^2.2.0" @@ -1853,58 +1863,58 @@ os-name@^3.1.0: override-require@^1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/override-require/-/override-require-1.1.1.tgz#6ae22fadeb1f850ffb0cf4c20ff7b87e5eb650df" + resolved "https://registry.npmjs.org/override-require/-/override-require-1.1.1.tgz" integrity sha1-auIvresfhQ/7DPTCD/e4fl62UN8= p-finally@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + resolved "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= p-limit@^1.1.0: version "1.3.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz" integrity sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q== dependencies: p-try "^1.0.0" p-limit@^2.1.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.1.0.tgz#1d5a0d20fb12707c758a655f6bbc4386b5930d68" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.1.0.tgz" integrity sha512-NhURkNcrVB+8hNfLuysU8enY5xn2KXphsHBaC2YmRNTZRc7RWusw6apSpdEj3jo4CMb6W9nrF6tTnsJsJeyu6g== dependencies: p-try "^2.0.0" p-locate@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43" + resolved "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz" integrity sha1-IKAQOyIqcMj9OcwuWAaA893l7EM= dependencies: p-limit "^1.1.0" p-try@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" + resolved "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz" integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M= p-try@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.0.0.tgz#85080bb87c64688fa47996fe8f7dfbe8211760b1" + resolved "https://registry.npmjs.org/p-try/-/p-try-2.0.0.tgz" integrity sha512-hMp0onDKIajHfIkdRk3P4CdCmErkYAxxDtP3Wx/4nZ3aGlau2VKh3mZpcuFkH27WQkL/3WBCPOktzA9ZOAnMQQ== pako@~1.0.2: version "1.0.11" - resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" + resolved "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz" integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== parse-diff@^0.5.1: version "0.5.1" - resolved "https://registry.yarnpkg.com/parse-diff/-/parse-diff-0.5.1.tgz#18b3e82a0765ac1c8796e3854e475073a691c4fb" + resolved "https://registry.npmjs.org/parse-diff/-/parse-diff-0.5.1.tgz" integrity sha512-/qXjo9x/pFa5bVk/ZXaJD0yr3Tf3Yp6MWWMr4vnUmumDrE0yoE6YDH2A8vmcCD/Ko3tW2o0X+zGYh2zMLXshsg== parse-git-config@^2.0.3: version "2.0.3" - resolved "https://registry.yarnpkg.com/parse-git-config/-/parse-git-config-2.0.3.tgz#6fb840d4a956e28b971c97b33a5deb73a6d5b6bb" + resolved "https://registry.npmjs.org/parse-git-config/-/parse-git-config-2.0.3.tgz" integrity sha512-Js7ueMZOVSZ3tP8C7E3KZiHv6QQl7lnJ+OkbxoaFazzSa2KyEHqApfGbU3XboUgUnq4ZuUmskUpYKTNx01fm5A== dependencies: expand-tilde "^2.0.2" @@ -1913,64 +1923,64 @@ parse-git-config@^2.0.3: parse-github-url@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/parse-github-url/-/parse-github-url-1.0.2.tgz#242d3b65cbcdda14bb50439e3242acf6971db395" + resolved "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz" integrity sha512-kgBf6avCbO3Cn6+RnzRGLkUsv4ZVqv/VfAYkRsyBcgkshNvVBkRn1FEZcW0Jb+npXQWm2vHPnnOqFteZxRRGNw== parse-link-header@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/parse-link-header/-/parse-link-header-1.0.1.tgz#bedfe0d2118aeb84be75e7b025419ec8a61140a7" + resolved "https://registry.npmjs.org/parse-link-header/-/parse-link-header-1.0.1.tgz" integrity sha1-vt/g0hGK64S+deewJUGeyKYRQKc= dependencies: xtend "~4.0.1" parse-passwd@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" + resolved "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz" integrity sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY= pascalcase@^0.1.1: version "0.1.1" - resolved "https://registry.yarnpkg.com/pascalcase/-/pascalcase-0.1.1.tgz#b363e55e8006ca6fe21784d2db22bd15d7917f14" + resolved "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz" integrity sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ= path-exists@^3.0.0: version "3.0.0" - resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" + resolved "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz" integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= path-is-absolute@^1.0.0: version "1.0.1" - resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" + resolved "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" - resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + resolved "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= pinpoint@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/pinpoint/-/pinpoint-1.1.0.tgz#0cf7757a6977f1bf7f6a32207b709e377388e874" + resolved "https://registry.npmjs.org/pinpoint/-/pinpoint-1.1.0.tgz" integrity sha1-DPd1eml38b9/ajIge3CeN3OI6HQ= posix-character-classes@^0.1.0: version "0.1.1" - resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab" + resolved "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz" integrity sha1-AerA/jta9xoqbAL+q7jB/vfgDqs= process-nextick-args@~2.0.0: version "2.0.1" - resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" + resolved "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== promise-polyfill@8.1.3: version "8.1.3" - resolved "https://registry.yarnpkg.com/promise-polyfill/-/promise-polyfill-8.1.3.tgz#8c99b3cf53f3a91c68226ffde7bde81d7f904116" + resolved "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.1.3.tgz" integrity sha512-MG5r82wBzh7pSKDRa9y+vllNHz3e3d4CNj1PQE4BQYxLme0gKYYBm9YENq+UkEikyZ0XbiGWxYlVw3Rl9O/U8g== protobufjs@^6.10.0: version "6.11.2" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz" integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw== dependencies: "@protobufjs/aspromise" "^1.1.2" @@ -1989,12 +1999,20 @@ protobufjs@^6.10.0: pseudomap@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + resolved "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz" integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + readable-stream@~2.3.6: version "2.3.7" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.7.tgz#1eca1cf711aef814c04f62252a36a62f6cb23b57" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== dependencies: core-util-is "~1.0.0" @@ -2007,17 +2025,17 @@ readable-stream@~2.3.6: readline-sync@^1.4.9: version "1.4.9" - resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.9.tgz#3eda8e65f23cd2a17e61301b1f0003396af5ecda" + resolved "https://registry.npmjs.org/readline-sync/-/readline-sync-1.4.9.tgz" integrity sha1-PtqOZfI80qF+YTAbHwADOWr17No= regenerator-runtime@^0.12.0: version "0.12.1" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz#fa1a71544764c036f8c49b13a08b2594c9f8a0de" + resolved "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.12.1.tgz" integrity sha512-odxIc1/vDlo4iZcfXqRYFj0vpXFNoGdKMAUieAlFYO6m/nl5e9KR/beGf41z4a1FI+aQgtjhuaSlDxQ0hmkrHg== regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" - resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" + resolved "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz" integrity sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A== dependencies: extend-shallow "^3.0.2" @@ -2025,78 +2043,78 @@ regex-not@^1.0.0, regex-not@^1.0.2: repeat-element@^1.1.2: version "1.1.3" - resolved "https://registry.yarnpkg.com/repeat-element/-/repeat-element-1.1.3.tgz#782e0d825c0c5a3bb39731f84efee6b742e6b1ce" + resolved "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz" integrity sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g== repeat-string@^1.6.1: version "1.6.1" - resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" + resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= require-directory@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + resolved "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz" integrity sha1-jGStX9MNqxyXbiNE/+f3kqam30I= require-from-string@^2.0.2: version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + resolved "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz" integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== require-main-filename@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-1.0.1.tgz#97f717b69d48784f5f526a6c5aa8ffdda055a4d1" + resolved "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz" integrity sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE= resolve-url@^0.2.1: version "0.2.1" - resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" + resolved "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= ret@~0.1.10: version "0.1.15" - resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" + resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz" integrity sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg== rfc6902@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/rfc6902/-/rfc6902-3.0.1.tgz#03a3d38329dbc266fbc92aa7fc14546d7839e89f" + resolved "https://registry.npmjs.org/rfc6902/-/rfc6902-3.0.1.tgz" integrity sha512-a4t5OlaOgAejBg48/lkyQMcV6EWpljjSjmXAtSXLhw83x1OhlcVGLMLf//GoUSpHsWt8x/7oxaf5FEGM9QH/iQ== rimraf@^2.7.1: version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== dependencies: glob "^7.1.3" rimraf@^3.0.0, rimraf@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + resolved "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" safe-buffer@>=5.1.0: version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz" integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== safe-buffer@^5.0.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" + resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== safe-regex@^1.1.0: version "1.1.0" - resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" + resolved "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz" integrity sha1-QKNmnzsHfR6UPURinhV91IAjvy4= dependencies: ret "~0.1.10" selenium-webdriver@4.0.0-beta.1: version "4.0.0-beta.1" - resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.0.0-beta.1.tgz#db645b0d775f26e4e12235db05796a1bc1e7efda" + resolved "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-beta.1.tgz" integrity sha512-DJ10z6Yk+ZBaLrt1CLElytQ/FOayx29ANKDtmtyW1A6kCJx3+dsc5fFMOZxwzukDniyYsC3OObT5pUAsgkjpxQ== dependencies: jszip "^3.5.0" @@ -2106,7 +2124,7 @@ selenium-webdriver@4.0.0-beta.1: selenium-webdriver@^4.0.0-beta.2: version "4.0.0-rc-1" - resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-4.0.0-rc-1.tgz#b1e7e5821298c8a071e988518dd6b759f0c41281" + resolved "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-4.0.0-rc-1.tgz" integrity sha512-bcrwFPRax8fifRP60p7xkWDGSJJoMkPAzufMlk5K2NyLPht/YZzR2WcIk1+3gR8VOCLlst1P2PI+MXACaFzpIw== dependencies: jszip "^3.6.0" @@ -2115,23 +2133,23 @@ selenium-webdriver@^4.0.0-beta.2: ws ">=7.4.6" semver@^5.5.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004" - integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg== + version "5.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== set-blocking@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" + resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= set-immediate-shim@~1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz#4b2b1b27eb808a9f8dcc481a58e5e56f599f3f61" + resolved "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz" integrity sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E= set-value@^0.4.3: version "0.4.3" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-0.4.3.tgz#7db08f9d3d22dc7f78e53af3c3bf4666ecdfccf1" + resolved "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz" integrity sha1-fbCPnT0i3H945Trzw79GZuzfzPE= dependencies: extend-shallow "^2.0.1" @@ -2141,7 +2159,7 @@ set-value@^0.4.3: set-value@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/set-value/-/set-value-2.0.0.tgz#71ae4a88f0feefbbf52d1ea604f3fb315ebb6274" + resolved "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz" integrity sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg== dependencies: extend-shallow "^2.0.1" @@ -2151,24 +2169,24 @@ set-value@^2.0.0: shebang-command@^1.2.0: version "1.2.0" - resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + resolved "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz" integrity sha1-RKrGW2lbAzmJaMOfNj/uXer98eo= dependencies: shebang-regex "^1.0.0" shebang-regex@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz" integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM= signal-exit@^3.0.0: version "3.0.2" - resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz" integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= snapdragon-node@^2.0.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b" + resolved "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz" integrity sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw== dependencies: define-property "^1.0.0" @@ -2177,14 +2195,14 @@ snapdragon-node@^2.0.1: snapdragon-util@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/snapdragon-util/-/snapdragon-util-3.0.1.tgz#f956479486f2acd79700693f6f7b805e45ab56e2" + resolved "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz" integrity sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ== dependencies: kind-of "^3.2.0" snapdragon@^0.8.1: version "0.8.2" - resolved "https://registry.yarnpkg.com/snapdragon/-/snapdragon-0.8.2.tgz#64922e7c565b0e14204ba1aa7d6964278d25182d" + resolved "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz" integrity sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg== dependencies: base "^0.11.1" @@ -2198,7 +2216,7 @@ snapdragon@^0.8.1: source-map-resolve@^0.5.0: version "0.5.2" - resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.2.tgz#72e2cc34095543e43b2c62b2c4c10d4a9054f259" + resolved "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz" integrity sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA== dependencies: atob "^2.1.1" @@ -2209,24 +2227,24 @@ source-map-resolve@^0.5.0: source-map-url@^0.4.0: version "0.4.0" - resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.0.tgz#3e935d7ddd73631b97659956d55128e87b5084a3" + resolved "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz" integrity sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM= source-map@^0.5.6: version "0.5.7" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" + resolved "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz" integrity sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w= split-string@^3.0.1, split-string@^3.0.2: version "3.1.0" - resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2" + resolved "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz" integrity sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw== dependencies: extend-shallow "^3.0.0" static-extend@^0.1.1: version "0.1.2" - resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + resolved "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz" integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= dependencies: define-property "^0.2.5" @@ -2234,7 +2252,7 @@ static-extend@^0.1.1: string-width@^1.0.1: version "1.0.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3" + resolved "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz" integrity sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M= dependencies: code-point-at "^1.0.0" @@ -2243,7 +2261,7 @@ string-width@^1.0.1: string-width@^2.0.0, string-width@^2.1.1: version "2.1.1" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + resolved "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz" integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== dependencies: is-fullwidth-code-point "^2.0.0" @@ -2251,7 +2269,7 @@ string-width@^2.0.0, string-width@^2.1.1: string-width@^4.1.0, string-width@^4.2.0: version "4.2.2" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.2.tgz#dafd4f9559a7585cfba529c6a0a4f73488ebd4c5" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz" integrity sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA== dependencies: emoji-regex "^8.0.0" @@ -2260,47 +2278,47 @@ string-width@^4.1.0, string-width@^4.2.0: string_decoder@~1.1.1: version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" + resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz" integrity sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg== dependencies: safe-buffer "~5.1.0" strip-ansi@^3.0.0, strip-ansi@^3.0.1: version "3.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz" integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= dependencies: ansi-regex "^2.0.0" strip-ansi@^4.0.0: version "4.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz" integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= dependencies: ansi-regex "^3.0.0" strip-ansi@^6.0.0: version "6.0.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz" integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== dependencies: ansi-regex "^5.0.0" strip-eof@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + resolved "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= supports-color@^5.0.0, supports-color@^5.3.0: version "5.5.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" + resolved "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz" integrity sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow== dependencies: has-flag "^3.0.0" supports-hyperlinks@^1.0.1: version "1.0.1" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-1.0.1.tgz#71daedf36cc1060ac5100c351bb3da48c29c0ef7" + resolved "https://registry.npmjs.org/supports-hyperlinks/-/supports-hyperlinks-1.0.1.tgz" integrity sha512-HHi5kVSefKaJkGYXbDuKbUGRVxqnWGn3J2e39CYcNJEfWciGq2zYtOhXLTlvrOZW1QU7VX67w7fMmWafHX9Pfw== dependencies: has-flag "^2.0.0" @@ -2308,21 +2326,21 @@ supports-hyperlinks@^1.0.1: tmp@^0.2.1: version "0.2.1" - resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" + resolved "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz" integrity sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ== dependencies: rimraf "^3.0.0" to-object-path@^0.3.0: version "0.3.0" - resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + resolved "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz" integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= dependencies: kind-of "^3.0.2" to-regex-range@^2.1.0: version "2.1.1" - resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-2.1.1.tgz#7c80c17b9dfebe599e27367e0d4dd5590141db38" + resolved "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz" integrity sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg= dependencies: is-number "^3.0.0" @@ -2330,7 +2348,7 @@ to-regex-range@^2.1.0: to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" - resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" + resolved "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz" integrity sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw== dependencies: define-property "^2.0.2" @@ -2340,12 +2358,12 @@ to-regex@^3.0.1, to-regex@^3.0.2: tslib@^2.1.0: version "2.3.1" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" + resolved "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz" integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== union-value@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" + resolved "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz" integrity sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ= dependencies: arr-union "^3.1.0" @@ -2353,23 +2371,21 @@ union-value@^1.0.0: is-extendable "^0.1.1" set-value "^0.4.3" -universal-user-agent@^2.0.0, universal-user-agent@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-2.0.3.tgz#9f6f09f9cc33de867bb720d84c08069b14937c6c" - integrity sha512-eRHEHhChCBHrZsA4WEhdgiOKgdvgrMIHwnwnqD0r5C6AO8kwKcG7qSku3iXdhvHL3YvsS9ZkSGN8h/hIpoFC8g== - dependencies: - os-name "^3.0.0" - universal-user-agent@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-4.0.0.tgz#27da2ec87e32769619f68a14996465ea1cb9df16" - integrity sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA== + version "4.0.1" + resolved "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.1.tgz" + integrity sha512-LnST3ebHwVL2aNe4mejI9IQh2HfZ1RLo8Io2HugSif8ekzD1TlWpHpColOB/eh8JHMLkGH3Akqf040I+4ylNxg== dependencies: os-name "^3.1.0" +universal-user-agent@^6.0.0: + version "6.0.0" + resolved "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz" + integrity sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w== + unset-value@^1.0.0: version "1.0.0" - resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-1.0.0.tgz#8376873f7d2335179ffb1e6fc3a8ed0dfc8ab559" + resolved "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz" integrity sha1-g3aHP30jNRef+x5vw6jtDfyKtVk= dependencies: has-value "^0.3.1" @@ -2377,27 +2393,22 @@ unset-value@^1.0.0: urix@^0.1.0: version "0.1.0" - resolved "https://registry.yarnpkg.com/urix/-/urix-0.1.0.tgz#da937f7a62e21fec1fd18d49b35c2935067a6c72" + resolved "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz" integrity sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI= -url-template@^2.0.8: - version "2.0.8" - resolved "https://registry.yarnpkg.com/url-template/-/url-template-2.0.8.tgz#fc565a3cccbff7730c775f5641f9555791439f21" - integrity sha1-/FZaPMy/93MMd19WQflVV5FDnyE= - use@^3.1.0: version "3.1.1" - resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f" + resolved "https://registry.npmjs.org/use/-/use-3.1.1.tgz" integrity sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ== util-deprecate@~1.0.1: version "1.0.2" - resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + resolved "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= websocket-driver@>=0.5.1: version "0.7.3" - resolved "https://registry.yarnpkg.com/websocket-driver/-/websocket-driver-0.7.3.tgz#a2d4e0d4f4f116f1e6297eba58b05d430100e9f9" + resolved "https://registry.npmjs.org/websocket-driver/-/websocket-driver-0.7.3.tgz" integrity sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg== dependencies: http-parser-js ">=0.4.0 <0.4.11" @@ -2406,36 +2417,36 @@ websocket-driver@>=0.5.1: websocket-extensions@>=0.1.1: version "0.1.3" - resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" + resolved "https://registry.npmjs.org/websocket-extensions/-/websocket-extensions-0.1.3.tgz" integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== whatwg-fetch@2.0.4: version "2.0.4" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" + resolved "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz" integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== which-module@^2.0.0: version "2.0.0" - resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" + resolved "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= which@^1.2.9: version "1.3.1" - resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" + resolved "https://registry.npmjs.org/which/-/which-1.3.1.tgz" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== dependencies: isexe "^2.0.0" windows-release@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/windows-release/-/windows-release-3.1.0.tgz#8d4a7e266cbf5a233f6c717dac19ce00af36e12e" - integrity sha512-hBb7m7acFgQPQc222uEQTmdcGLeBmQLNLFIh0rDk3CwFOBrfjefLzEfEfmpMq8Af/n/GnFf3eYf203FY1PmudA== + version "3.3.3" + resolved "https://registry.npmjs.org/windows-release/-/windows-release-3.3.3.tgz" + integrity sha512-OSOGH1QYiW5yVor9TtmXKQvt2vjQqbYS+DqmsZw+r7xDwLXEeT3JGW0ZppFmHx4diyXmxt238KFR3N9jzevBRg== dependencies: - execa "^0.10.0" + execa "^1.0.0" wrap-ansi@^2.0.0: version "2.1.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz" integrity sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU= dependencies: string-width "^1.0.1" @@ -2443,7 +2454,7 @@ wrap-ansi@^2.0.0: wrap-ansi@^7.0.0: version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== dependencies: ansi-styles "^4.0.0" @@ -2452,54 +2463,54 @@ wrap-ansi@^7.0.0: wrappy@1: version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= ws@>=7.4.6: version "8.2.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.2.2.tgz#ca684330c6dd6076a737250ed81ac1606cb0a63e" + resolved "https://registry.npmjs.org/ws/-/ws-8.2.2.tgz" integrity sha512-Q6B6H2oc8QY3llc3cB8kVmQ6pnJWVQbP7Q5algTcIxx7YEpc0oU4NBVHlztA7Ekzfhw2r0rPducMUiCGWKQRzw== ws@^7.3.1: version "7.5.5" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.5.tgz#8b4bc4af518cfabd0473ae4f99144287b33eb881" + resolved "https://registry.npmjs.org/ws/-/ws-7.5.5.tgz" integrity sha512-BAkMFcAzl8as1G/hArkxOxq3G7pjUqQ3gzYbLL0/5zNkph70e+lCoxBGnm6AW1+/aiNeV4fnKqZ8m4GZewmH2w== xtend@~4.0.1: version "4.0.1" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" + resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz" integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68= y18n@^3.2.1: version "3.2.1" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41" + resolved "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz" integrity sha1-bRX7qITAhnnA136I53WegR4H+kE= y18n@^5.0.5: version "5.0.8" - resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== yallist@^2.1.2: version "2.1.2" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + resolved "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= yargs-parser@^20.2.2: version "20.2.9" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== yargs-parser@^9.0.2: version "9.0.2" - resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-9.0.2.tgz#9ccf6a43460fe4ed40a9bb68f48d43b8a68cc077" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz" integrity sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc= dependencies: camelcase "^4.1.0" yargs@^11.0.0: version "11.1.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-11.1.0.tgz#90b869934ed6e871115ea2ff58b03f4724ed2d77" + resolved "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz" integrity sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A== dependencies: cliui "^4.0.0" @@ -2517,7 +2528,7 @@ yargs@^11.0.0: yargs@^16.1.1: version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== dependencies: cliui "^7.0.2" diff --git a/build.gradle.kts b/build.gradle.kts index dbe8e69b2d61..4725963eae00 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,13 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +val ndkPath by extra(System.getenv("ANDROID_NDK")) +val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION")) + buildscript { repositories { google() @@ -12,8 +15,8 @@ buildscript { } dependencies { val kotlin_version: String by project - classpath("com.android.tools.build:gradle:4.2.2") - classpath("de.undercouch:gradle-download-task:4.1.1") + classpath("com.android.tools.build:gradle:7.0.4") + classpath("de.undercouch:gradle-download-task:4.1.2") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -25,11 +28,6 @@ allprojects { maven { url = uri("$rootDir/node_modules/jsc-android/dist") } - maven { - // https://github.com/wix/Detox/blob/master/docs/Introduction.Android.md - // All of Detox's artifacts are provided via the npm module - url = uri("$rootDir/node_modules/detox/Detox-android") - } google() mavenCentral { // We don't want to fetch react-native from Maven Central as there are @@ -39,11 +37,17 @@ allprojects { } } } +} - // used to override ndk path/version from env variables on CI - ext["ANDROID_NDK_PATH"] = null - if (System.getenv("LOCAL_ANDROID_NDK_VERSION") != null) { - setProperty("ANDROID_NDK_VERSION", System.getenv("LOCAL_ANDROID_NDK_VERSION")) - ext["ANDROID_NDK_PATH"] = System.getenv("ANDROID_NDK") - } +tasks.register("cleanAll", Delete::class.java) { + description = "Remove all the build files and intermediate build outputs" + dependsOn(gradle.includedBuild("react-native-gradle-plugin").task(":clean")) + delete(allprojects.map { it.buildDir }) + delete(rootProject.file("./ReactAndroid/.cxx")) + delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/arm64-v8a/")) + delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/")) + delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/x86/")) + delete(rootProject.file("./ReactAndroid/src/main/jni/prebuilt/lib/x86_64/")) + delete(rootProject.file("./packages/react-native-codegen/lib")) + delete(rootProject.file("./packages/rn-tester/android/app/.cxx")) } diff --git a/cli.js b/cli.js index 7e2f49a76089..609c8498e5c6 100755 --- a/cli.js +++ b/cli.js @@ -1,6 +1,6 @@ #!/usr/bin/env node /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow-typed/npm/glob_v7.x.x.js b/flow-typed/npm/glob_v7.x.x.js new file mode 100644 index 000000000000..4bd3df6cb984 --- /dev/null +++ b/flow-typed/npm/glob_v7.x.x.js @@ -0,0 +1,79 @@ +// flow-typed signature: d2a519d7d007e9ba3e5bf2ac3ff76eca +// flow-typed version: f243e51ed7/glob_v7.x.x/flow_>=v0.104.x + +declare module "glob" { + declare type MinimatchOptions = {| + debug?: boolean, + nobrace?: boolean, + noglobstar?: boolean, + dot?: boolean, + noext?: boolean, + nocase?: boolean, + nonull?: boolean, + matchBase?: boolean, + nocomment?: boolean, + nonegate?: boolean, + flipNegate?: boolean + |}; + + declare type Options = {| + ...MinimatchOptions, + cwd?: string, + root?: string, + nomount?: boolean, + mark?: boolean, + nosort?: boolean, + stat?: boolean, + silent?: boolean, + strict?: boolean, + cache?: { [path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray, ... }, + statCache?: { [path: string]: boolean | { isDirectory(): boolean, ... } | void, ... }, + symlinks?: { [path: string]: boolean | void, ... }, + realpathCache?: { [path: string]: string, ... }, + sync?: boolean, + nounique?: boolean, + nodir?: boolean, + ignore?: string | $ReadOnlyArray, + follow?: boolean, + realpath?: boolean, + absolute?: boolean + |}; + + /** + * Called when an error occurs, or matches are found + * err + * matches: filenames found matching the pattern + */ + declare type CallBack = (err: ?Error, matches: Array) => void; + + declare class Glob extends events$EventEmitter { + constructor(pattern: string): this; + constructor(pattern: string, callback: CallBack): this; + constructor(pattern: string, options: Options, callback: CallBack): this; + + minimatch: {...}; + options: Options; + aborted: boolean; + cache: { [path: string]: boolean | "DIR" | "FILE" | $ReadOnlyArray, ... }; + statCache: { [path: string]: boolean | { isDirectory(): boolean, ... } | void, ... }; + symlinks: { [path: string]: boolean | void, ... }; + realpathCache: { [path: string]: string, ... }; + found: Array; + + pause(): void; + resume(): void; + abort(): void; + } + + declare class GlobModule { + Glob: Class; + + (pattern: string, callback: CallBack): void; + (pattern: string, options: Options, callback: CallBack): void; + + hasMagic(pattern: string, options?: Options): boolean; + sync(pattern: string, options?: Options): Array; + } + + declare module.exports: GlobModule; +} diff --git a/flow-typed/npm/prop-types_v15.x.x.js b/flow-typed/npm/prop-types_v15.x.x.js deleted file mode 100644 index f5f6dba9e238..000000000000 --- a/flow-typed/npm/prop-types_v15.x.x.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @flow strict - * @nolint - * @format - */ - -// flow-typed signature: d9a983bb1ac458a256c31c139047bdbb -// flow-typed version: 927687984d/prop-types_v15.x.x/flow_>=v0.41.x - -type $npm$propTypes$ReactPropsCheckType = ( - props: any, - propName: string, - componentName: string, - href?: string, -) => ?Error; - -declare module 'prop-types' { - declare var array: React$PropType$Primitive>; - declare var bool: React$PropType$Primitive; - declare var func: React$PropType$Primitive; - declare var number: React$PropType$Primitive; - declare var object: React$PropType$Primitive; - declare var string: React$PropType$Primitive; - declare var symbol: React$PropType$Primitive; - declare var any: React$PropType$Primitive; - declare var arrayOf: React$PropType$ArrayOf; - declare var element: React$PropType$Primitive; /* TODO */ - declare var instanceOf: React$PropType$InstanceOf; - declare var node: React$PropType$Primitive; /* TODO */ - declare var objectOf: React$PropType$ObjectOf; - declare var oneOf: React$PropType$OneOf; - declare var oneOfType: React$PropType$OneOfType; - declare var shape: React$PropType$Shape; - - declare function checkPropTypes( - propTypes: {[_: $Keys]: $npm$propTypes$ReactPropsCheckType, ...}, - values: V, - location: string, - componentName: string, - getStack: ?() => ?string, - ): void; -} diff --git a/flow/HermesInternalType.js b/flow/HermesInternalType.js index c9d11b1d0f56..134adf9c2cb4 100644 --- a/flow/HermesInternalType.js +++ b/flow/HermesInternalType.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow/Position.js b/flow/Position.js index b831a3d2097f..eb94b2af67b8 100644 --- a/flow/Position.js +++ b/flow/Position.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow/Promise.js b/flow/Promise.js index 85d70bd41bae..05d7e42af6f0 100644 --- a/flow/Promise.js +++ b/flow/Promise.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow/Stringish.js b/flow/Stringish.js index 4fbf0e785326..3c0eb61f8cca 100644 --- a/flow/Stringish.js +++ b/flow/Stringish.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow/console.js b/flow/console.js index a3c431bc7bac..10f3d30ce210 100644 --- a/flow/console.js +++ b/flow/console.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow/global.js b/flow/global.js index b2e76fe8d232..ee60a57fdb03 100644 --- a/flow/global.js +++ b/flow/global.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -49,11 +49,7 @@ declare var global: { +requestIdleCallback: typeof requestIdleCallback, +cancelIdleCallback: typeof cancelIdleCallback, +setTimeout: typeof setTimeout, - // TODO(T97509743): use `typeof` when the next Flow release is available. - +queueMicrotask: >( - jobCallback: (...args: TArguments) => mixed, - ) => void, - + +queueMicrotask: typeof queueMicrotask, +console: typeof console, // JavaScript environments specific diff --git a/flow/jest.js b/flow/jest.js index 69cc3f500899..8f5621169616 100644 --- a/flow/jest.js +++ b/flow/jest.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/flow/use-subscription.js b/flow/use-subscription.js index 4b555c3b60e2..fa7ef61ed118 100644 --- a/flow/use-subscription.js +++ b/flow/use-subscription.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/gradle.properties b/gradle.properties index 4d0bece201bd..d8559b0b86ab 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,13 @@ # This is causing issue with dependencies task: https://github.com/gradle/gradle/issues/9645#issuecomment-530746758 # org.gradle.configureondemand=true org.gradle.daemon=true -org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8 org.gradle.parallel=true -ANDROID_NDK_VERSION=21.4.7075529 android.useAndroidX=true -kotlin_version=1.5.31 +kotlin_version=1.6.10 + +# Use this property to specify which architecture you want to build. +# You can also override it from the CLI using +# ./gradlew -PreactNativeArchitectures=x86_64 +reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec..7454180f2ae8 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 a0f7639f7d36..669386b870a6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4f906e0c811f..1b6c787337ff 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # 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" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# 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 +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/index.js b/index.js index 7ce52d8a4603..e594bbeb9635 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -97,12 +97,6 @@ import typeof RCTDeviceEventEmitter from './Libraries/EventEmitter/RCTDeviceEven import typeof RCTNativeAppEventEmitter from './Libraries/EventEmitter/RCTNativeAppEventEmitter'; import typeof {RootTagContext} from './Libraries/ReactNative/RootTag'; -// Prop Types -import typeof DeprecatedColorPropType from './Libraries/DeprecatedPropTypes/DeprecatedColorPropType'; -import typeof DeprecatedEdgeInsetsPropType from './Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'; -import typeof DeprecatedPointPropType from './Libraries/DeprecatedPropTypes/DeprecatedPointPropType'; -import typeof DeprecatedViewPropTypes from './Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes'; - import type {HostComponent as _HostComponentInternal} from './Libraries/Renderer/shims/ReactNativeTypes'; export type HostComponent = _HostComponentInternal; @@ -450,19 +444,34 @@ module.exports = { 'LogBox is enabled by default so there is no need to call unstable_enableLogBox() anymore. This is a no op and will be removed in the next version.', ); }, - // Prop Types - // $FlowFixMe[value-as-type] - get ColorPropType(): DeprecatedColorPropType { - return require('./Libraries/DeprecatedPropTypes/DeprecatedColorPropType'); + // Deprecated Prop Types + get ColorPropType(): $FlowFixMe { + console.warn( + 'ColorPropType will be removed from React Native. Migrate to ' + + "ColorPropType exported from 'deprecated-react-native-prop-types'.", + ); + return require('deprecated-react-native-prop-types').ColorPropType; }, - get EdgeInsetsPropType(): DeprecatedEdgeInsetsPropType { - return require('./Libraries/DeprecatedPropTypes/DeprecatedEdgeInsetsPropType'); + get EdgeInsetsPropType(): $FlowFixMe { + console.warn( + 'EdgeInsetsPropType will be removed from React Native. Migrate to ' + + "EdgeInsetsPropType exported from 'deprecated-react-native-prop-types'.", + ); + return require('deprecated-react-native-prop-types').EdgeInsetsPropType; }, - get PointPropType(): DeprecatedPointPropType { - return require('./Libraries/DeprecatedPropTypes/DeprecatedPointPropType'); + get PointPropType(): $FlowFixMe { + console.warn( + 'PointPropType will be removed from React Native. Migrate to ' + + "PointPropType exported from 'deprecated-react-native-prop-types'.", + ); + return require('deprecated-react-native-prop-types').PointPropType; }, - get ViewPropTypes(): DeprecatedViewPropTypes { - return require('./Libraries/DeprecatedPropTypes/DeprecatedViewPropTypes'); + get ViewPropTypes(): $FlowFixMe { + console.warn( + 'ViewPropTypes will be removed from React Native. Migrate to ' + + "ViewPropTypes exported from 'deprecated-react-native-prop-types'.", + ); + return require('deprecated-react-native-prop-types').ViewPropTypes; }, }; diff --git a/interface.js b/interface.js index 22337a98731b..85325036dcf4 100644 --- a/interface.js +++ b/interface.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest-preset.js b/jest-preset.js index b5554b8f5f65..e49c4062687e 100644 --- a/jest-preset.js +++ b/jest-preset.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest.config.js b/jest.config.js index eb798365a938..f16bd6be0ec8 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest/MockNativeMethods.js b/jest/MockNativeMethods.js index f37fcd34c87b..c0917b7f3a74 100644 --- a/jest/MockNativeMethods.js +++ b/jest/MockNativeMethods.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest/assetFileTransformer.js b/jest/assetFileTransformer.js index 03b018ffb7c0..b73579601cea 100644 --- a/jest/assetFileTransformer.js +++ b/jest/assetFileTransformer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,8 +12,8 @@ /* eslint-env node */ const path = require('path'); -const createCacheKeyFunction = require('@jest/create-cache-key-function') - .default; +const createCacheKeyFunction = + require('@jest/create-cache-key-function').default; module.exports = { // Mocks asset requires to return the filename. Makes it possible to test that diff --git a/jest/mockComponent.js b/jest/mockComponent.js index 42a30c8c6e68..9e21dfaa4574 100644 --- a/jest/mockComponent.js +++ b/jest/mockComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest/mockModal.js b/jest/mockModal.js index 8c5bfc7ec092..e38944d52dc5 100644 --- a/jest/mockModal.js +++ b/jest/mockModal.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,11 +13,11 @@ 'use strict'; const React = require('react'); -const Modal = require('../Libraries/Modal/Modal'); +import typeof Modal from '../Libraries/Modal/Modal'; function mockModal(BaseComponent: $FlowFixMe) { class ModalMock extends BaseComponent { - render(): React.Element { + render(): React.Element { return ( {this.props.visible !== true ? null : this.props.children} diff --git a/jest/mockNativeComponent.js b/jest/mockNativeComponent.js index e6080b7d1498..c42baec2be2a 100644 --- a/jest/mockNativeComponent.js +++ b/jest/mockNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,8 +11,12 @@ const React = require('react'); +let nativeTag = 1; + module.exports = viewName => { const Component = class extends React.Component { + _nativeTag = nativeTag++; + render() { return React.createElement(viewName, this.props, this.props.children); } diff --git a/jest/mockScrollView.js b/jest/mockScrollView.js index 4155be9661ce..ceeb1843bbda 100644 --- a/jest/mockScrollView.js +++ b/jest/mockScrollView.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest/preprocessor.js b/jest/preprocessor.js index e209750d6973..f5e34763d840 100644 --- a/jest/preprocessor.js +++ b/jest/preprocessor.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,42 +13,10 @@ 'use strict'; const babelRegisterOnly = require('metro-babel-register'); -const nullthrows = require('nullthrows'); -const createCacheKeyFunction = require('@jest/create-cache-key-function') - .default; -const t = require('@babel/types'); -const {statements} = require('@babel/template').default; +const createCacheKeyFunction = + require('@jest/create-cache-key-function').default; -const importDefault = '__importDefault__'; -const importAll = '__importAll__'; - -// prelude -const importPrelude = statements(` - function ${importDefault}(moduleId) { - const exports = require(moduleId); - - if (exports && exports.__esModule) { - return exports.default; - } - - return exports; - }; - - function ${importAll}(moduleId) { - const exports = require(moduleId); - - if (exports && exports.__esModule) { - return exports; - } - - return Object.assign({}, exports, {default: exports}); - }; -`); - -const { - transformSync: babelTransformSync, - transformFromAstSync: babelTransformFromAstSync, -} = require('@babel/core'); +const {transformSync: babelTransformSync} = require('@babel/core'); const generate = require('@babel/generator').default; const nodeFiles = new RegExp( @@ -73,13 +41,13 @@ module.exports = { }).code; } - let {ast} = transformer.transform({ + const {ast} = transformer.transform({ filename: file, options: { ast: true, // needed for open source (?) https://github.com/facebook/react-native/commit/f8d6b97140cffe8d18b2558f94570c8d1b410d5c#r28647044 dev: true, enableBabelRuntime: false, - experimentalImportSupport: true, + experimentalImportSupport: false, globalPrefix: '', hot: false, inlineRequires: true, @@ -111,6 +79,10 @@ module.exports = { [require('@babel/plugin-transform-regenerator')], [require('@babel/plugin-transform-sticky-regex')], [require('@babel/plugin-transform-unicode-regex')], + [ + require('@babel/plugin-transform-modules-commonjs'), + {strict: false, allowTopLevelThis: true}, + ], [require('@babel/plugin-transform-classes')], [require('@babel/plugin-transform-arrow-functions')], [require('@babel/plugin-transform-spread')], @@ -127,46 +99,6 @@ module.exports = { ], }); - // We're not using @babel/plugin-transform-modules-commonjs so - // we need to add 'use strict' manually - const directives = ast.program.directives; - - if ( - ast.program.sourceType === 'module' && - (directives == null || - directives.findIndex(d => d.value.value === 'use strict') === -1) - ) { - ast.program.directives = [ - ...(directives || []), - t.directive(t.directiveLiteral('use strict')), - ]; - } - - // Postprocess the transformed module to handle ESM and inline requires. - // We need to do this in a separate pass to avoid issues tracking references. - const babelTransformResult = babelTransformFromAstSync(ast, src, { - ast: true, - retainLines: true, - plugins: [ - [ - require('metro-transform-plugins').importExportPlugin, - {importDefault, importAll}, - ], - [ - require('babel-preset-fbjs/plugins/inline-requires.js'), - {inlineableCalls: [importDefault, importAll]}, - ], - ], - sourceType: 'module', - }); - - ast = nullthrows(babelTransformResult.ast); - - // Inject import helpers *after* running the inline-requires transform, - // because otherwise it will assume they are user code and bail out of - // inlining calls to them. - ast.program.body.unshift(...importPrelude()); - return generate( ast, // $FlowFixMe[prop-missing] Error found when improving flow typing for libs diff --git a/jest/renderer.js b/jest/renderer.js index 04b5674c2687..46f06212e499 100644 --- a/jest/renderer.js +++ b/jest/renderer.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/jest/setup.js b/jest/setup.js index 778778859da0..5bc654475940 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -25,10 +25,10 @@ global.Promise = jest.requireActual('promise'); global.regeneratorRuntime = jest.requireActual('regenerator-runtime/runtime'); global.window = global; -global.requestAnimationFrame = function(callback) { +global.requestAnimationFrame = function (callback) { return setTimeout(callback, 0); }; -global.cancelAnimationFrame = function(id) { +global.cancelAnimationFrame = function (id) { clearTimeout(id); }; @@ -123,6 +123,7 @@ jest default: { addEventListener: jest.fn(), announceForAccessibility: jest.fn(), + isAccessibilityServiceEnabled: jest.fn(), isBoldTextEnabled: jest.fn(), isGrayscaleEnabled: jest.fn(), isInvertColorsEnabled: jest.fn(), @@ -352,7 +353,7 @@ jest }) .mock( '../Libraries/Utilities/verifyComponentAttributeEquivalence', - () => function() {}, + () => function () {}, ) .mock('../Libraries/Components/View/ViewNativeComponent', () => { const React = require('react'); diff --git a/local-cli/cli.js b/local-cli/cli.js index 459b77e3a631..b5deb9fdb247 100644 --- a/local-cli/cli.js +++ b/local-cli/cli.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/metro.config.js b/metro.config.js index 69a20e6346a4..9125b65f004e 100644 --- a/metro.config.js +++ b/metro.config.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/package.json b/package.json index 50cfac09c649..a29bacdae4d8 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,12 @@ { "name": "react-native", - "private": true, - "version": "1000.0.0", + "version": "0.68.3", "bin": "./cli.js", "description": "A framework for building native apps using React", "license": "MIT", "repository": "github:facebook/react-native", "engines": { - "node": ">=12" + "node": ">=14" }, "jest-junit": { "outputDirectory": "reports/junit", @@ -39,12 +38,17 @@ "rn-get-polyfills.js", "scripts/compose-source-maps.js", "scripts/find-node.sh", + "scripts/generate-artifacts.js", + "scripts/generate-provider-cli.js", "scripts/generate-specs-cli.js", "scripts/ios-configure-glog.sh", "scripts/launchPackager.bat", "scripts/launchPackager.command", "scripts/node-binary.sh", "scripts/packager.sh", + "scripts/packager-reporter.js", + "scripts/react_native_pods_utils/script_phases.rb", + "scripts/react_native_pods_utils/script_phases.sh", "scripts/react_native_pods.rb", "scripts/react-native-xcode.sh", "template.config.js", @@ -67,7 +71,7 @@ "prettier": "prettier --write \"./**/*.{js,md,yml}\"", "format-check": "prettier --list-different \"./**/*.{js,md,yml}\"", "update-lock": "npx yarn-deduplicate", - "docker-setup-android": "docker pull reactnativecommunity/react-native-android:4.0", + "docker-setup-android": "docker pull reactnativecommunity/react-native-android:5.2", "docker-build-android": "docker build -t reactnativeci/android -f .circleci/Dockerfiles/Dockerfile.android .", "test-android-run-instrumentation": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-instrumentation-tests.sh", "test-android-run-unit": "docker run --cap-add=SYS_ADMIN -it reactnativeci/android bash .circleci/Dockerfiles/scripts/run-android-docker-unit-tests.sh", @@ -76,87 +80,101 @@ "test-android-instrumentation": "yarn run docker-build-android && yarn run test-android-run-instrumentation", "test-android-unit": "yarn run docker-build-android && yarn run test-android-run-unit", "test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e", - "build-ios-e2e": "detox build -c ios.sim.release", - "test-ios-e2e": "detox test -c ios.sim.release packages/rn-tester/e2e", "test-ios": "./scripts/objc-test.sh test" }, - "workspaces": [ - "packages/!(eslint-config-react-native-community)", - "repo-config" - ], "peerDependencies": { "react": "17.0.2" }, "dependencies": { "@jest/create-cache-key-function": "^27.0.1", - "@react-native-community/cli": "^6.0.0", - "@react-native-community/cli-platform-android": "^6.0.0", - "@react-native-community/cli-platform-ios": "^6.0.0", + "@react-native-community/cli": "^7.0.3", + "@react-native-community/cli-platform-android": "^7.0.1", + "@react-native-community/cli-platform-ios": "^7.0.1", "@react-native/assets": "1.0.0", "@react-native/normalize-color": "2.0.0", "@react-native/polyfills": "2.0.0", "abort-controller": "^3.0.0", "anser": "^1.4.9", "base64-js": "^1.1.2", + "deprecated-react-native-prop-types": "^2.3.0", "event-target-shim": "^5.0.1", - "hermes-engine": "~0.9.0", + "hermes-engine": "~0.11.0", "invariant": "^2.2.4", "jsc-android": "^250230.2.1", - "metro-react-native-babel-transformer": "0.66.2", - "metro-runtime": "0.66.2", - "metro-source-map": "0.66.2", + "metro-react-native-babel-transformer": "0.67.0", + "metro-runtime": "0.67.0", + "metro-source-map": "0.67.0", "nullthrows": "^1.1.1", "pretty-format": "^26.5.2", "promise": "^8.0.3", - "prop-types": "^15.7.2", - "react-devtools-core": "4.19.1", + "react-devtools-core": "^4.23.0", + "react-native-gradle-plugin": "^0.0.6", "react-refresh": "^0.4.0", + "react-shallow-renderer": "16.14.1", "regenerator-runtime": "^0.13.2", "scheduler": "^0.20.2", "stacktrace-parser": "^0.1.3", - "use-subscription": "^1.0.0", + "use-subscription": ">=1.0.0 <1.6.0", "whatwg-fetch": "^3.0.0", - "ws": "^6.1.4" + "ws": "^6.1.4", + "react-native-codegen": "^0.0.17" }, "devDependencies": { - "flow-bin": "^0.162.0", - "react": "17.0.2" + "flow-bin": "^0.170.0", + "react": "17.0.2", + "@babel/core": "^7.14.0", + "@babel/generator": "^7.14.0", + "@react-native-community/eslint-plugin": "*", + "@react-native/eslint-plugin-specs": ">0.0.2", + "@reactions/component": "^2.0.2", + "async": "^2.4.0", + "babel-eslint": "^10.1.0", + "clang-format": "^1.2.4", + "connect": "^3.6.5", + "coveralls": "^3.0.2", + "eslint": "^7.32.0", + "eslint-config-fb-strict": "^26.0.0", + "eslint-config-fbjs": "^3.1.1", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-babel": "^5.3.1", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-flowtype": "^7.0.0", + "eslint-plugin-jest": "^25.2.4", + "eslint-plugin-jsx-a11y": "^6.4.1", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.26.1", + "eslint-plugin-react-hooks": "^4.2.0", + "eslint-plugin-react-native": "^3.11.0", + "eslint-plugin-relay": "^1.8.2", + "inquirer": "^7.1.0", + "jest": "^26.6.3", + "jest-junit": "^10.0.0", + "jscodeshift": "^0.13.1", + "metro-babel-register": "0.67.0", + "mkdirp": "^0.5.1", + "prettier": "^2.4.1", + "react-test-renderer": "17.0.2", + "shelljs": "^0.8.4", + "signedsource": "^1.0.0", + "ws": "^6.1.4", + "yargs": "^15.3.1" }, - "detox": { - "test-runner": "jest", - "runner-config": "packages/rn-tester/e2e/config.json", - "specs": "", - "configurations": { - "android.emu.release": { - "binaryPath": "packages/rn-tester/android/app/build/outputs/apk/hermes/release/app-hermes-x86-release.apk", - "testBinaryPath": "packages/rn-tester/android/app/build/outputs/apk/androidTest/hermes/release/app-hermes-release-androidTest.apk", - "build": "./gradlew :packages:rn-tester:android:app:assembleRelease :packages:rn-tester:android:app:assembleAndroidTest -DtestBuildType=release", - "type": "android.emulator", - "device": { - "avdName": "Nexus_6_API_29" - } - }, - "android.emu.debug": { - "binaryPath": "packages/rn-tester/android/app/build/outputs/apk/hermes/debug/app-hermes-x86-debug.apk", - "testBinaryPath": "packages/rn-tester/android/app/build/outputs/apk/androidTest/hermes/debug/app-hermes-debug-androidTest.apk", - "build": "./gradlew :packages:rn-tester:android:app:assembleDebug :packages:rn-tester:android:app:assembleAndroidTest -DtestBuildType=debug", - "type": "android.emulator", - "device": { - "avdName": "Nexus_6_API_29" - } - }, - "ios.sim.release": { - "binaryPath": "packages/rn-tester/build/Build/Products/Release-iphonesimulator/RNTester.app/", - "build": "xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester -configuration Release -sdk iphonesimulator -derivedDataPath packages/rn-tester/build -UseModernBuildSystem=NO -quiet", - "type": "ios.simulator", - "name": "iPhone 8" + "codegenConfig": { + "libraries": [ + { + "name": "FBReactNativeSpec", + "type": "modules", + "ios": {}, + "android": {}, + "jsSrcsDir": "Libraries" }, - "ios.sim.debug": { - "binaryPath": "packages/rn-tester/build/Build/Products/Debug-iphonesimulator/RNTester.app/", - "build": "xcodebuild -workspace packages/rn-tester/RNTesterPods.xcworkspace -scheme RNTester -configuration Debug -sdk iphonesimulator -derivedDataPath packages/rn-tester/build -UseModernBuildSystem=NO -quiet", - "type": "ios.simulator", - "name": "iPhone 8" + { + "name": "rncore", + "type": "components", + "ios": {}, + "android": {}, + "jsSrcsDir": "Libraries" } - } + ] } -} +} \ No newline at end of file diff --git a/packages/assets/__tests__/path-support-test.js b/packages/assets/__tests__/path-support-test.js index 7508c3d16ee3..37cc3ba7fee6 100644 --- a/packages/assets/__tests__/path-support-test.js +++ b/packages/assets/__tests__/path-support-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/assets/path-support.js b/packages/assets/path-support.js index ef2e42d71b78..a6c30d42375a 100644 --- a/packages/assets/path-support.js +++ b/packages/assets/path-support.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -44,6 +44,7 @@ const drawableFileTypes = new Set([ 'gif', 'jpeg', 'jpg', + 'ktx', 'png', 'svg', 'webp', diff --git a/packages/assets/registry.js b/packages/assets/registry.js index 088187ff3e70..02470da3c496 100644 --- a/packages/assets/registry.js +++ b/packages/assets/registry.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/babel-plugin-codegen/__test_fixtures__/failures.js b/packages/babel-plugin-codegen/__test_fixtures__/failures.js index 6ba62d5a2c66..908a83488e07 100644 --- a/packages/babel-plugin-codegen/__test_fixtures__/failures.js +++ b/packages/babel-plugin-codegen/__test_fixtures__/failures.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -82,7 +82,9 @@ export default (codegenNativeComponent('Module'): NativeType); `; module.exports = { - 'CommandsExportedWithDifferentNameNativeComponent.js': COMMANDS_EXPORTED_WITH_DIFFERENT_NAME, - 'CommandsExportedWithShorthandNativeComponent.js': COMMANDS_EXPORTED_WITH_SHORTHAND, + 'CommandsExportedWithDifferentNameNativeComponent.js': + COMMANDS_EXPORTED_WITH_DIFFERENT_NAME, + 'CommandsExportedWithShorthandNativeComponent.js': + COMMANDS_EXPORTED_WITH_SHORTHAND, 'OtherCommandsExportNativeComponent.js': OTHER_COMMANDS_EXPORT, }; diff --git a/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js b/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js index 946b622ea87d..a55b940eabcc 100644 --- a/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js +++ b/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap b/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap index c324b68b283f..cc95c057404a 100644 --- a/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap +++ b/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap @@ -29,7 +29,7 @@ const { } = require(\\"react-native/Libraries/Renderer/shims/ReactNative\\"); let nativeComponentName = 'RCTModule'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'RCTModule', bubblingEventTypes: { topBubblingEventDefinedInlineNull: { @@ -45,11 +45,10 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ } }, validAttributes: { - boolean_default_true_optional_both: true, - onDirectEventDefinedInlineNull: true, - onBubblingEventDefinedInlineNull: true + boolean_default_true_optional_both: true } -})); +}; +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); export const Commands = { hotspotUpdate(ref, x, y) { dispatchCommand(ref, \\"hotspotUpdate\\", [x, y]); @@ -91,7 +90,7 @@ const { } = require(\\"react-native/Libraries/Renderer/shims/ReactNative\\"); let nativeComponentName = 'RCTModule'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'RCTModule', bubblingEventTypes: { topBubblingEventDefinedInlineNull: { @@ -107,11 +106,10 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ } }, validAttributes: { - boolean_default_true_optional_both: true, - onDirectEventDefinedInlineNull: true, - onBubblingEventDefinedInlineNull: true + boolean_default_true_optional_both: true } -})); +}; +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); export const Commands = { hotspotUpdate(ref, x, y) { dispatchCommand(ref, \\"hotspotUpdate\\", [x, y]); diff --git a/packages/babel-plugin-codegen/__tests__/index-test.js b/packages/babel-plugin-codegen/__tests__/index-test.js index 06b9ad76dfe4..820a711f8685 100644 --- a/packages/babel-plugin-codegen/__tests__/index-test.js +++ b/packages/babel-plugin-codegen/__tests__/index-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/babel-plugin-codegen/index.js b/packages/babel-plugin-codegen/index.js index 235eb6679694..0c7d37015b0f 100644 --- a/packages/babel-plugin-codegen/index.js +++ b/packages/babel-plugin-codegen/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,12 +9,21 @@ 'use strict'; -const {parseString} = require('react-native-codegen/src/parsers/flow'); -const RNCodegen = require('react-native-codegen/src/generators/RNCodegen'); +let flow, RNCodegen; + const {basename} = require('path'); +try { + flow = require('react-native-codegen/src/parsers/flow'); + RNCodegen = require('react-native-codegen/src/generators/RNCodegen'); +} catch (e) { + // Fallback to lib when source doesn't exit (e.g. when installed as a dev dependency) + flow = require('react-native-codegen/lib/parsers/flow'); + RNCodegen = require('react-native-codegen/lib/generators/RNCodegen'); +} + function generateViewConfig(filename, code) { - const schema = parseString(code); + const schema = flow.parseString(code); const libraryName = basename(filename).replace(/NativeComponent\.js$/, ''); return RNCodegen.generateViewConfig({ @@ -53,7 +62,7 @@ function isCodegenDeclaration(declaration) { return false; } -module.exports = function({parse, types: t}) { +module.exports = function ({parse, types: t}) { return { pre(state) { this.code = state.code; diff --git a/packages/babel-plugin-codegen/package.json b/packages/babel-plugin-codegen/package.json index 858148ff6ae1..56dc4f1d6c7e 100644 --- a/packages/babel-plugin-codegen/package.json +++ b/packages/babel-plugin-codegen/package.json @@ -7,6 +7,9 @@ "url": "git@github.com:facebook/react-native.git", "directory": "packages/babel-plugin-codegen" }, + "files": [ + "index.js" + ], "dependencies": { "react-native-codegen": "*" }, diff --git a/packages/eslint-config-react-native-community/index.js b/packages/eslint-config-react-native-community/index.js index be5396609391..34759731a5b2 100644 --- a/packages/eslint-config-react-native-community/index.js +++ b/packages/eslint-config-react-native-community/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,10 +16,7 @@ module.exports = { sourceType: 'module', }, - extends: [ - 'plugin:prettier/recommended', // https://github.com/prettier/eslint-plugin-prettier#recommended-configuration - 'prettier/react', - ], + extends: ['plugin:prettier/recommended'], plugins: [ 'eslint-comments', @@ -59,6 +56,9 @@ module.exports = { {argsIgnorePattern: '^_'}, ], 'no-unused-vars': 'off', + 'no-shadow': 'off', + '@typescript-eslint/no-shadow': 1, + 'no-undef': 'off', }, }, { @@ -300,6 +300,7 @@ module.exports = { 'react/no-multi-comp': 0, 'react/no-string-refs': 1, 'react/no-unknown-property': 0, + 'react/no-unstable-nested-components': 1, 'react/prop-types': 0, 'react/react-in-jsx-scope': 1, 'react/self-closing-comp': 1, @@ -307,8 +308,8 @@ module.exports = { // React-Hooks Plugin // The following rules are made available via `eslint-plugin-react-hooks` - 'react-hooks/rules-of-hooks': 'error', - 'react-hooks/exhaustive-deps': 'error', + 'react-hooks/rules-of-hooks': 2, + 'react-hooks/exhaustive-deps': 2, // React-Native Plugin // The following rules are made available via `eslint-plugin-react-native` diff --git a/packages/eslint-config-react-native-community/package.json b/packages/eslint-config-react-native-community/package.json index bf80d296770f..79f74a9ddfcc 100644 --- a/packages/eslint-config-react-native-community/package.json +++ b/packages/eslint-config-react-native-community/package.json @@ -15,22 +15,22 @@ "@typescript-eslint/eslint-plugin": "^4.22.1", "@typescript-eslint/parser": "^4.22.1", "babel-eslint": "^10.1.0", - "eslint-config-prettier": "^6.10.1", - "eslint-plugin-eslint-comments": "^3.1.2", - "eslint-plugin-flowtype": "2.50.3", - "eslint-plugin-jest": "22.4.1", - "eslint-plugin-prettier": "3.1.2", - "eslint-plugin-react": "^7.20.0", - "eslint-plugin-react-hooks": "^4.0.7", - "eslint-plugin-react-native": "^3.10.0", - "prettier": "^2.0.2" + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-eslint-comments": "^3.2.0", + "eslint-plugin-flowtype": "^7.0.0", + "eslint-plugin-jest": "^25.2.4", + "eslint-plugin-prettier": "^4.0.0", + "eslint-plugin-react": "^7.26.1", + "eslint-plugin-react-hooks": "^4.2.0", + "eslint-plugin-react-native": "^3.11.0", + "prettier": "^2.4.1" }, "peerDependencies": { "eslint": ">=7", "prettier": ">=2" }, "devDependencies": { - "eslint": "7.12.0", - "prettier": "^2.3.2" + "eslint": "^7.32.0", + "prettier": "^2.4.1" } } diff --git a/packages/eslint-config-react-native-community/yarn.lock b/packages/eslint-config-react-native-community/yarn.lock index 2029c4ca41a9..74bfe9820466 100644 --- a/packages/eslint-config-react-native-community/yarn.lock +++ b/packages/eslint-config-react-native-community/yarn.lock @@ -2,6 +2,13 @@ # yarn lockfile v1 +"@babel/code-frame@7.12.11": + version "7.12.11" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" + integrity sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw== + dependencies: + "@babel/highlight" "^7.10.4" + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" @@ -60,14 +67,6 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.10.tgz#824600d59e96aea26a5a2af5a9d812af05c3ae81" integrity sha512-PJdRPwyoOqFAWfLytxrWwGrAxghCgh/yTNCYciOz8QgjflA7aZhECPZAa2VUedKg2+QMWkI0L9lynh2SNmNEgA== -"@babel/runtime-corejs3@^7.8.3": - version "7.9.2" - resolved "https://registry.yarnpkg.com/@babel/runtime-corejs3/-/runtime-corejs3-7.9.2.tgz#26fe4aa77e9f1ecef9b776559bbb8e84d34284b7" - integrity sha512-HHxmgxbIzOfFlZ+tdeRKtaxWOMUoCG5Mu3wKeUmOxjYrwb3AAHgnmtCUbPPK11/raIWLIBK250t8E2BPO0p7jA== - dependencies: - core-js-pure "^3.0.0" - regenerator-runtime "^0.13.4" - "@babel/template@^7.10.4": version "7.12.7" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.12.7.tgz#c817233696018e39fbb6c491d2fb684e05ed43bc" @@ -101,22 +100,35 @@ lodash "^4.17.19" to-fast-properties "^2.0.0" -"@eslint/eslintrc@^0.2.0": - version "0.2.1" - resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.2.1.tgz#f72069c330461a06684d119384435e12a5d76e3c" - integrity sha512-XRUeBZ5zBWLYgSANMpThFddrZZkEbGHgUdt5UJjZfnlN9BGCiUBrf+nvbRupSjMvqzwnQN0qwCmOxITt1cfywA== +"@eslint/eslintrc@^0.4.3": + version "0.4.3" + resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c" + integrity sha512-J6KFFz5QCYUJq3pf0mjEcCJVERbzv71PUIDczuh9JkwGEzced6CO5ADLHB1rbf/+oPBtoPfMYNOpGDzCANlbXw== dependencies: ajv "^6.12.4" debug "^4.1.1" espree "^7.3.0" - globals "^12.1.0" + globals "^13.9.0" ignore "^4.0.6" import-fresh "^3.2.1" js-yaml "^3.13.1" - lodash "^4.17.19" minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@humanwhocodes/config-array@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9" + integrity sha512-FagtKFz74XrTl7y6HCzQpwDfXP0yhxe9lHLD1UZxjvZIcbyRz8zTFF/yYNfSfzU414eDwZ1SrO0Qvtyf+wFMQg== + dependencies: + "@humanwhocodes/object-schema" "^1.2.0" + debug "^4.1.1" + minimatch "^3.0.4" + +"@humanwhocodes/object-schema@^1.2.0": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" + integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== + "@nodelib/fs.scandir@2.1.4": version "2.1.4" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.4.tgz#d4b3549a5db5de2683e0c1071ab4f140904bbf69" @@ -153,6 +165,11 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" integrity sha512-8+KAKzEvSUdeo+kmqnKrqgeE+LcA0tjYWFY7RPProVYwnqDjukzO+3b6dLD56rYX5TdWejnEOLJYOIeh4CXKuA== +"@types/json-schema@^7.0.9": + version "7.0.9" + resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" + integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== + "@typescript-eslint/eslint-plugin@^4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.22.1.tgz#6bcdbaa4548553ab861b4e5f34936ead1349a543" @@ -179,6 +196,18 @@ eslint-scope "^5.0.0" eslint-utils "^2.0.0" +"@typescript-eslint/experimental-utils@^5.0.0": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-5.3.1.tgz#bbd8f9b67b4d5fdcb9d2f90297d8fcda22561e05" + integrity sha512-RgFn5asjZ5daUhbK5Sp0peq0SSMytqcrkNfU4pnDma2D8P3ElZ6JbYjY8IMSFfZAJ0f3x3tnO3vXHweYg0g59w== + dependencies: + "@types/json-schema" "^7.0.9" + "@typescript-eslint/scope-manager" "5.3.1" + "@typescript-eslint/types" "5.3.1" + "@typescript-eslint/typescript-estree" "5.3.1" + eslint-scope "^5.1.1" + eslint-utils "^3.0.0" + "@typescript-eslint/parser@^4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-4.22.1.tgz#a95bda0fd01d994a15fc3e99dc984294f25c19cc" @@ -197,11 +226,24 @@ "@typescript-eslint/types" "4.22.1" "@typescript-eslint/visitor-keys" "4.22.1" +"@typescript-eslint/scope-manager@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.3.1.tgz#3cfbfbcf5488fb2a9a6fbbe97963ee1e8d419269" + integrity sha512-XksFVBgAq0Y9H40BDbuPOTUIp7dn4u8oOuhcgGq7EoDP50eqcafkMVGrypyVGvDYHzjhdUCUwuwVUK4JhkMAMg== + dependencies: + "@typescript-eslint/types" "5.3.1" + "@typescript-eslint/visitor-keys" "5.3.1" + "@typescript-eslint/types@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.22.1.tgz#bf99c6cec0b4a23d53a61894816927f2adad856a" integrity sha512-2HTkbkdAeI3OOcWbqA8hWf/7z9c6gkmnWNGz0dKSLYLWywUlkOAQ2XcjhlKLj5xBFDf8FgAOF5aQbnLRvgNbCw== +"@typescript-eslint/types@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.3.1.tgz#afaa715b69ebfcfde3af8b0403bf27527912f9b7" + integrity sha512-bG7HeBLolxKHtdHG54Uac750eXuQQPpdJfCYuw4ZI3bZ7+GgKClMWM8jExBtp7NSP4m8PmLRM8+lhzkYnSmSxQ== + "@typescript-eslint/typescript-estree@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.22.1.tgz#dca379eead8cdfd4edc04805e83af6d148c164f9" @@ -215,6 +257,19 @@ semver "^7.3.2" tsutils "^3.17.1" +"@typescript-eslint/typescript-estree@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.3.1.tgz#50cc4bfb93dc31bc75e08ae52e29fcb786d606ec" + integrity sha512-PwFbh/PKDVo/Wct6N3w+E4rLZxUDgsoII/GrWM2A62ETOzJd4M6s0Mu7w4CWsZraTbaC5UQI+dLeyOIFF1PquQ== + dependencies: + "@typescript-eslint/types" "5.3.1" + "@typescript-eslint/visitor-keys" "5.3.1" + debug "^4.3.2" + globby "^11.0.4" + is-glob "^4.0.3" + semver "^7.3.5" + tsutils "^3.21.0" + "@typescript-eslint/visitor-keys@4.22.1": version "4.22.1" resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.22.1.tgz#6045ae25a11662c671f90b3a403d682dfca0b7a6" @@ -223,17 +278,30 @@ "@typescript-eslint/types" "4.22.1" eslint-visitor-keys "^2.0.0" +"@typescript-eslint/visitor-keys@5.3.1": + version "5.3.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.3.1.tgz#c2860ff22939352db4f3806f34b21d8ad00588ba" + integrity sha512-3cHUzUuVTuNHx0Gjjt5pEHa87+lzyqOiHXy/Gz+SJOCW1mpw9xQHIIEwnKn+Thph1mgWyZ90nboOcSuZr/jTTQ== + dependencies: + "@typescript-eslint/types" "5.3.1" + eslint-visitor-keys "^3.0.0" + acorn-jsx@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.2.0.tgz#4c66069173d6fdd68ed85239fc256226182b2ebe" integrity sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ== +acorn-jsx@^5.3.1: + version "5.3.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" + integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== + acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -ajv@^6.10.0, ajv@^6.12.4, ajv@^6.9.1: +ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4" integrity sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g== @@ -243,28 +311,45 @@ ajv@^6.10.0, ajv@^6.12.4, ajv@^6.9.1: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^8.0.1: + version "8.7.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.7.1.tgz#52be6f1736b076074798124293618f132ad07a7e" + integrity sha512-gPpOObTO1QjbnN1sVMjJcp1TF9nggMfO4MBR5uQl6ZVTOaEPq5i4oq/6R9q2alMMPB3eg53wFv1RuJBLuxf3Hw== + dependencies: + fast-deep-equal "^3.1.1" + json-schema-traverse "^1.0.0" + require-from-string "^2.0.2" + uri-js "^4.2.2" + ansi-colors@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.1.tgz#cbb9ae256bf750af1eab344f229aa27fe94ba348" integrity sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA== -ansi-regex@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" - integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== - ansi-regex@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== -ansi-styles@^3.2.0, ansi-styles@^3.2.1: +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" integrity sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA== dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" @@ -280,24 +365,35 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -array-includes@^3.0.3, array-includes@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.1.tgz#cdd67e6852bdf9c1215460786732255ed2459348" - integrity sha512-c2VXaCHl7zPsvpkFsw4nxvFie4fh1ur9bpcgsVkIjqn0H/Xwdg+7fv3n2r/isyS8EBj5b06M9kHyZuIr4El6WQ== +array-includes@^3.1.3: + version "3.1.4" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.4.tgz#f5b493162c760f3539631f005ba2bb46acb45ba9" + integrity sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0" - is-string "^1.0.5" + es-abstract "^1.19.1" + get-intrinsic "^1.1.1" + is-string "^1.0.7" array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw== -astral-regex@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" - integrity sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg== +array.prototype.flatmap@^1.2.4: + version "1.2.5" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.5.tgz#908dc82d8a406930fdf38598d51e7411d18d4446" + integrity sha512-08u6rVyi1Lj7oqWbS9nUxliETrtIROT4XGTA4D/LWGten6E3ocm7cy9SIrmNHOL5XVbVuckUp3X6Xyg8/zpvHA== + dependencies: + call-bind "^1.0.0" + define-properties "^1.1.3" + es-abstract "^1.19.0" + +astral-regex@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-2.0.0.tgz#483143c567aeed4785759c0865786dc77d7d2e31" + integrity sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ== babel-eslint@^10.1.0: version "10.1.0" @@ -331,6 +427,14 @@ braces@^3.0.1: dependencies: fill-range "^7.0.1" +call-bind@^1.0.0, call-bind@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" + integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== + dependencies: + function-bind "^1.1.1" + get-intrinsic "^1.0.2" + callsites@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.0.0.tgz#fb7eb569b72ad7a45812f93fd9430a3e410b3dd3" @@ -382,11 +486,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -core-js-pure@^3.0.0: - version "3.6.4" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.4.tgz#4bf1ba866e25814f149d4e9aaa08c36173506e3a" - integrity sha512-epIhRLkXdgv32xIUFaaAry2wdxZYBi6bgM7cB136dzzXXa+dFyRLTZeLUJxnd8ShrmyVXBub63n2NHo2JAt8Cw== - cross-spawn@^7.0.2: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" @@ -403,12 +502,19 @@ debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: dependencies: ms "^2.1.1" +debug@^4.3.2: + version "4.3.2" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" + integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== + dependencies: + ms "2.1.2" + deep-is@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" integrity sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ= -define-properties@^1.1.2, define-properties@^1.1.3: +define-properties@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== @@ -436,10 +542,10 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" -emoji-regex@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" - integrity sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA== +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== enquirer@^2.3.5: version "2.3.6" @@ -448,22 +554,31 @@ enquirer@^2.3.5: dependencies: ansi-colors "^4.1.1" -es-abstract@^1.17.0, es-abstract@^1.17.0-next.1: - version "1.17.5" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.5.tgz#d8c9d1d66c8981fb9200e2251d799eee92774ae9" - integrity sha512-BR9auzDbySxOcfog0tLECW8l28eRGpDpU3Dm3Hp4q/N+VtLTmyj4EUN088XZWQDW/hzj6sYRDXeOFsaAODKvpg== +es-abstract@^1.19.0, es-abstract@^1.19.1: + version "1.19.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.19.1.tgz#d4885796876916959de78edaa0df456627115ec3" + integrity sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w== dependencies: + call-bind "^1.0.2" es-to-primitive "^1.2.1" function-bind "^1.1.1" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.1.5" - is-regex "^1.0.5" - object-inspect "^1.7.0" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.1" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.1" + is-string "^1.0.7" + is-weakref "^1.0.1" + object-inspect "^1.11.0" object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimleft "^2.1.1" - string.prototype.trimright "^2.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.1" es-to-primitive@^1.2.1: version "1.2.1" @@ -479,74 +594,83 @@ escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-config-prettier@^6.10.1: - version "6.10.1" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.10.1.tgz#129ef9ec575d5ddc0e269667bf09defcd898642a" - integrity sha512-svTy6zh1ecQojvpbJSgH3aei/Rt7C6i090l5f2WQ4aB05lYHeZIR1qL4wZyyILTbtmnbHP5Yn8MrsOJMGa8RkQ== - dependencies: - get-stdin "^6.0.0" +escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + +eslint-config-prettier@^8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz#f7471b20b6fe8a9a9254cc684454202886a2dd7a" + integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== -eslint-plugin-eslint-comments@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.1.2.tgz#4ef6c488dbe06aa1627fea107b3e5d059fc8a395" - integrity sha512-QexaqrNeteFfRTad96W+Vi4Zj1KFbkHHNMMaHZEYcovKav6gdomyGzaxSDSL3GoIyUOo078wRAdYlu1caiauIQ== +eslint-plugin-eslint-comments@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.2.0.tgz#9e1cd7b4413526abb313933071d7aba05ca12ffa" + integrity sha512-0jkOl0hfojIHHmEHgmNdqv4fmh7300NdpA9FFpF7zaoLvB/QeXOGNLIo86oAveJFrfB1p05kC8hpEMHM8DwWVQ== dependencies: escape-string-regexp "^1.0.5" ignore "^5.0.5" -eslint-plugin-flowtype@2.50.3: - version "2.50.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.50.3.tgz#61379d6dce1d010370acd6681740fd913d68175f" - integrity sha512-X+AoKVOr7Re0ko/yEXyM5SSZ0tazc6ffdIOocp2fFUlWoDt7DV0Bz99mngOkAFLOAWjqRA5jPwqUCbrx13XoxQ== +eslint-plugin-flowtype@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-7.0.0.tgz#da07684b5f0caf7c42ed013c2d0c04dbaf2960f4" + integrity sha512-kW3eipG2Vth6e0apYqmFs05IHhFklJJNokYNiNEO5AIjm7H29oTDybYNB2bMULUYcf7iX7Wf3GdRhfBORKcT1g== dependencies: - lodash "^4.17.10" + lodash "^4.17.21" + string-natural-compare "^3.0.1" -eslint-plugin-jest@22.4.1: - version "22.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-22.4.1.tgz#a5fd6f7a2a41388d16f527073b778013c5189a9c" - integrity sha512-gcLfn6P2PrFAVx3AobaOzlIEevpAEf9chTpFZz7bYfc7pz8XRv7vuKTIE4hxPKZSha6XWKKplDQ0x9Pq8xX2mg== +eslint-plugin-jest@^25.2.4: + version "25.2.4" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-25.2.4.tgz#bb9f6a0bd1fd524ffb0b8b7a159cd70a58a1a793" + integrity sha512-HRyinpgmEdkVr7pNPaYPHCoGqEzpgk79X8pg/xCeoAdurbyQjntJQ4pTzHl7BiVEBlam/F1Qsn+Dk0HtJO7Aaw== + dependencies: + "@typescript-eslint/experimental-utils" "^5.0.0" -eslint-plugin-prettier@3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.2.tgz#432e5a667666ab84ce72f945c72f77d996a5c9ba" - integrity sha512-GlolCC9y3XZfv3RQfwGew7NnuFDKsfI4lbvRK+PIIo23SFH+LemGs4cKwzAaRa+Mdb+lQO/STaIayno8T5sJJA== +eslint-plugin-prettier@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.0.0.tgz#8b99d1e4b8b24a762472b4567992023619cb98e0" + integrity sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ== dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-react-hooks@^4.0.7: - version "4.0.7" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.0.7.tgz#19f9e3d07dd3a0fb9e6f0f07153707feedea8108" - integrity sha512-5PuW2OMHQyMLr/+MqTluYN3/NeJJ1RuvmEp5TR9Xl2gXKxvcusUZuMz8XBUtbELNaiRYWs693LQs0cljKuuHRQ== +eslint-plugin-react-hooks@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.2.0.tgz#8c229c268d468956334c943bb45fc860280f5556" + integrity sha512-623WEiZJqxR7VdxFCKLI6d6LLpwJkGPYKODnkH3D7WpOG5KM8yWueBd8TLsNAetEJNF5iJmolaAKO3F8yzyVBQ== eslint-plugin-react-native-globals@^0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/eslint-plugin-react-native-globals/-/eslint-plugin-react-native-globals-0.1.2.tgz#ee1348bc2ceb912303ce6bdbd22e2f045ea86ea2" integrity sha512-9aEPf1JEpiTjcFAmmyw8eiIXmcNZOqaZyHO77wgm0/dWfT/oxC1SrIq8ET38pMxHYrcB6Uew+TzUVsBeczF88g== -eslint-plugin-react-native@^3.10.0: - version "3.10.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react-native/-/eslint-plugin-react-native-3.10.0.tgz#240f7e6979a908af3dfd9ba9652434c33f4d64cd" - integrity sha512-4f5+hHYYq5wFhB5eptkPEAR7FfvqbS7AzScUOANfAMZtYw5qgnCxRq45bpfBaQF+iyPMim5Q8pubcpvLv75NAg== +eslint-plugin-react-native@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react-native/-/eslint-plugin-react-native-3.11.0.tgz#c73b0886abb397867e5e6689d3a6a418682e6bac" + integrity sha512-7F3OTwrtQPfPFd+VygqKA2VZ0f2fz0M4gJmry/TRE18JBb94/OtMxwbL7Oqwu7FGyrdeIOWnXQbBAveMcSTZIA== dependencies: "@babel/traverse" "^7.7.4" eslint-plugin-react-native-globals "^0.1.1" -eslint-plugin-react@^7.20.0: - version "7.20.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.20.0.tgz#f98712f0a5e57dfd3e5542ef0604b8739cd47be3" - integrity sha512-rqe1abd0vxMjmbPngo4NaYxTcR3Y4Hrmc/jg4T+sYz63yqlmJRknpEQfmWY+eDWPuMmix6iUIK+mv0zExjeLgA== +eslint-plugin-react@^7.26.1: + version "7.26.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.26.1.tgz#41bcfe3e39e6a5ac040971c1af94437c80daa40e" + integrity sha512-Lug0+NOFXeOE+ORZ5pbsh6mSKjBKXDXItUD2sQoT+5Yl0eoT82DqnXeTMfUare4QVCn9QwXbfzO/dBLjLXwVjQ== dependencies: - array-includes "^3.1.1" + array-includes "^3.1.3" + array.prototype.flatmap "^1.2.4" doctrine "^2.1.0" - has "^1.0.3" - jsx-ast-utils "^2.2.3" - object.entries "^1.1.1" - object.fromentries "^2.0.2" - object.values "^1.1.1" + estraverse "^5.2.0" + jsx-ast-utils "^2.4.1 || ^3.0.0" + minimatch "^3.0.4" + object.entries "^1.1.4" + object.fromentries "^2.0.4" + object.hasown "^1.0.0" + object.values "^1.1.4" prop-types "^15.7.2" - resolve "^1.15.1" - string.prototype.matchall "^4.0.2" - xregexp "^4.3.0" + resolve "^2.0.0-next.3" + semver "^6.3.0" + string.prototype.matchall "^4.0.5" eslint-scope@^5.0.0, eslint-scope@^5.1.1: version "5.1.1" @@ -563,6 +687,13 @@ eslint-utils@^2.0.0, eslint-utils@^2.1.0: dependencies: eslint-visitor-keys "^1.1.0" +eslint-utils@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-3.0.0.tgz#8aebaface7345bb33559db0a1f13a1d2d48c3672" + integrity sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA== + dependencies: + eslint-visitor-keys "^2.0.0" + eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" @@ -573,29 +704,37 @@ eslint-visitor-keys@^2.0.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz#21fdc8fbcd9c795cc0321f0563702095751511a8" integrity sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ== -eslint@7.12.0: - version "7.12.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.12.0.tgz#7b6a85f87a9adc239e979bb721cde5ce0dc27da6" - integrity sha512-n5pEU27DRxCSlOhJ2rO57GDLcNsxO0LPpAbpFdh7xmcDmjmlGUfoyrsB3I7yYdQXO5N3gkSTiDrPSPNFiiirXA== +eslint-visitor-keys@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz#eee4acea891814cda67a7d8812d9647dd0179af2" + integrity sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA== + +eslint@^7.32.0: + version "7.32.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-7.32.0.tgz#c6d328a14be3fb08c8d1d21e12c02fdb7a2a812d" + integrity sha512-VHZ8gX+EDfz+97jGcgyGCyRia/dPOd6Xh9yPv8Bl1+SoaIwD+a/vlrOmGRUyOYu7MwUhc7CxqeaDZU13S4+EpA== dependencies: - "@babel/code-frame" "^7.0.0" - "@eslint/eslintrc" "^0.2.0" + "@babel/code-frame" "7.12.11" + "@eslint/eslintrc" "^0.4.3" + "@humanwhocodes/config-array" "^0.5.0" ajv "^6.10.0" chalk "^4.0.0" cross-spawn "^7.0.2" debug "^4.0.1" doctrine "^3.0.0" enquirer "^2.3.5" + escape-string-regexp "^4.0.0" eslint-scope "^5.1.1" eslint-utils "^2.1.0" eslint-visitor-keys "^2.0.0" - espree "^7.3.0" - esquery "^1.2.0" + espree "^7.3.1" + esquery "^1.4.0" esutils "^2.0.2" - file-entry-cache "^5.0.1" + fast-deep-equal "^3.1.3" + file-entry-cache "^6.0.1" functional-red-black-tree "^1.0.1" - glob-parent "^5.0.0" - globals "^12.1.0" + glob-parent "^5.1.2" + globals "^13.6.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -603,7 +742,7 @@ eslint@7.12.0: js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.4.1" - lodash "^4.17.19" + lodash.merge "^4.6.2" minimatch "^3.0.4" natural-compare "^1.4.0" optionator "^0.9.1" @@ -612,7 +751,7 @@ eslint@7.12.0: semver "^7.2.1" strip-ansi "^6.0.0" strip-json-comments "^3.1.0" - table "^5.2.3" + table "^6.0.9" text-table "^0.2.0" v8-compile-cache "^2.0.3" @@ -625,15 +764,24 @@ espree@^7.3.0: acorn-jsx "^5.2.0" eslint-visitor-keys "^1.3.0" +espree@^7.3.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-7.3.1.tgz#f2df330b752c6f55019f8bd89b7660039c1bbbb6" + integrity sha512-v3JCNCE64umkFpmkFGqzVKsOT0tN1Zr+ueqLZfpV1Ob8e+CEgPWa+OxCoGH3tnhimMKIaBm4m/vaRpJ/krRz2g== + dependencies: + acorn "^7.4.0" + acorn-jsx "^5.3.1" + eslint-visitor-keys "^1.3.0" + esprima@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -esquery@^1.2.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.3.1.tgz#b78b5828aa8e214e29fb74c4d5b752e1c033da57" - integrity sha512-olpvt9QG0vniUBZspVRN6lwB7hOZoTRtT+jzR+tS4ffYx2mzbw+z0XCOk44aaLYKApNX5nMm+E+P6o25ip/DHQ== +esquery@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.4.0.tgz#2148ffc38b82e8c7057dfed48425b3e61f0f24a5" + integrity sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w== dependencies: estraverse "^5.1.0" @@ -664,6 +812,11 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== +fast-deep-equal@^3.1.3: + version "3.1.3" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" + integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== + fast-diff@^1.1.2: version "1.2.0" resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03" @@ -698,12 +851,12 @@ fastq@^1.6.0: dependencies: reusify "^1.0.4" -file-entry-cache@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-5.0.1.tgz#ca0f6efa6dd3d561333fb14515065c2fafdf439c" - integrity sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g== +file-entry-cache@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" + integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg== dependencies: - flat-cache "^2.0.1" + flat-cache "^3.0.4" fill-range@^7.0.1: version "7.0.1" @@ -712,19 +865,18 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -flat-cache@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-2.0.1.tgz#5d296d6f04bda44a4630a301413bdbc2ec085ec0" - integrity sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA== +flat-cache@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.0.4.tgz#61b0338302b2fe9f957dcc32fc2a87f1c3048b11" + integrity sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg== dependencies: - flatted "^2.0.0" - rimraf "2.6.3" - write "1.0.3" + flatted "^3.1.0" + rimraf "^3.0.2" -flatted@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.0.tgz#55122b6536ea496b4b44893ee2608141d10d9916" - integrity sha512-R+H8IZclI8AAkSBRQJLVOsxwAoHd6WC40b4QTNWIjzAa6BXOBfQcM587MXDTVPeYaopFNWHUFLx7eNmHDSxMWg== +flatted@^3.1.0: + version "3.2.2" + resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.2.tgz#64bfed5cb68fe3ca78b3eb214ad97b63bedce561" + integrity sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA== fs.realpath@^1.0.0: version "1.0.0" @@ -741,19 +893,24 @@ functional-red-black-tree@^1.0.1: resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= -get-stdin@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-6.0.0.tgz#9e09bf712b360ab9225e812048f71fde9c89657b" - integrity sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g== +get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.1.tgz#15f59f376f855c446963948f0d24cd3637b4abc6" + integrity sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q== + dependencies: + function-bind "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.1" -glob-parent@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.1.tgz#b6c1ef417c4e5663ea498f1c45afac6916bbc229" - integrity sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ== +get-symbol-description@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6" + integrity sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw== dependencies: - is-glob "^4.0.1" + call-bind "^1.0.2" + get-intrinsic "^1.1.1" -glob-parent@^5.1.0: +glob-parent@^5.1.0, glob-parent@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -777,12 +934,12 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.11.0.tgz#dcf93757fa2de5486fbeed7118538adf789e9c2e" integrity sha512-WHq43gS+6ufNOEqlrDBxVEbb8ntfXrfAUU2ZOpCxrBdGKW3gyv8mCxAfIBD0DroPKGrJ2eSsXsLtY9MPntsyTw== -globals@^12.1.0: - version "12.4.0" - resolved "https://registry.yarnpkg.com/globals/-/globals-12.4.0.tgz#a18813576a41b00a24a97e7f815918c2e19925f8" - integrity sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg== +globals@^13.6.0, globals@^13.9.0: + version "13.12.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-13.12.0.tgz#4d733760304230a0082ed96e21e5c565f898089e" + integrity sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg== dependencies: - type-fest "^0.8.1" + type-fest "^0.20.2" globby@^11.0.1: version "11.0.3" @@ -796,6 +953,23 @@ globby@^11.0.1: merge2 "^1.3.0" slash "^3.0.0" +globby@^11.0.4: + version "11.0.4" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5" + integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg== + dependencies: + array-union "^2.1.0" + dir-glob "^3.0.1" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" + slash "^3.0.0" + +has-bigints@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" + integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -811,6 +985,18 @@ has-symbols@^1.0.0, has-symbols@^1.0.1: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.1.tgz#9f5214758a44196c406d9bd76cebf81ec2dd31e8" integrity sha512-PLcsoqu++dmEIZB+6totNFKq/7Do+Z0u4oT0zKOJNl3lYK6vGwwu2hjHs+68OEZbTjiUE9bgOABXbP/GvrS0Kg== +has-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" + integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== + +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -859,20 +1045,47 @@ inherits@2: resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de" integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4= -internal-slot@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.2.tgz#9c2e9fb3cd8e5e4256c6f45fe310067fcfa378a3" - integrity sha512-2cQNfwhAfJIkU4KZPkDI+Gj5yNNnbqi40W9Gge6dfnk4TocEVm00B3bdiL+JINrbGJil2TeHvM4rETGzk/f/0g== +internal-slot@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.3.tgz#7347e307deeea2faac2ac6205d4bc7d34967f59c" + integrity sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA== dependencies: - es-abstract "^1.17.0-next.1" + get-intrinsic "^1.1.0" has "^1.0.3" - side-channel "^1.0.2" + side-channel "^1.0.4" + +is-bigint@^1.0.1: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.4.tgz#08147a1875bc2b32005d41ccd8291dffc6691df3" + integrity sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg== + dependencies: + has-bigints "^1.0.1" + +is-boolean-object@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" -is-callable@^1.1.4, is-callable@^1.1.5: +is-callable@^1.1.4: version "1.1.5" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab" integrity sha512-ESKv5sMCJB2jnHTWZ3O5itG+O128Hsus4K4Qh1h2/cgn2vbgnLSVqfV46AeJA9D5EeeLa9w81KUXMtn34zhX+Q== +is-callable@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== + +is-core-module@^2.2.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.0.tgz#0321336c3d0925e497fd97f5d95cb114a5ccd548" + integrity sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw== + dependencies: + has "^1.0.3" + is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" @@ -883,10 +1096,10 @@ is-extglob@^2.1.1: resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= -is-fullwidth-code-point@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" - integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== is-glob@^4.0.0, is-glob@^4.0.1: version "4.0.1" @@ -895,23 +1108,55 @@ is-glob@^4.0.0, is-glob@^4.0.1: dependencies: is-extglob "^2.1.1" +is-glob@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-negative-zero@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" + integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== + +is-number-object@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.6.tgz#6a7aaf838c7f0686a50b4553f7e54a96494e89f0" + integrity sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g== + dependencies: + has-tostringtag "^1.0.0" + is-number@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== -is-regex@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.5.tgz#39d589a358bf18967f726967120b8fc1aed74eae" - integrity sha512-vlKW17SNq44owv5AQR3Cq0bQPEb8+kF3UKZ2fiZNOWtztYE5i0CzCZxFDwO58qAOWtxdBRVO/V5Qin1wjCqFYQ== +is-regex@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== dependencies: - has "^1.0.3" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + +is-shared-array-buffer@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" + integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== is-string@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== +is-string@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" + is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" @@ -919,6 +1164,20 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.0" +is-symbol@^1.0.3: + version "1.0.4" + resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.4.tgz#a6dac93b635b063ca6872236de88910a57af139c" + integrity sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg== + dependencies: + has-symbols "^1.0.2" + +is-weakref@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2" + integrity sha512-b2jKc2pQZjaeFYWEf7ScFj+Be1I+PXmlu572Q8coTXZ+LD/QQZ7ShPMst8h16riVgyXTQwUsFEl74mDvc/3MHQ== + dependencies: + call-bind "^1.0.0" + isexe@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" @@ -947,18 +1206,23 @@ json-schema-traverse@^0.4.1: resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz#69f6a87d9513ab8bb8fe63bdb0979c448e684660" integrity sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg== +json-schema-traverse@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2" + integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug== + json-stable-stringify-without-jsonify@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= -jsx-ast-utils@^2.2.3: - version "2.2.3" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.3.tgz#8a9364e402448a3ce7f14d357738310d9248054f" - integrity sha512-EdIHFMm+1BPynpKOpdPqiOsvnIrInRGJD7bzPZdPkjitQEqpdpUuFpq4T0npZFKTiB3RhWFdGN+oqOJIdhDhQA== +"jsx-ast-utils@^2.4.1 || ^3.0.0": + version "3.2.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-3.2.1.tgz#720b97bfe7d901b927d87c3773637ae8ea48781b" + integrity sha512-uP5vu8xfy2F9A6LGC22KO7e2/vGTS1MhP+18f++ZNlf0Ohaxbc9nIEwHAsejlJKyzfZzU5UIhe5ItYkitcZnZA== dependencies: - array-includes "^3.0.3" - object.assign "^4.1.0" + array-includes "^3.1.3" + object.assign "^4.1.2" levn@^0.4.1: version "0.4.1" @@ -968,11 +1232,26 @@ levn@^0.4.1: prelude-ls "^1.2.1" type-check "~0.4.0" -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.19: +lodash.merge@^4.6.2: + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" + integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== + +lodash.truncate@^4.4.2: + version "4.4.2" + resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" + integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= + +lodash@^4.17.15, lodash@^4.17.19: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== +lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -980,6 +1259,13 @@ loose-envify@^1.4.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +lru-cache@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" + integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA== + dependencies: + yallist "^4.0.0" + merge2@^1.3.0: version "1.4.1" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" @@ -1000,17 +1286,10 @@ minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" - integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= - -mkdirp@^0.5.1: - version "0.5.1" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" - integrity sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM= - dependencies: - minimist "0.0.8" +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== ms@^2.1.1: version "2.1.1" @@ -1027,55 +1306,60 @@ object-assign@^4.1.1: resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM= -object-inspect@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" - integrity sha512-a7pEHdh1xKIAgTySUGgLMx/xwDZskN1Ud6egYYN3EdRW4ZMPNEDUTF+hwy2LUC+Bl+SyLXANnwz/jyh/qutKUw== +object-inspect@^1.11.0, object-inspect@^1.9.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" + integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== -object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: +object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== -object.assign@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.0.tgz#968bf1100d7956bb3ca086f006f846b3bc4008da" - integrity sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w== +object.assign@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.2.tgz#0ed54a342eceb37b38ff76eb831a0e788cb63940" + integrity sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ== dependencies: - define-properties "^1.1.2" - function-bind "^1.1.1" - has-symbols "^1.0.0" - object-keys "^1.0.11" + call-bind "^1.0.0" + define-properties "^1.1.3" + has-symbols "^1.0.1" + object-keys "^1.1.1" -object.entries@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.1.tgz#ee1cf04153de02bb093fec33683900f57ce5399b" - integrity sha512-ilqR7BgdyZetJutmDPfXCDffGa0/Yzl2ivVNpbx/g4UeWrCdRnFDUBrKJGLhGieRHDATnyZXWBeCb29k9CJysQ== +object.entries@^1.1.4: + version "1.1.5" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.5.tgz#e1acdd17c4de2cd96d5a08487cfb9db84d881861" + integrity sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" - has "^1.0.3" + es-abstract "^1.19.1" -object.fromentries@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.2.tgz#4a09c9b9bb3843dd0f89acdb517a794d4f355ac9" - integrity sha512-r3ZiBH7MQppDJVLx6fhD618GKNG40CZYH9wgwdhKxBDDbQgjeWGGd4AtkZad84d291YxvWe7bJGuE65Anh0dxQ== +object.fromentries@^2.0.4: + version "2.0.5" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.5.tgz#7b37b205109c21e741e605727fe8b0ad5fa08251" + integrity sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" - has "^1.0.3" + es-abstract "^1.19.1" -object.values@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.1.tgz#68a99ecde356b7e9295a3c5e0ce31dc8c953de5e" - integrity sha512-WTa54g2K8iu0kmS/us18jEmdv1a4Wi//BZ/DTVYEcH0XhLM5NYdpDHja3gt57VrZLcNAO2WGA+KpWsDBaHt6eA== +object.hasown@^1.0.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.0.tgz#7232ed266f34d197d15cac5880232f7a4790afe5" + integrity sha512-MhjYRfj3GBlhSkDHo6QmvgjRLXQ2zndabdf3nX0yTyZK9rPfxb6uRpAac8HXNLy1GpqWtZ81Qh4v3uOls2sRAg== dependencies: define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - function-bind "^1.1.1" - has "^1.0.3" + es-abstract "^1.19.1" + +object.values@^1.1.4: + version "1.1.5" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.5.tgz#959f63e3ce9ef108720333082131e4a459b716ac" + integrity sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.1" once@^1.3.0: version "1.4.0" @@ -1140,10 +1424,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.0.2.tgz#1ba8f3eb92231e769b7fcd7cb73ae1b6b74ade08" - integrity sha512-5xJQIPT8BraI7ZnaDwSbu5zLrB6vvi8hVV58yHQ+QK64qrY40dULy0HSRlQ2/2IdzeBpjhDkqdcFBnFeDEMVdg== +prettier@^2.4.1: + version "2.4.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" + integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA== progress@^2.0.0: version "2.0.3" @@ -1174,45 +1458,53 @@ react-is@^16.8.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.8.4.tgz#90f336a68c3a29a096a3d648ab80e87ec61482a2" integrity sha512-PVadd+WaUDOAciICm/J1waJaSvgq+4rHE/K70j0PFqKhkTBsPv/82UGQJNXAngz1fOQLLxI6z1sEDmJDQhCTAA== -regenerator-runtime@^0.13.4: - version "0.13.5" - resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.5.tgz#d878a1d094b4306d10b9096484b33ebd55e26697" - integrity sha512-ZS5w8CpKFinUzOwW3c83oPeVXoNsrLsaCoLtJvAClH135j/R77RuymhiSErhm2lKcwSCIpmvIWSbDkIfAqKQlA== - -regexp.prototype.flags@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75" - integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ== +regexp.prototype.flags@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26" + integrity sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" regexpp@^3.0.0, regexpp@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-3.1.0.tgz#206d0ad0a5648cffbdb8ae46438f3dc51c9f78e2" integrity sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q== +require-from-string@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" + integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== + resolve-from@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== -resolve@^1.12.0, resolve@^1.15.1: +resolve@^1.12.0: version "1.15.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== dependencies: path-parse "^1.0.6" +resolve@^2.0.0-next.3: + version "2.0.0-next.3" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.3.tgz#d41016293d4a8586a39ca5d9b5f15cbea1f55e46" + integrity sha512-W8LucSynKUIDu9ylraa7ueVZ7hc0uAgJBxVsQSKOXOyle8a93qXhcz+XAXZ8bIq2d6i4Ehddn6Evt+0/UwKk6Q== + dependencies: + is-core-module "^2.2.0" + path-parse "^1.0.6" + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rimraf@2.6.3: - version "2.6.3" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.3.tgz#b2d104fe0d8fb27cf9e0a1cda8262dd3833c6cab" - integrity sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA== +rimraf@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== dependencies: glob "^7.1.3" @@ -1223,11 +1515,23 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +semver@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + semver@^7.2.1, semver@^7.3.2: version "7.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.2.tgz#604962b052b81ed0786aae84389ffba70ffd3938" integrity sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ== +semver@^7.3.5: + version "7.3.5" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" + integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== + dependencies: + lru-cache "^6.0.0" + shebang-command@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" @@ -1240,27 +1544,28 @@ shebang-regex@^3.0.0: resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -side-channel@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.2.tgz#df5d1abadb4e4bf4af1cd8852bf132d2f7876947" - integrity sha512-7rL9YlPHg7Ancea1S96Pa8/QWb4BtXL/TZvS6B8XFetGBeuhAsfmUspK6DokBeZ64+Kj9TCNRD/30pVz1BvQNA== +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== dependencies: - es-abstract "^1.17.0-next.1" - object-inspect "^1.7.0" + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -slice-ansi@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" - integrity sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ== +slice-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-4.0.0.tgz#500e8dd0fd55b05815086255b3195adf2a45fe6b" + integrity sha512-qMCMfhY040cVHT43K9BFygqYbUPFZKHOg7K73mtTWJRb8pyP3fzf4Ixd5SzdEJQ6MRUg/WBnOLxghZtKKurENQ== dependencies: - ansi-styles "^3.2.0" - astral-regex "^1.0.0" - is-fullwidth-code-point "^2.0.0" + ansi-styles "^4.0.0" + astral-regex "^2.0.0" + is-fullwidth-code-point "^3.0.0" source-map@^0.5.0: version "0.5.7" @@ -1272,49 +1577,49 @@ sprintf-js@~1.0.2: resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw= -string-width@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-3.1.0.tgz#22767be21b62af1081574306f69ac51b62203961" - integrity sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w== - dependencies: - emoji-regex "^7.0.1" - is-fullwidth-code-point "^2.0.0" - strip-ansi "^5.1.0" +string-natural-compare@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" + integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -string.prototype.matchall@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.2.tgz#48bb510326fb9fdeb6a33ceaa81a6ea04ef7648e" - integrity sha512-N/jp6O5fMf9os0JU3E72Qhf590RSRZU/ungsL/qJUYVTNv7hTG0P/dbPjxINVN9jpscu3nzYwKESU3P3RY5tOg== +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.0" - has-symbols "^1.0.1" - internal-slot "^1.0.2" - regexp.prototype.flags "^1.3.0" - side-channel "^1.0.2" + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" -string.prototype.trimleft@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.1.tgz#9bdb8ac6abd6d602b17a4ed321870d2f8dcefc74" - integrity sha512-iu2AGd3PuP5Rp7x2kEZCrB2Nf41ehzh+goo8TV7z8/XDBbsvc6HQIlUl9RjkZ4oyrW1XM5UwlGl1oVEaDjg6Ag== +string.prototype.matchall@^4.0.5: + version "4.0.6" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.6.tgz#5abb5dabc94c7b0ea2380f65ba610b3a544b15fa" + integrity sha512-6WgDX8HmQqvEd7J+G6VtAahhsQIssiZ8zl7zKh1VDMFyL3hRTJP4FTNA3RbIp2TOQ9AYNDcc7e3fH0Qbup+DBg== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - function-bind "^1.1.1" - -string.prototype.trimright@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.1.tgz#440314b15996c866ce8a0341894d45186200c5d9" - integrity sha512-qFvWL3/+QIgZXVmJBfpHmxLB7xsUXz6HsUmP8+5dRaC3Q7oKUv9Vo6aMCRZC1smrtyECFsIT30PqBJ1gTjAs+g== + es-abstract "^1.19.1" + get-intrinsic "^1.1.1" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + regexp.prototype.flags "^1.3.1" + side-channel "^1.0.4" + +string.prototype.trimend@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" + integrity sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A== dependencies: + call-bind "^1.0.2" define-properties "^1.1.3" - function-bind "^1.1.1" -strip-ansi@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.1.0.tgz#55aaa54e33b4c0649a7338a43437b1887d153ec4" - integrity sha512-TjxrkPONqO2Z8QDCpeE2j6n0M6EwxzyDgzEeGp+FbdvaJAt//ClYi6W5my+3ROlC/hZX2KACUwDfK49Ka5eDvg== +string.prototype.trimstart@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" + integrity sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw== dependencies: - ansi-regex "^4.1.0" + call-bind "^1.0.2" + define-properties "^1.1.3" strip-ansi@^6.0.0: version "6.0.0" @@ -1323,6 +1628,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" @@ -1342,15 +1654,16 @@ supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -table@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/table/-/table-5.2.3.tgz#cde0cc6eb06751c009efab27e8c820ca5b67b7f2" - integrity sha512-N2RsDAMvDLvYwFcwbPyF3VmVSSkuF+G1e+8inhBLtHpvwXGw4QRPEZhihQNeEN0i1up6/f6ObCJXNdlRG3YVyQ== +table@^6.0.9: + version "6.7.3" + resolved "https://registry.yarnpkg.com/table/-/table-6.7.3.tgz#255388439715a738391bd2ee4cbca89a4d05a9b7" + integrity sha512-5DkIxeA7XERBqMwJq0aHZOdMadBx4e6eDoFRuyT5VR82J0Ycg2DwM6GfA/EQAhJ+toRTaS1lIdSQCqgrmhPnlw== dependencies: - ajv "^6.9.1" - lodash "^4.17.11" - slice-ansi "^2.1.0" - string-width "^3.0.0" + ajv "^8.0.1" + lodash.truncate "^4.4.2" + slice-ansi "^4.0.0" + string-width "^4.2.3" + strip-ansi "^6.0.1" text-table@^0.2.0: version "0.2.0" @@ -1381,6 +1694,13 @@ tsutils@^3.17.1: dependencies: tslib "^1.8.1" +tsutils@^3.21.0: + version "3.21.0" + resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" + integrity sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA== + dependencies: + tslib "^1.8.1" + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1" @@ -1388,10 +1708,20 @@ type-check@^0.4.0, type-check@~0.4.0: dependencies: prelude-ls "^1.2.1" -type-fest@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" - integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + +unbox-primitive@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" + integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== + dependencies: + function-bind "^1.1.1" + has-bigints "^1.0.1" + has-symbols "^1.0.2" + which-boxed-primitive "^1.0.2" uri-js@^4.2.2: version "4.2.2" @@ -1405,6 +1735,17 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== +which-boxed-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" + integrity sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg== + dependencies: + is-bigint "^1.0.1" + is-boolean-object "^1.1.0" + is-number-object "^1.0.4" + is-string "^1.0.5" + is-symbol "^1.0.3" + which@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" @@ -1422,16 +1763,7 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" - integrity sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig== - dependencies: - mkdirp "^0.5.1" - -xregexp@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/xregexp/-/xregexp-4.3.0.tgz#7e92e73d9174a99a59743f67a4ce879a04b5ae50" - integrity sha512-7jXDIFXh5yJ/orPn4SXjuVrWWoi4Cr8jfV1eHv9CixKSbU+jY4mxfrBwAuDvupPNKpMUY+FeIqsVw/JLT9+B8g== - dependencies: - "@babel/runtime-corejs3" "^7.8.3" +yallist@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" + integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== diff --git a/packages/eslint-plugin-react-native-community/__tests__/error-subclass-name-test.js b/packages/eslint-plugin-react-native-community/__tests__/error-subclass-name-test.js index 6a11a6f3ae5c..39787fb0944b 100644 --- a/packages/eslint-plugin-react-native-community/__tests__/error-subclass-name-test.js +++ b/packages/eslint-plugin-react-native-community/__tests__/error-subclass-name-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js b/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js index ea767a705b79..3f8ccad13b90 100644 --- a/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-react-native-community/__tests__/eslint-tester.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-react-native-community/__tests__/platform-colors-test.js b/packages/eslint-plugin-react-native-community/__tests__/platform-colors-test.js index 75343c258649..892b67825dc8 100644 --- a/packages/eslint-plugin-react-native-community/__tests__/platform-colors-test.js +++ b/packages/eslint-plugin-react-native-community/__tests__/platform-colors-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,23 +29,19 @@ eslintTester.run('../platform-colors', rule, { errors: [{message: rule.meta.messages.platformColorArgsLength}], }, { - code: - "const labelColor = 'labelColor'; const color = PlatformColor(labelColor);", + code: "const labelColor = 'labelColor'; const color = PlatformColor(labelColor);", errors: [{message: rule.meta.messages.platformColorArgTypes}], }, { - code: - "const tuple = {light: 'black', dark: 'white'}; const color = DynamicColorIOS(tuple);", + code: "const tuple = {light: 'black', dark: 'white'}; const color = DynamicColorIOS(tuple);", errors: [{message: rule.meta.messages.dynamicColorIOSArg}], }, { - code: - "const black = 'black'; const color = DynamicColorIOS({light: black, dark: 'white'});", + code: "const black = 'black'; const color = DynamicColorIOS({light: black, dark: 'white'});", errors: [{message: rule.meta.messages.dynamicColorIOSLight}], }, { - code: - "const white = 'white'; const color = DynamicColorIOS({light: 'black', dark: white});", + code: "const white = 'white'; const color = DynamicColorIOS({light: 'black', dark: white});", errors: [{message: rule.meta.messages.dynamicColorIOSDark}], }, ], diff --git a/packages/eslint-plugin-react-native-community/error-subclass-name.js b/packages/eslint-plugin-react-native-community/error-subclass-name.js index 0c0c8f33f127..3791436ba813 100644 --- a/packages/eslint-plugin-react-native-community/error-subclass-name.js +++ b/packages/eslint-plugin-react-native-community/error-subclass-name.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-react-native-community/index.js b/packages/eslint-plugin-react-native-community/index.js index 22d01cce278d..3a1fa9896a49 100644 --- a/packages/eslint-plugin-react-native-community/index.js +++ b/packages/eslint-plugin-react-native-community/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-react-native-community/no-haste-imports.js b/packages/eslint-plugin-react-native-community/no-haste-imports.js index 5282c6950ec2..6c5c855a2ab4 100644 --- a/packages/eslint-plugin-react-native-community/no-haste-imports.js +++ b/packages/eslint-plugin-react-native-community/no-haste-imports.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-react-native-community/platform-colors.js b/packages/eslint-plugin-react-native-community/platform-colors.js index 12e8f908f90a..fe0999fe048d 100644 --- a/packages/eslint-plugin-react-native-community/platform-colors.js +++ b/packages/eslint-plugin-react-native-community/platform-colors.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,9 +29,9 @@ module.exports = { schema: [], }, - create: function(context) { + create: function (context) { return { - CallExpression: function(node) { + CallExpression: function (node) { if (node.callee.name === 'PlatformColor') { const args = node.arguments; if (args.length === 0) { diff --git a/packages/eslint-plugin-codegen/BUCK b/packages/eslint-plugin-specs/BUCK similarity index 100% rename from packages/eslint-plugin-codegen/BUCK rename to packages/eslint-plugin-specs/BUCK diff --git a/packages/eslint-plugin-codegen/__tests__/eslint-tester.js b/packages/eslint-plugin-specs/__tests__/eslint-tester.js similarity index 88% rename from packages/eslint-plugin-codegen/__tests__/eslint-tester.js rename to packages/eslint-plugin-specs/__tests__/eslint-tester.js index ea767a705b79..3f8ccad13b90 100644 --- a/packages/eslint-plugin-codegen/__tests__/eslint-tester.js +++ b/packages/eslint-plugin-specs/__tests__/eslint-tester.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-codegen/__tests__/react-native-modules-test.js b/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js similarity index 95% rename from packages/eslint-plugin-codegen/__tests__/react-native-modules-test.js rename to packages/eslint-plugin-specs/__tests__/react-native-modules-test.js index 7591ffb86a8d..afa544725c37 100644 --- a/packages/eslint-plugin-codegen/__tests__/react-native-modules-test.js +++ b/packages/eslint-plugin-specs/__tests__/react-native-modules-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-codegen/index.js b/packages/eslint-plugin-specs/index.js similarity index 86% rename from packages/eslint-plugin-codegen/index.js rename to packages/eslint-plugin-specs/index.js index 60a5f864f7ac..4a0b58ad5572 100644 --- a/packages/eslint-plugin-codegen/index.js +++ b/packages/eslint-plugin-specs/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/eslint-plugin-codegen/package.json b/packages/eslint-plugin-specs/package.json similarity index 73% rename from packages/eslint-plugin-codegen/package.json rename to packages/eslint-plugin-specs/package.json index f82575f74cb0..77f5d4b6021e 100644 --- a/packages/eslint-plugin-codegen/package.json +++ b/packages/eslint-plugin-specs/package.json @@ -1,12 +1,15 @@ { - "name": "@react-native/eslint-plugin-codegen", - "version": "0.0.1", + "name": "@react-native/eslint-plugin-specs", + "version": "0.0.3", "description": "ESLint rules to validate NativeModule and Component Specs", "main": "index.js", "repository": { "type": "git", "url": "git@github.com:facebook/react-native.git", - "directory": "packages/eslint-plugin-codegen" + "directory": "packages/eslint-plugin-specs" + }, + "scripts": { + "prepublish": "node prepublish.js" }, "dependencies": { "@babel/core": "^7.14.0", diff --git a/packages/eslint-plugin-specs/prepublish.js b/packages/eslint-plugin-specs/prepublish.js new file mode 100644 index 000000000000..3a3c44514976 --- /dev/null +++ b/packages/eslint-plugin-specs/prepublish.js @@ -0,0 +1,44 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const fs = require('fs'); + +/** + * script to prepare package for publish. + * + * Due to differences to how we consume internal packages, update a flag + */ + +fs.readFile('./react-native-modules.js', 'utf8', function (readError, source) { + if (readError != null) { + return console.error( + 'Failed to read react-native-modules.js for publish', + readError, + ); + } + + const result = source.replace( + 'const PACKAGE_USAGE = false;', + 'const PACKAGE_USAGE = true;', + ); + + fs.writeFile( + './react-native-modules.js', + result, + 'utf8', + function (writeError) { + if (writeError != null) { + return console.error( + 'Failed to update react-native-modules.js for publish', + writeError, + ); + } + }, + ); +}); diff --git a/packages/eslint-plugin-codegen/react-native-modules.js b/packages/eslint-plugin-specs/react-native-modules.js similarity index 72% rename from packages/eslint-plugin-codegen/react-native-modules.js rename to packages/eslint-plugin-specs/react-native-modules.js index 476624d024b7..ae0041b04844 100644 --- a/packages/eslint-plugin-codegen/react-native-modules.js +++ b/packages/eslint-plugin-specs/react-native-modules.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,6 +13,8 @@ const path = require('path'); const withBabelRegister = require('./with-babel-register'); +// We run yarn prepublish before publishing package which will set this value to true +const PACKAGE_USAGE = false; const ERRORS = { misnamedHasteModule(hasteModuleName) { return `Module ${hasteModuleName}: All files using TurboModuleRegistry must start with Native.`; @@ -24,15 +26,28 @@ let RNParserUtils; function requireModuleParser() { if (RNModuleParser == null || RNParserUtils == null) { - const config = { - only: [/react-native-codegen\/src\//], - plugins: [require('@babel/plugin-transform-flow-strip-types').default], - }; - - withBabelRegister(config, () => { - RNModuleParser = require('react-native-codegen/src/parsers/flow/modules'); - RNParserUtils = require('react-native-codegen/src/parsers/flow/utils'); - }); + // If using this externally, we leverage react-native-codegen as published form + if (!PACKAGE_USAGE) { + const config = { + only: [/react-native-codegen\/src\//], + plugins: [require('@babel/plugin-transform-flow-strip-types').default], + }; + + withBabelRegister(config, () => { + RNModuleParser = require('react-native-codegen/src/parsers/flow/modules'); + RNParserUtils = require('react-native-codegen/src/parsers/flow/utils'); + }); + } else { + const config = { + only: [/react-native-codegen\/lib\//], + plugins: [require('@babel/plugin-transform-flow-strip-types').default], + }; + + withBabelRegister(config, () => { + RNModuleParser = require('react-native-codegen/lib/parsers/flow/modules'); + RNParserUtils = require('react-native-codegen/lib/parsers/flow/utils'); + }); + } } return { @@ -99,7 +114,7 @@ function rule(context) { let isModule = false; return { - 'Program:exit': function(node) { + 'Program:exit': function (node) { if (!isModule) { return; } @@ -112,10 +127,8 @@ function rule(context) { }); } - const { - buildModuleSchema, - createParserErrorCapturer, - } = requireModuleParser(); + const {buildModuleSchema, createParserErrorCapturer} = + requireModuleParser(); const flowParser = require('flow-parser'); const [parsingErrors, tryParse] = createParserErrorCapturer(); diff --git a/packages/eslint-plugin-codegen/with-babel-register/disk-cache.js b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js similarity index 95% rename from packages/eslint-plugin-codegen/with-babel-register/disk-cache.js rename to packages/eslint-plugin-specs/with-babel-register/disk-cache.js index 9d318a39bf6a..70184943ecc0 100644 --- a/packages/eslint-plugin-codegen/with-babel-register/disk-cache.js +++ b/packages/eslint-plugin-specs/with-babel-register/disk-cache.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,7 +24,7 @@ const packageJson = JSON.parse( const FILENAME = path.join( os.tmpdir(), - `.eslint-plugin-codegen.${packageJson.version}.disk-cache.json`, + `.eslint-plugin-specs.${packageJson.version}.disk-cache.json`, ); let data = {}; diff --git a/packages/eslint-plugin-codegen/with-babel-register/index.js b/packages/eslint-plugin-specs/with-babel-register/index.js similarity index 97% rename from packages/eslint-plugin-codegen/with-babel-register/index.js rename to packages/eslint-plugin-specs/with-babel-register/index.js index c8b2484e5fa5..649954b33b5e 100644 --- a/packages/eslint-plugin-codegen/with-babel-register/index.js +++ b/packages/eslint-plugin-specs/with-babel-register/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/normalize-color/__tests__/normalizeColor-test.js b/packages/normalize-color/__tests__/normalizeColor-test.js index fc68e4c95ba9..257ae1db0cbc 100644 --- a/packages/normalize-color/__tests__/normalizeColor-test.js +++ b/packages/normalize-color/__tests__/normalizeColor-test.js @@ -1,11 +1,11 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails oncall+react_native - * @flow stroct + * @flow strict * @format */ diff --git a/packages/normalize-color/index.js b/packages/normalize-color/index.js index 15f50bd788f6..a20b1c3486d4 100644 --- a/packages/normalize-color/index.js +++ b/packages/normalize-color/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -40,8 +40,8 @@ function normalizeColor(color) { if ((match = matchers.rgb.exec(color))) { return ( ((parse255(match[1]) << 24) | // r - (parse255(match[2]) << 16) | // g - (parse255(match[3]) << 8) | // b + (parse255(match[2]) << 16) | // g + (parse255(match[3]) << 8) | // b 0x000000ff) >>> // a 0 ); @@ -50,8 +50,8 @@ function normalizeColor(color) { if ((match = matchers.rgba.exec(color))) { return ( ((parse255(match[1]) << 24) | // r - (parse255(match[2]) << 16) | // g - (parse255(match[3]) << 8) | // b + (parse255(match[2]) << 16) | // g + (parse255(match[3]) << 8) | // b parse1(match[4])) >>> // a 0 ); @@ -61,11 +61,11 @@ function normalizeColor(color) { return ( parseInt( match[1] + - match[1] + // r - match[2] + - match[2] + // g - match[3] + - match[3] + // b + match[1] + // r + match[2] + + match[2] + // g + match[3] + + match[3] + // b 'ff', // a 16, ) >>> 0 @@ -81,11 +81,11 @@ function normalizeColor(color) { return ( parseInt( match[1] + - match[1] + // r - match[2] + - match[2] + // g - match[3] + - match[3] + // b + match[1] + // r + match[2] + + match[2] + // g + match[3] + + match[3] + // b match[4] + match[4], // a 16, diff --git a/packages/normalize-color/index.js.flow b/packages/normalize-color/index.js.flow index c6199ff6deeb..4d24656d835e 100644 --- a/packages/normalize-color/index.js.flow +++ b/packages/normalize-color/index.js.flow @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/polyfills/Object.es8.js b/packages/polyfills/Object.es8.js index 19ff4bb7d149..4925f6e2dee0 100644 --- a/packages/polyfills/Object.es8.js +++ b/packages/polyfills/Object.es8.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ * @nolint */ -(function() { +(function () { 'use strict'; const hasOwnProperty = Object.prototype.hasOwnProperty; @@ -19,7 +19,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries */ if (typeof Object.entries !== 'function') { - Object.entries = function(object) { + Object.entries = function (object) { // `null` and `undefined` values are not allowed. if (object == null) { throw new TypeError('Object.entries called on non-object'); @@ -40,7 +40,7 @@ * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values */ if (typeof Object.values !== 'function') { - Object.values = function(object) { + Object.values = function (object) { // `null` and `undefined` values are not allowed. if (object == null) { throw new TypeError('Object.values called on non-object'); diff --git a/packages/polyfills/__tests__/Object.es8-test.js b/packages/polyfills/__tests__/Object.es8-test.js index b52771226eb1..697b6cd1c3c4 100644 --- a/packages/polyfills/__tests__/Object.es8-test.js +++ b/packages/polyfills/__tests__/Object.es8-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/polyfills/console.js b/packages/polyfills/console.js index f82fb4d05bc1..e843f4f74caa 100644 --- a/packages/polyfills/console.js +++ b/packages/polyfills/console.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,7 +15,7 @@ * This pipes all of our console logging functions to native logging so that * JavaScript errors in required modules show up in Xcode via NSLog. */ -const inspect = (function() { +const inspect = (function () { // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -55,7 +55,7 @@ const inspect = (function() { function arrayToHash(array) { var hash = {}; - array.forEach(function(val, idx) { + array.forEach(function (val, idx) { hash[val] = true; }); @@ -153,7 +153,7 @@ const inspect = (function() { if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { - output = keys.map(function(key) { + output = keys.map(function (key) { return formatProperty( ctx, value, @@ -210,7 +210,7 @@ const inspect = (function() { output.push(''); } } - keys.forEach(function(key) { + keys.forEach(function (key) { if (!key.match(/^\d+$/)) { output.push( formatProperty(ctx, value, recurseTimes, visibleKeys, key, true), @@ -248,7 +248,7 @@ const inspect = (function() { if (array) { str = str .split('\n') - .map(function(line) { + .map(function (line) { return ' ' + line; }) .join('\n') @@ -258,7 +258,7 @@ const inspect = (function() { '\n' + str .split('\n') - .map(function(line) { + .map(function (line) { return ' ' + line; }) .join('\n'); @@ -290,7 +290,7 @@ const inspect = (function() { function reduceToSingleString(output, base, braces) { var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { + var length = output.reduce(function (prev, cur) { numLinesEst++; if (cur.indexOf('\n') >= 0) numLinesEst++; return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; @@ -396,13 +396,13 @@ INSPECTOR_LEVELS[LOG_LEVELS.error] = 'error'; const INSPECTOR_FRAMES_TO_SKIP = __DEV__ ? 2 : 1; function getNativeLogFunction(level) { - return function() { + return function () { let str; if (arguments.length === 1 && typeof arguments[0] === 'string') { str = arguments[0]; } else { str = Array.prototype.map - .call(arguments, function(arg) { + .call(arguments, function (arg) { return inspect(arg, {depth: 10}); }) .join(', '); @@ -443,7 +443,7 @@ function getNativeLogFunction(level) { } function repeat(element, n) { - return Array.apply(null, Array(n)).map(function() { + return Array.apply(null, Array(n)).map(function () { return element; }); } @@ -472,7 +472,7 @@ function consoleTablePolyfill(rows) { // Convert each cell to a string. Also // figure out max cell width for each column - columns.forEach(function(k, i) { + columns.forEach(function (k, i) { columnWidths[i] = k.length; for (var j = 0; j < rows.length; j++) { var cellStr = (rows[j][k] || '?').toString(); @@ -485,7 +485,7 @@ function consoleTablePolyfill(rows) { // Join all elements in the row into a single string with | separators // (appends extra spaces to each cell to make separators | aligned) function joinRow(row, space) { - var cells = row.map(function(cell, i) { + var cells = row.map(function (cell, i) { var extraSpaces = repeat(' ', columnWidths[i] - cell.length).join(''); return cell + extraSpaces; }); @@ -493,7 +493,7 @@ function consoleTablePolyfill(rows) { return cells.join(space + '|' + space); } - var separators = columnWidths.map(function(columnWidth) { + var separators = columnWidths.map(function (columnWidth) { return repeat('-', columnWidth).join(''); }); var separatorRow = joinRow(separators, '-'); @@ -579,7 +579,7 @@ if (global.nativeLoggingHook) { Object.keys(console).forEach(methodName => { const reactNativeMethod = console[methodName]; if (originalConsole[methodName]) { - console[methodName] = function() { + console[methodName] = function () { originalConsole[methodName](...arguments); reactNativeMethod.apply(console, arguments); }; @@ -591,7 +591,7 @@ if (global.nativeLoggingHook) { // supported by it. ['clear', 'dir', 'dirxml', 'profile', 'profileEnd'].forEach(methodName => { if (typeof originalConsole[methodName] === 'function') { - console[methodName] = function() { + console[methodName] = function () { originalConsole[methodName](...arguments); }; } diff --git a/packages/polyfills/error-guard.js b/packages/polyfills/error-guard.js index d642961ba34f..d94274721a08 100644 --- a/packages/polyfills/error-guard.js +++ b/packages/polyfills/error-guard.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/polyfills/index.js b/packages/polyfills/index.js index 4b515f6a755c..5979051ac301 100644 --- a/packages/polyfills/index.js +++ b/packages/polyfills/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/.prettierrc b/packages/react-native-codegen/.prettierrc index 20374fd919f0..600a26c49518 100644 --- a/packages/react-native-codegen/.prettierrc +++ b/packages/react-native-codegen/.prettierrc @@ -1,7 +1,8 @@ { + "arrowParens": "avoid", + "bracketSameLine": true, + "bracketSpacing": false, "requirePragma": true, "singleQuote": true, - "trailingComma": "all", - "bracketSpacing": false, - "jsxBracketSameLine": true + "trailingComma": "all" } diff --git a/packages/react-native-codegen/DEFS.bzl b/packages/react-native-codegen/DEFS.bzl index a5211ce5858c..19d07e9d3ef8 100644 --- a/packages/react-native-codegen/DEFS.bzl +++ b/packages/react-native-codegen/DEFS.bzl @@ -1,4 +1,4 @@ -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/emptyFile.cpp b/packages/react-native-codegen/buck_tests/emptyFile.cpp index a68c679491ae..624a0fdeda85 100644 --- a/packages/react-native-codegen/buck_tests/emptyFile.cpp +++ b/packages/react-native-codegen/buck_tests/emptyFile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,6 @@ // TODO: Import every prop and event to asset they're generated -int main(){ - return 0; +int main() { + return 0; } diff --git a/packages/react-native-codegen/buck_tests/emptyFile.mm b/packages/react-native-codegen/buck_tests/emptyFile.mm index a7713b5da4db..8dac3f61a54f 100644 --- a/packages/react-native-codegen/buck_tests/emptyFile.mm +++ b/packages/react-native-codegen/buck_tests/emptyFile.mm @@ -1,17 +1,18 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ +#import #import #import -#import #import // TODO: Import every prop and event to asset they're generated -int main(){ - return 0; +int main() +{ + return 0; } diff --git a/packages/react-native-codegen/buck_tests/java/ArrayPropsNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/ArrayPropsNativeComponentViewManager.java index 2811ae02b2f4..9a13a534a07e 100644 --- a/packages/react-native-codegen/buck_tests/java/ArrayPropsNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/ArrayPropsNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/BooleanPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/BooleanPropNativeComponentViewManager.java index 8421c6417993..102c55a43ea8 100644 --- a/packages/react-native-codegen/buck_tests/java/BooleanPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/BooleanPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/ColorPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/ColorPropNativeComponentViewManager.java index 96144cd50854..97fb8e0accd8 100644 --- a/packages/react-native-codegen/buck_tests/java/ColorPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/ColorPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/EdgeInsetsPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/EdgeInsetsPropNativeComponentViewManager.java index 207b3f357fd7..a1d14a7025b1 100644 --- a/packages/react-native-codegen/buck_tests/java/EdgeInsetsPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/EdgeInsetsPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/EnumPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/EnumPropNativeComponentViewManager.java index 9b7ec1fa7b7b..a7fd1c09b699 100644 --- a/packages/react-native-codegen/buck_tests/java/EnumPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/EnumPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/EventNestedObjectPropsNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/EventNestedObjectPropsNativeComponentViewManager.java index 29e1d28a4f8f..def1346b2f22 100644 --- a/packages/react-native-codegen/buck_tests/java/EventNestedObjectPropsNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/EventNestedObjectPropsNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/EventPropsNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/EventPropsNativeComponentViewManager.java index 1bba0eaef425..96cd9ad9b5ce 100644 --- a/packages/react-native-codegen/buck_tests/java/EventPropsNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/EventPropsNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/FloatPropsNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/FloatPropsNativeComponentViewManager.java index 3cad8d148358..b620fba704df 100644 --- a/packages/react-native-codegen/buck_tests/java/FloatPropsNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/FloatPropsNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/ImagePropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/ImagePropNativeComponentViewManager.java index c437963969bd..ec64469d725a 100644 --- a/packages/react-native-codegen/buck_tests/java/ImagePropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/ImagePropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/IntegerPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/IntegerPropNativeComponentViewManager.java index 7658e141c90a..7c24b7206312 100644 --- a/packages/react-native-codegen/buck_tests/java/IntegerPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/IntegerPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/InterfaceOnlyNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/InterfaceOnlyNativeComponentViewManager.java index fcaffebed1a1..a14f8d1e7fb1 100644 --- a/packages/react-native-codegen/buck_tests/java/InterfaceOnlyNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/InterfaceOnlyNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/MultiNativePropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/MultiNativePropNativeComponentViewManager.java index 6cc8bf7eeaaa..776213db5a56 100644 --- a/packages/react-native-codegen/buck_tests/java/MultiNativePropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/MultiNativePropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/NoPropsNoEventsNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/NoPropsNoEventsNativeComponentViewManager.java index 3f930219142b..2055db426626 100644 --- a/packages/react-native-codegen/buck_tests/java/NoPropsNoEventsNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/NoPropsNoEventsNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java b/packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java index c73ed057f95d..592f9050560a 100644 --- a/packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java +++ b/packages/react-native-codegen/buck_tests/java/ObjectPropsNativeComponentManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/PointPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/PointPropNativeComponentViewManager.java index d117a0205f7a..63383fe8d4ec 100644 --- a/packages/react-native-codegen/buck_tests/java/PointPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/PointPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/buck_tests/java/StringPropNativeComponentViewManager.java b/packages/react-native-codegen/buck_tests/java/StringPropNativeComponentViewManager.java index 0ad67d3d581b..15e10043d54a 100644 --- a/packages/react-native-codegen/buck_tests/java/StringPropNativeComponentViewManager.java +++ b/packages/react-native-codegen/buck_tests/java/StringPropNativeComponentViewManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js index 6c9a09da6777..fc24aadc4aeb 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ArrayPropsNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,10 +8,7 @@ * @flow strict-local */ -import type { - PointValue, - EdgeInsetsValue, -} from '../../../../../Libraries/StyleSheet/StyleSheetTypes'; +import type {PointValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes'; import type {ColorValue} from '../../../../../Libraries/StyleSheet/StyleSheet'; import type {ImageSource} from '../../../../../Libraries/Image/ImageSource'; import type { @@ -34,7 +31,8 @@ type NativeProps = $ReadOnly<{| colors?: $ReadOnlyArray, srcs?: $ReadOnlyArray, points?: $ReadOnlyArray, - edgeInsets?: $ReadOnlyArray, + // TODO(T104760003) Fix EdgeInsetsValue in codegen + // edgeInsets?: $ReadOnlyArray, sizes?: WithDefault<$ReadOnlyArray<'small' | 'large'>, 'small'>, object?: $ReadOnlyArray<$ReadOnly<{|prop: string|}>>, |}>; diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js index 289b6ff1003b..8a1c8ae458e5 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/BooleanPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js index b8dcdaf96dbd..a01dedbd75ec 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ColorPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js index bad3a5a98259..a30e80d93419 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EdgeInsetsPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,6 @@ * @flow strict-local */ -import type {EdgeInsetsValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes'; import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes'; import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent'; import type {HostComponent} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes'; @@ -17,7 +16,8 @@ type NativeProps = $ReadOnly<{| ...ViewProps, // Props - contentInset?: EdgeInsetsValue, + // TODO(T104760003) Fix EdgeInsetsValue in codegen + // contentInset?: EdgeInsetsValue, |}>; export default (codegenNativeComponent( diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js index 72b1f5952fb6..b8f113e5df39 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EnumPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js index a12ed0ce45f7..50d336cb9ce7 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventNestedObjectPropsNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js index 8de54ec1db11..77193d4452e7 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/EventPropsNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js index a0a31bf3de68..3793ef93284d 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/FloatPropsNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js index 63b4a98a9e7d..f90a857afd80 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ImagePropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js index 1718b8877bdd..f9cd8dadc9fe 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/IntegerPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js index aa33dfd4c814..ec192240ddeb 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/InterfaceOnlyNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js index 675ddf1942cf..a1a2b601d7f4 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/MultiNativePropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js index d5b821db8f6a..2beb9ecb9cd6 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/NoPropsNoEventsNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js index d39dbb5eb0f1..8d7391970a35 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/ObjectPropsNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js index 0d450b8acd97..ad6edbac37bc 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/PointPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js b/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js index 2da62e34fbd9..478375d6e2df 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/components/StringPropNativeComponent.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js index 291f0f6887a7..5b7d621a6557 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeArrayTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js index 4c417f55164d..a898b1302883 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeBooleanTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js index 753547d8cf46..71bb14cf72f8 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeCallbackTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js index 4272eb381f0c..e56e0346ad1d 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNullableTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js index 1efc1b632138..e47a31a2d3ed 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeNumberTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js index ea7782d9710d..e3b2d5df8c5a 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeObjectTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js index 2408df34d5d3..692bd52ff73c 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeOptionalObjectTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js index 34a75f6e369e..610b3bab899a 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativePromiseTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js index bda6ca6a9130..12496b4ec75d 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js index 7ee503fdce5a..d320bd2fb338 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleArrays.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js index 1c174e7f9a8e..2a736f08e927 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullable.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js index 7863aef42569..b8981a22ab2d 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleNullableAndOptional.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js index 52343aebb423..d1b56f989388 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeSampleTurboModuleOptional.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js index 684a867d695c..b78372382b82 100644 --- a/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js +++ b/packages/react-native-codegen/e2e/__test_fixtures__/modules/NativeStringTurboModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js new file mode 100644 index 000000000000..d43988adbbe6 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentDescriptorH-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateComponentDescriptorH'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateComponentDescriptorH can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js new file mode 100644 index 000000000000..9b601d20dd3f --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateComponentHObjCpp-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateComponentHObjCpp'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateComponentHObjCpp can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js new file mode 100644 index 000000000000..09532b0f23d9 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterCpp-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateEventEmitterCpp'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateEventEmitterCpp can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js new file mode 100644 index 000000000000..fa8da739ed4a --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateEventEmitterH-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateEventEmitterH'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateEventEmitterH can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js new file mode 100644 index 000000000000..8bd33f16ca67 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsCpp-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GeneratePropsCpp'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GeneratePropsCpp can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js new file mode 100644 index 000000000000..950e4690e5fd --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsH-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GeneratePropsH'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GeneratePropsH can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js new file mode 100644 index 000000000000..9ffa4e7f2220 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaDelegate-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GeneratePropsJavaDelegate'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GeneratePropsJavaDelegate can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js new file mode 100644 index 000000000000..54069af6be45 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GeneratePropsJavaInterface-test.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GeneratePropsJavaInterface'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GeneratePropsJavaInterface can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema, undefined, false); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js new file mode 100644 index 000000000000..39e88c5f1c33 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeCpp-test.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateShadowNodeCpp'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateShadowNodeCpp can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema, undefined, false); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js new file mode 100644 index 000000000000..330625b57b47 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateShadowNodeH-test.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateShadowNodeH'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateShadowNodeH can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema, undefined, false); + expect(Object.fromEntries(output)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js b/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js new file mode 100644 index 000000000000..116a74ef1faa --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/GenerateViewConfigJs-test.js @@ -0,0 +1,29 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const parser = require('../../../src/parsers/flow'); +const generator = require('../../../src/generators/components/GenerateViewConfigJs'); +const fs = require('fs'); + +const FIXTURE_DIR = `${__dirname}/../../__test_fixtures__/components`; + +const fixtures = fs.readdirSync(FIXTURE_DIR); + +fixtures.forEach(fixture => { + it(`GenerateViewConfigJs can generate for '${fixture}'`, () => { + const libName = 'RNCodegenModuleFixtures'; + const schema = parser.parseFile(`${FIXTURE_DIR}/${fixture}`); + const output = generator.generate(libName, schema); + expect(output).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateComponentDescriptorH-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateComponentDescriptorH-test.js.snap new file mode 100644 index 000000000000..7c91b013e455 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateComponentDescriptorH-test.js.snap @@ -0,0 +1,449 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateComponentDescriptorH can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using ArrayPropsNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using BooleanPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using ColorPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using EdgeInsetsPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using EnumPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using EventNestedObjectPropsNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using EventPropsNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using FloatPropsNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using ImagePropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using IntegerPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using MultiNativePropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using NoPropsNoEventsNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using ObjectPropsNativeComponentComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using PointPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateComponentDescriptorH can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "ComponentDescriptors.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateComponentDescriptorH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +using StringPropNativeComponentViewComponentDescriptor = ConcreteComponentDescriptor; + +} // namespace react +} // namespace facebook +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateComponentHObjCpp-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateComponentHObjCpp-test.js.snap new file mode 100644 index 000000000000..3a6cc0fb294a --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateComponentHObjCpp-test.js.snap @@ -0,0 +1,401 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateComponentHObjCpp can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTArrayPropsNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTBooleanPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTColorPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTEdgeInsetsPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTEnumPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTEventNestedObjectPropsNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTEventPropsNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTFloatPropsNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTImagePropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTIntegerPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTInterfaceOnlyNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTMultiNativePropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTNoPropsNoEventsNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTObjectPropsNativeComponentViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTPointPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; + +exports[`GenerateComponentHObjCpp can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "RCTComponentViewHelpers.h": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GenerateComponentHObjCpp.js +*/ + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol RCTStringPropNativeComponentViewViewProtocol + +@end + +NS_ASSUME_NONNULL_END", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterCpp-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterCpp-test.js.snap new file mode 100644 index 000000000000..07ce71990ed2 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterCpp-test.js.snap @@ -0,0 +1,469 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateEventEmitterCpp can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + +void EventNestedObjectPropsNativeComponentViewEventEmitter::onChange(OnChange event) const { + dispatchEvent(\\"change\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + { + auto location = jsi::Object(runtime); + { + auto source = jsi::Object(runtime); + source.setProperty(runtime, \\"url\\", event.location.source.url); + + location.setProperty(runtime, \\"source\\", source); + } +location.setProperty(runtime, \\"x\\", event.location.x); +location.setProperty(runtime, \\"y\\", event.location.y); + + payload.setProperty(runtime, \\"location\\", location); + } + return payload; + }); +} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + +void EventPropsNativeComponentViewEventEmitter::onChange(OnChange event) const { + dispatchEvent(\\"change\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + payload.setProperty(runtime, \\"value\\", event.value); +payload.setProperty(runtime, \\"source\\", event.source); +payload.setProperty(runtime, \\"progress\\", event.progress); +payload.setProperty(runtime, \\"scale\\", event.scale); + return payload; + }); +} +void EventPropsNativeComponentViewEventEmitter::onEventDirect(OnEventDirect event) const { + dispatchEvent(\\"eventDirect\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + payload.setProperty(runtime, \\"value\\", event.value); + return payload; + }); +} +void EventPropsNativeComponentViewEventEmitter::onEventDirectWithPaperName(OnEventDirectWithPaperName event) const { + dispatchEvent(\\"eventDirectWithPaperName\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + payload.setProperty(runtime, \\"value\\", event.value); + return payload; + }); +} +void EventPropsNativeComponentViewEventEmitter::onOrientationChange(OnOrientationChange event) const { + dispatchEvent(\\"orientationChange\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + payload.setProperty(runtime, \\"orientation\\", toString(event.orientation)); + return payload; + }); +} +void EventPropsNativeComponentViewEventEmitter::onEnd(OnEnd event) const { + dispatchEvent(\\"end\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + + return payload; + }); +} +void EventPropsNativeComponentViewEventEmitter::onEventBubblingWithPaperName(OnEventBubblingWithPaperName event) const { + dispatchEvent(\\"eventBubblingWithPaperName\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + + return payload; + }); +} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + +void InterfaceOnlyNativeComponentViewEventEmitter::onChange(OnChange event) const { + dispatchEvent(\\"change\\", [event=std::move(event)](jsi::Runtime &runtime) { + auto payload = jsi::Object(runtime); + payload.setProperty(runtime, \\"value\\", event.value); + return payload; + }); +} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterCpp can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; 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 new file mode 100644 index 000000000000..32980f779ae3 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateEventEmitterH-test.js.snap @@ -0,0 +1,499 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateEventEmitterH can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + +class EventNestedObjectPropsNativeComponentViewEventEmitter : public ViewEventEmitter { + public: + using ViewEventEmitter::ViewEventEmitter; + + struct OnChangeLocationSource { + std::string url; + }; + + struct OnChangeLocation { + OnChangeLocationSource source; + int x; + int y; + }; + + struct OnChange { + OnChangeLocation location; + }; + + void onChange(OnChange value) const; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + +class EventPropsNativeComponentViewEventEmitter : public ViewEventEmitter { + public: + using ViewEventEmitter::ViewEventEmitter; + + struct OnChange { + bool value; + std::string source; + int progress; + Float scale; + }; + + struct OnEventDirect { + bool value; + }; + + struct OnEventDirectWithPaperName { + bool value; + }; + + enum class OnOrientationChangeOrientation { + Landscape, + Portrait + }; + + static char const *toString(const OnOrientationChangeOrientation value) { + switch (value) { + case OnOrientationChangeOrientation::Landscape: return \\"landscape\\"; + case OnOrientationChangeOrientation::Portrait: return \\"portrait\\"; + } + } + + struct OnOrientationChange { + OnOrientationChangeOrientation orientation; + }; + + struct OnEnd { + + }; + + struct OnEventBubblingWithPaperName { + + }; + + void onChange(OnChange value) const; + + void onEventDirect(OnEventDirect value) const; + + void onEventDirectWithPaperName(OnEventDirectWithPaperName value) const; + + void onOrientationChange(OnOrientationChange value) const; + + void onEnd(OnEnd value) const; + + void onEventBubblingWithPaperName(OnEventBubblingWithPaperName value) const; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + +class InterfaceOnlyNativeComponentViewEventEmitter : public ViewEventEmitter { + public: + using ViewEventEmitter::ViewEventEmitter; + + struct OnChange { + bool value; + }; + + void onChange(OnChange value) const; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateEventEmitterH can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "EventEmitters.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateEventEmitterH.js + */ +#pragma once + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap new file mode 100644 index 000000000000..63443148619e --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsCpp-test.js.snap @@ -0,0 +1,557 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GeneratePropsCpp can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +ArrayPropsNativeComponentViewProps::ArrayPropsNativeComponentViewProps( + const PropsParserContext &context, + const ArrayPropsNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + names(convertRawProp(context, rawProps, \\"names\\", sourceProps.names, {})), + disableds(convertRawProp(context, rawProps, \\"disableds\\", sourceProps.disableds, {})), + progress(convertRawProp(context, rawProps, \\"progress\\", sourceProps.progress, {})), + radii(convertRawProp(context, rawProps, \\"radii\\", sourceProps.radii, {})), + colors(convertRawProp(context, rawProps, \\"colors\\", sourceProps.colors, {})), + srcs(convertRawProp(context, rawProps, \\"srcs\\", sourceProps.srcs, {})), + points(convertRawProp(context, rawProps, \\"points\\", sourceProps.points, {})), + sizes(convertRawProp(context, rawProps, \\"sizes\\", sourceProps.sizes, {static_cast(ArrayPropsNativeComponentViewSizes::Small)})), + object(convertRawProp(context, rawProps, \\"object\\", sourceProps.object, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +BooleanPropNativeComponentViewProps::BooleanPropNativeComponentViewProps( + const PropsParserContext &context, + const BooleanPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})), + disabledNullable(convertRawProp(context, rawProps, \\"disabledNullable\\", sourceProps.disabledNullable, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +ColorPropNativeComponentViewProps::ColorPropNativeComponentViewProps( + const PropsParserContext &context, + const ColorPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + tintColor(convertRawProp(context, rawProps, \\"tintColor\\", sourceProps.tintColor, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +EdgeInsetsPropNativeComponentViewProps::EdgeInsetsPropNativeComponentViewProps( + const PropsParserContext &context, + const EdgeInsetsPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) + + + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +EnumPropNativeComponentViewProps::EnumPropNativeComponentViewProps( + const PropsParserContext &context, + const EnumPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + alignment(convertRawProp(context, rawProps, \\"alignment\\", sourceProps.alignment, {EnumPropNativeComponentViewAlignment::Center})), + intervals(convertRawProp(context, rawProps, \\"intervals\\", sourceProps.intervals, {EnumPropNativeComponentViewIntervals::Intervals0})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +EventNestedObjectPropsNativeComponentViewProps::EventNestedObjectPropsNativeComponentViewProps( + const PropsParserContext &context, + const EventNestedObjectPropsNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +EventPropsNativeComponentViewProps::EventPropsNativeComponentViewProps( + const PropsParserContext &context, + const EventPropsNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + disabled(convertRawProp(context, rawProps, \\"disabled\\", sourceProps.disabled, {false})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +FloatPropsNativeComponentViewProps::FloatPropsNativeComponentViewProps( + const PropsParserContext &context, + const FloatPropsNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + blurRadius(convertRawProp(context, rawProps, \\"blurRadius\\", sourceProps.blurRadius, {0.0})), + blurRadius2(convertRawProp(context, rawProps, \\"blurRadius2\\", sourceProps.blurRadius2, {0.001})), + blurRadius3(convertRawProp(context, rawProps, \\"blurRadius3\\", sourceProps.blurRadius3, {2.1})), + blurRadius4(convertRawProp(context, rawProps, \\"blurRadius4\\", sourceProps.blurRadius4, {0.0})), + blurRadius5(convertRawProp(context, rawProps, \\"blurRadius5\\", sourceProps.blurRadius5, {1.0})), + blurRadius6(convertRawProp(context, rawProps, \\"blurRadius6\\", sourceProps.blurRadius6, {0.0})), + blurRadiusNullable(convertRawProp(context, rawProps, \\"blurRadiusNullable\\", sourceProps.blurRadiusNullable, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +ImagePropNativeComponentViewProps::ImagePropNativeComponentViewProps( + const PropsParserContext &context, + const ImagePropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + thumbImage(convertRawProp(context, rawProps, \\"thumbImage\\", sourceProps.thumbImage, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +IntegerPropNativeComponentViewProps::IntegerPropNativeComponentViewProps( + const PropsParserContext &context, + const IntegerPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + progress1(convertRawProp(context, rawProps, \\"progress1\\", sourceProps.progress1, {0})), + progress2(convertRawProp(context, rawProps, \\"progress2\\", sourceProps.progress2, {-1})), + progress3(convertRawProp(context, rawProps, \\"progress3\\", sourceProps.progress3, {10})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +InterfaceOnlyNativeComponentViewProps::InterfaceOnlyNativeComponentViewProps( + const PropsParserContext &context, + const InterfaceOnlyNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + title(convertRawProp(context, rawProps, \\"title\\", sourceProps.title, {\\"\\"})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +MultiNativePropNativeComponentViewProps::MultiNativePropNativeComponentViewProps( + const PropsParserContext &context, + const MultiNativePropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + thumbImage(convertRawProp(context, rawProps, \\"thumbImage\\", sourceProps.thumbImage, {})), + color(convertRawProp(context, rawProps, \\"color\\", sourceProps.color, {})), + thumbTintColor(convertRawProp(context, rawProps, \\"thumbTintColor\\", sourceProps.thumbTintColor, {})), + point(convertRawProp(context, rawProps, \\"point\\", sourceProps.point, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +NoPropsNoEventsNativeComponentViewProps::NoPropsNoEventsNativeComponentViewProps( + const PropsParserContext &context, + const NoPropsNoEventsNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps) + + + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include +#include + +namespace facebook { +namespace react { + +ObjectPropsNativeComponentProps::ObjectPropsNativeComponentProps( + const PropsParserContext &context, + const ObjectPropsNativeComponentProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + objectProp(convertRawProp(context, rawProps, \\"objectProp\\", sourceProps.objectProp, {})), + objectArrayProp(convertRawProp(context, rawProps, \\"objectArrayProp\\", sourceProps.objectArrayProp, {})), + objectPrimitiveRequiredProp(convertRawProp(context, rawProps, \\"objectPrimitiveRequiredProp\\", sourceProps.objectPrimitiveRequiredProp, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +PointPropNativeComponentViewProps::PointPropNativeComponentViewProps( + const PropsParserContext &context, + const PointPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + startPoint(convertRawProp(context, rawProps, \\"startPoint\\", sourceProps.startPoint, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsCpp can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "Props.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsCpp.js + */ + +#include +#include +#include + +namespace facebook { +namespace react { + +StringPropNativeComponentViewProps::StringPropNativeComponentViewProps( + const PropsParserContext &context, + const StringPropNativeComponentViewProps &sourceProps, + const RawProps &rawProps): ViewProps(context, sourceProps, rawProps), + + placeholder(convertRawProp(context, rawProps, \\"placeholder\\", sourceProps.placeholder, {\\"\\"})), + defaultValue(convertRawProp(context, rawProps, \\"defaultValue\\", sourceProps.defaultValue, {})) + {} + +} // namespace react +} // namespace facebook +", +} +`; 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 new file mode 100644 index 000000000000..80ecae521eca --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsH-test.js.snap @@ -0,0 +1,853 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GeneratePropsH can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +namespace facebook { +namespace react { + +using ArrayPropsNativeComponentViewSizesMask = uint32_t; + +enum class ArrayPropsNativeComponentViewSizes: ArrayPropsNativeComponentViewSizesMask { + Small = 1 << 0, + Large = 1 << 1 +}; + +constexpr bool operator&( + ArrayPropsNativeComponentViewSizesMask const lhs, + enum ArrayPropsNativeComponentViewSizes const rhs) { + return lhs & static_cast(rhs); +} + +constexpr ArrayPropsNativeComponentViewSizesMask operator|( + ArrayPropsNativeComponentViewSizesMask const lhs, + enum ArrayPropsNativeComponentViewSizes const rhs) { + return lhs | static_cast(rhs); +} + +constexpr void operator|=( + ArrayPropsNativeComponentViewSizesMask &lhs, + enum ArrayPropsNativeComponentViewSizes const rhs) { + lhs = lhs | static_cast(rhs); +} + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewSizesMask &result) { + auto items = std::vector{value}; + for (const auto &item : items) { + if (item == \\"small\\") { + result |= ArrayPropsNativeComponentViewSizes::Small; + continue; + } + if (item == \\"large\\") { + result |= ArrayPropsNativeComponentViewSizes::Large; + continue; + } + abort(); + } +} + +static inline std::string toString(const ArrayPropsNativeComponentViewSizesMask &value) { + auto result = std::string{}; + auto separator = std::string{\\", \\"}; + + if (value & ArrayPropsNativeComponentViewSizes::Small) { + result += \\"small\\" + separator; + } + if (value & ArrayPropsNativeComponentViewSizes::Large) { + result += \\"large\\" + separator; + } + if (!result.empty()) { + result.erase(result.length() - separator.length()); + } + return result; +} +struct ArrayPropsNativeComponentViewObjectStruct { + std::string prop; +}; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentViewObjectStruct &result) { + auto map = (butter::map)value; + + auto tmp_prop = map.find(\\"prop\\"); + if (tmp_prop != map.end()) { + fromRawValue(context, tmp_prop->second, result.prop); + } +} + +static inline std::string toString(const ArrayPropsNativeComponentViewObjectStruct &value) { + return \\"[Object ArrayPropsNativeComponentViewObjectStruct]\\"; +} + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector &result) { + auto items = (std::vector)value; + for (const auto &item : items) { + ArrayPropsNativeComponentViewObjectStruct newItem; + fromRawValue(context, item, newItem); + result.emplace_back(newItem); + } +} + +class ArrayPropsNativeComponentViewProps final : public ViewProps { + public: + ArrayPropsNativeComponentViewProps() = default; + ArrayPropsNativeComponentViewProps(const PropsParserContext& context, const ArrayPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + std::vector names{}; + std::vector disableds{}; + std::vector progress{}; + std::vector radii{}; + std::vector colors{}; + std::vector srcs{}; + std::vector points{}; + ArrayPropsNativeComponentViewSizesMask sizes{static_cast(ArrayPropsNativeComponentViewSizes::Small)}; + std::vector object{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class BooleanPropNativeComponentViewProps final : public ViewProps { + public: + BooleanPropNativeComponentViewProps() = default; + BooleanPropNativeComponentViewProps(const PropsParserContext& context, const BooleanPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + bool disabled{false}; + bool disabledNullable{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +class ColorPropNativeComponentViewProps final : public ViewProps { + public: + ColorPropNativeComponentViewProps() = default; + ColorPropNativeComponentViewProps(const PropsParserContext& context, const ColorPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + SharedColor tintColor{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class EdgeInsetsPropNativeComponentViewProps final : public ViewProps { + public: + EdgeInsetsPropNativeComponentViewProps() = default; + EdgeInsetsPropNativeComponentViewProps(const PropsParserContext& context, const EdgeInsetsPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +enum class EnumPropNativeComponentViewAlignment { Top, Center, BottomRight }; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnumPropNativeComponentViewAlignment &result) { + auto string = (std::string)value; + if (string == \\"top\\") { result = EnumPropNativeComponentViewAlignment::Top; return; } + if (string == \\"center\\") { result = EnumPropNativeComponentViewAlignment::Center; return; } + if (string == \\"bottom-right\\") { result = EnumPropNativeComponentViewAlignment::BottomRight; return; } + abort(); +} + +static inline std::string toString(const EnumPropNativeComponentViewAlignment &value) { + switch (value) { + case EnumPropNativeComponentViewAlignment::Top: return \\"top\\"; + case EnumPropNativeComponentViewAlignment::Center: return \\"center\\"; + case EnumPropNativeComponentViewAlignment::BottomRight: return \\"bottom-right\\"; + } +} +enum class EnumPropNativeComponentViewIntervals { Intervals0 = 0, Intervals15 = 15, Intervals30 = 30, Intervals60 = 60 }; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, EnumPropNativeComponentViewIntervals &result) { + assert(value.hasType()); + auto integerValue = (int)value; + switch (integerValue) { + case 0: + result = EnumPropNativeComponentViewIntervals::Intervals0; + return; + case 15: + result = EnumPropNativeComponentViewIntervals::Intervals15; + return; + case 30: + result = EnumPropNativeComponentViewIntervals::Intervals30; + return; + case 60: + result = EnumPropNativeComponentViewIntervals::Intervals60; + return; + } + abort(); +} + +static inline std::string toString(const EnumPropNativeComponentViewIntervals &value) { + switch (value) { + case EnumPropNativeComponentViewIntervals::Intervals0: return \\"0\\"; + case EnumPropNativeComponentViewIntervals::Intervals15: return \\"15\\"; + case EnumPropNativeComponentViewIntervals::Intervals30: return \\"30\\"; + case EnumPropNativeComponentViewIntervals::Intervals60: return \\"60\\"; + } +} + +class EnumPropNativeComponentViewProps final : public ViewProps { + public: + EnumPropNativeComponentViewProps() = default; + EnumPropNativeComponentViewProps(const PropsParserContext& context, const EnumPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + EnumPropNativeComponentViewAlignment alignment{EnumPropNativeComponentViewAlignment::Center}; + EnumPropNativeComponentViewIntervals intervals{EnumPropNativeComponentViewIntervals::Intervals0}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class EventNestedObjectPropsNativeComponentViewProps final : public ViewProps { + public: + EventNestedObjectPropsNativeComponentViewProps() = default; + EventNestedObjectPropsNativeComponentViewProps(const PropsParserContext& context, const EventNestedObjectPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + bool disabled{false}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class EventPropsNativeComponentViewProps final : public ViewProps { + public: + EventPropsNativeComponentViewProps() = default; + EventPropsNativeComponentViewProps(const PropsParserContext& context, const EventPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + bool disabled{false}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class FloatPropsNativeComponentViewProps final : public ViewProps { + public: + FloatPropsNativeComponentViewProps() = default; + FloatPropsNativeComponentViewProps(const PropsParserContext& context, const FloatPropsNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + Float blurRadius{0.0}; + Float blurRadius2{0.001}; + Float blurRadius3{2.1}; + Float blurRadius4{0.0}; + Float blurRadius5{1.0}; + Float blurRadius6{0.0}; + Float blurRadiusNullable{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +class ImagePropNativeComponentViewProps final : public ViewProps { + public: + ImagePropNativeComponentViewProps() = default; + ImagePropNativeComponentViewProps(const PropsParserContext& context, const ImagePropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + ImageSource thumbImage{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class IntegerPropNativeComponentViewProps final : public ViewProps { + public: + IntegerPropNativeComponentViewProps() = default; + IntegerPropNativeComponentViewProps(const PropsParserContext& context, const IntegerPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + int progress1{0}; + int progress2{-1}; + int progress3{10}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class InterfaceOnlyNativeComponentViewProps final : public ViewProps { + public: + InterfaceOnlyNativeComponentViewProps() = default; + InterfaceOnlyNativeComponentViewProps(const PropsParserContext& context, const InterfaceOnlyNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + std::string title{\\"\\"}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include +#include +#include +#include + +namespace facebook { +namespace react { + +class MultiNativePropNativeComponentViewProps final : public ViewProps { + public: + MultiNativePropNativeComponentViewProps() = default; + MultiNativePropNativeComponentViewProps(const PropsParserContext& context, const MultiNativePropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + ImageSource thumbImage{}; + SharedColor color{}; + SharedColor thumbTintColor{}; + Point point{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class NoPropsNoEventsNativeComponentViewProps final : public ViewProps { + public: + NoPropsNoEventsNativeComponentViewProps() = default; + NoPropsNoEventsNativeComponentViewProps(const PropsParserContext& context, const NoPropsNoEventsNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace facebook { +namespace react { + +enum class ObjectPropsNativeComponentStringEnumProp { Small, Large }; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentStringEnumProp &result) { + auto string = (std::string)value; + if (string == \\"small\\") { result = ObjectPropsNativeComponentStringEnumProp::Small; return; } + if (string == \\"large\\") { result = ObjectPropsNativeComponentStringEnumProp::Large; return; } + abort(); +} + +static inline std::string toString(const ObjectPropsNativeComponentStringEnumProp &value) { + switch (value) { + case ObjectPropsNativeComponentStringEnumProp::Small: return \\"small\\"; + case ObjectPropsNativeComponentStringEnumProp::Large: return \\"large\\"; + } +} +enum class ObjectPropsNativeComponentIntEnumProp { IntEnumProp0 = 0, IntEnumProp1 = 1 }; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentIntEnumProp &result) { + assert(value.hasType()); + auto integerValue = (int)value; + switch (integerValue) { + case 0: + result = ObjectPropsNativeComponentIntEnumProp::IntEnumProp0; + return; + case 1: + result = ObjectPropsNativeComponentIntEnumProp::IntEnumProp1; + return; + } + abort(); +} + +static inline std::string toString(const ObjectPropsNativeComponentIntEnumProp &value) { + switch (value) { + case ObjectPropsNativeComponentIntEnumProp::IntEnumProp0: return \\"0\\"; + case ObjectPropsNativeComponentIntEnumProp::IntEnumProp1: return \\"1\\"; + } +} +struct ObjectPropsNativeComponentObjectPropStruct { + std::string stringProp; + bool booleanProp; + Float floatProp; + int intProp; + ObjectPropsNativeComponentStringEnumProp stringEnumProp; + ObjectPropsNativeComponentIntEnumProp intEnumProp; +}; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPropStruct &result) { + auto map = (butter::map)value; + + auto tmp_stringProp = map.find(\\"stringProp\\"); + if (tmp_stringProp != map.end()) { + fromRawValue(context, tmp_stringProp->second, result.stringProp); + } + auto tmp_booleanProp = map.find(\\"booleanProp\\"); + if (tmp_booleanProp != map.end()) { + fromRawValue(context, tmp_booleanProp->second, result.booleanProp); + } + auto tmp_floatProp = map.find(\\"floatProp\\"); + if (tmp_floatProp != map.end()) { + fromRawValue(context, tmp_floatProp->second, result.floatProp); + } + auto tmp_intProp = map.find(\\"intProp\\"); + if (tmp_intProp != map.end()) { + fromRawValue(context, tmp_intProp->second, result.intProp); + } + auto tmp_stringEnumProp = map.find(\\"stringEnumProp\\"); + if (tmp_stringEnumProp != map.end()) { + fromRawValue(context, tmp_stringEnumProp->second, result.stringEnumProp); + } + auto tmp_intEnumProp = map.find(\\"intEnumProp\\"); + if (tmp_intEnumProp != map.end()) { + fromRawValue(context, tmp_intEnumProp->second, result.intEnumProp); + } +} + +static inline std::string toString(const ObjectPropsNativeComponentObjectPropStruct &value) { + return \\"[Object ObjectPropsNativeComponentObjectPropStruct]\\"; +} + +struct ObjectPropsNativeComponentObjectArrayPropStruct { + std::vector array; +}; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectArrayPropStruct &result) { + auto map = (butter::map)value; + + auto tmp_array = map.find(\\"array\\"); + if (tmp_array != map.end()) { + fromRawValue(context, tmp_array->second, result.array); + } +} + +static inline std::string toString(const ObjectPropsNativeComponentObjectArrayPropStruct &value) { + return \\"[Object ObjectPropsNativeComponentObjectArrayPropStruct]\\"; +} + +struct ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct { + ImageSource image; + SharedColor color; + Point point; +}; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &result) { + auto map = (butter::map)value; + + auto tmp_image = map.find(\\"image\\"); + if (tmp_image != map.end()) { + fromRawValue(context, tmp_image->second, result.image); + } + auto tmp_color = map.find(\\"color\\"); + if (tmp_color != map.end()) { + fromRawValue(context, tmp_color->second, result.color); + } + auto tmp_point = map.find(\\"point\\"); + if (tmp_point != map.end()) { + fromRawValue(context, tmp_point->second, result.point); + } +} + +static inline std::string toString(const ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct &value) { + return \\"[Object ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct]\\"; +} +class ObjectPropsNativeComponentProps final : public ViewProps { + public: + ObjectPropsNativeComponentProps() = default; + ObjectPropsNativeComponentProps(const PropsParserContext& context, const ObjectPropsNativeComponentProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + ObjectPropsNativeComponentObjectPropStruct objectProp{}; + ObjectPropsNativeComponentObjectArrayPropStruct objectArrayProp{}; + ObjectPropsNativeComponentObjectPrimitiveRequiredPropStruct objectPrimitiveRequiredProp{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +class PointPropNativeComponentViewProps final : public ViewProps { + public: + PointPropNativeComponentViewProps() = default; + PointPropNativeComponentViewProps(const PropsParserContext& context, const PointPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + Point startPoint{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GeneratePropsH can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "Props.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GeneratePropsH.js + */ +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +class StringPropNativeComponentViewProps final : public ViewProps { + public: + StringPropNativeComponentViewProps() = default; + StringPropNativeComponentViewProps(const PropsParserContext& context, const StringPropNativeComponentViewProps &sourceProps, const RawProps &rawProps); + +#pragma mark - Props + + std::string placeholder{\\"\\"}; + std::string defaultValue{}; +}; + +} // namespace react +} // namespace facebook +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaDelegate-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaDelegate-test.js.snap new file mode 100644 index 000000000000..6e97f60966f9 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaDelegate-test.js.snap @@ -0,0 +1,660 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GeneratePropsJavaDelegate can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableArray; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class ArrayPropsNativeComponentViewManagerDelegate & ArrayPropsNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public ArrayPropsNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"names\\": + mViewManager.setNames(view, (ReadableArray) value); + break; + case \\"disableds\\": + mViewManager.setDisableds(view, (ReadableArray) value); + break; + case \\"progress\\": + mViewManager.setProgress(view, (ReadableArray) value); + break; + case \\"radii\\": + mViewManager.setRadii(view, (ReadableArray) value); + break; + case \\"colors\\": + mViewManager.setColors(view, (ReadableArray) value); + break; + case \\"srcs\\": + mViewManager.setSrcs(view, (ReadableArray) value); + break; + case \\"points\\": + mViewManager.setPoints(view, (ReadableArray) value); + break; + case \\"sizes\\": + mViewManager.setSizes(view, (ReadableArray) value); + break; + case \\"object\\": + mViewManager.setObject(view, (ReadableArray) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/BooleanPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class BooleanPropNativeComponentViewManagerDelegate & BooleanPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public BooleanPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"disabled\\": + mViewManager.setDisabled(view, value == null ? false : (boolean) value); + break; + case \\"disabledNullable\\": + mViewManager.setDisabledNullable(view, value == null ? null : (Boolean) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ColorPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ColorPropConverter; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class ColorPropNativeComponentViewManagerDelegate & ColorPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public ColorPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"tintColor\\": + mViewManager.setTintColor(view, ColorPropConverter.getColor(value, view.getContext())); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EdgeInsetsPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class EdgeInsetsPropNativeComponentViewManagerDelegate & EdgeInsetsPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public EdgeInsetsPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + super.setProperty(view, propName, value); + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EnumPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class EnumPropNativeComponentViewManagerDelegate & EnumPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public EnumPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"alignment\\": + mViewManager.setAlignment(view, (String) value); + break; + case \\"intervals\\": + mViewManager.setIntervals(view, value == null ? 0 : ((Double) value).intValue()); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EventNestedObjectPropsNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class EventNestedObjectPropsNativeComponentViewManagerDelegate & EventNestedObjectPropsNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public EventNestedObjectPropsNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"disabled\\": + mViewManager.setDisabled(view, value == null ? false : (boolean) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EventPropsNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class EventPropsNativeComponentViewManagerDelegate & EventPropsNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public EventPropsNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"disabled\\": + mViewManager.setDisabled(view, value == null ? false : (boolean) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/FloatPropsNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class FloatPropsNativeComponentViewManagerDelegate & FloatPropsNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public FloatPropsNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"blurRadius\\": + mViewManager.setBlurRadius(view, value == null ? Float.NaN : ((Double) value).floatValue()); + break; + case \\"blurRadius2\\": + mViewManager.setBlurRadius2(view, value == null ? 0.001f : ((Double) value).floatValue()); + break; + case \\"blurRadius3\\": + mViewManager.setBlurRadius3(view, value == null ? 2.1f : ((Double) value).floatValue()); + break; + case \\"blurRadius4\\": + mViewManager.setBlurRadius4(view, value == null ? 0f : ((Double) value).floatValue()); + break; + case \\"blurRadius5\\": + mViewManager.setBlurRadius5(view, value == null ? 1f : ((Double) value).floatValue()); + break; + case \\"blurRadius6\\": + mViewManager.setBlurRadius6(view, value == null ? 0f : ((Double) value).floatValue()); + break; + case \\"blurRadiusNullable\\": + mViewManager.setBlurRadiusNullable(view, value == null ? null : ((Double) value).floatValue()); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ImagePropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class ImagePropNativeComponentViewManagerDelegate & ImagePropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public ImagePropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"thumbImage\\": + mViewManager.setThumbImage(view, (ReadableMap) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/IntegerPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class IntegerPropNativeComponentViewManagerDelegate & IntegerPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public IntegerPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"progress1\\": + mViewManager.setProgress1(view, value == null ? 0 : ((Double) value).intValue()); + break; + case \\"progress2\\": + mViewManager.setProgress2(view, value == null ? -1 : ((Double) value).intValue()); + break; + case \\"progress3\\": + mViewManager.setProgress3(view, value == null ? 10 : ((Double) value).intValue()); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/InterfaceOnlyNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class InterfaceOnlyNativeComponentViewManagerDelegate & InterfaceOnlyNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public InterfaceOnlyNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"title\\": + mViewManager.setTitle(view, value == null ? \\"\\" : (String) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/MultiNativePropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ColorPropConverter; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class MultiNativePropNativeComponentViewManagerDelegate & MultiNativePropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public MultiNativePropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"thumbImage\\": + mViewManager.setThumbImage(view, (ReadableMap) value); + break; + case \\"color\\": + mViewManager.setColor(view, ColorPropConverter.getColor(value, view.getContext())); + break; + case \\"thumbTintColor\\": + mViewManager.setThumbTintColor(view, ColorPropConverter.getColor(value, view.getContext())); + break; + case \\"point\\": + mViewManager.setPoint(view, (ReadableMap) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/NoPropsNoEventsNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class NoPropsNoEventsNativeComponentViewManagerDelegate & NoPropsNoEventsNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public NoPropsNoEventsNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + super.setProperty(view, propName, value); + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponentManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class ObjectPropsNativeComponentManagerDelegate & ObjectPropsNativeComponentManagerInterface> extends BaseViewManagerDelegate { + public ObjectPropsNativeComponentManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"objectProp\\": + mViewManager.setObjectProp(view, (ReadableMap) value); + break; + case \\"objectArrayProp\\": + mViewManager.setObjectArrayProp(view, (ReadableMap) value); + break; + case \\"objectPrimitiveRequiredProp\\": + mViewManager.setObjectPrimitiveRequiredProp(view, (ReadableMap) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/PointPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class PointPropNativeComponentViewManagerDelegate & PointPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public PointPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"startPoint\\": + mViewManager.setStartPoint(view, (ReadableMap) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; + +exports[`GeneratePropsJavaDelegate can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/StringPropNativeComponentViewManagerDelegate.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaDelegate.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.uimanager.BaseViewManagerDelegate; +import com.facebook.react.uimanager.BaseViewManagerInterface; + +public class StringPropNativeComponentViewManagerDelegate & StringPropNativeComponentViewManagerInterface> extends BaseViewManagerDelegate { + public StringPropNativeComponentViewManagerDelegate(U viewManager) { + super(viewManager); + } + @Override + public void setProperty(T view, String propName, @Nullable Object value) { + switch (propName) { + case \\"placeholder\\": + mViewManager.setPlaceholder(view, value == null ? \\"\\" : (String) value); + break; + case \\"defaultValue\\": + mViewManager.setDefaultValue(view, value == null ? null : (String) value); + break; + default: + super.setProperty(view, propName, value); + } + } +} +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaInterface-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaInterface-test.js.snap new file mode 100644 index 000000000000..973435ed6cb3 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GeneratePropsJavaInterface-test.js.snap @@ -0,0 +1,393 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GeneratePropsJavaInterface can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableArray; + +public interface ArrayPropsNativeComponentViewManagerInterface { + void setNames(T view, @Nullable ReadableArray value); + void setDisableds(T view, @Nullable ReadableArray value); + void setProgress(T view, @Nullable ReadableArray value); + void setRadii(T view, @Nullable ReadableArray value); + void setColors(T view, @Nullable ReadableArray value); + void setSrcs(T view, @Nullable ReadableArray value); + void setPoints(T view, @Nullable ReadableArray value); + void setSizes(T view, @Nullable ReadableArray value); + void setObject(T view, @Nullable ReadableArray value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/BooleanPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; + +public interface BooleanPropNativeComponentViewManagerInterface { + void setDisabled(T view, boolean value); + void setDisabledNullable(T view, @Nullable Boolean value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ColorPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; + +public interface ColorPropNativeComponentViewManagerInterface { + void setTintColor(T view, @Nullable Integer value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EdgeInsetsPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; + +public interface EdgeInsetsPropNativeComponentViewManagerInterface { + // No props +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EnumPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; + +public interface EnumPropNativeComponentViewManagerInterface { + void setAlignment(T view, @Nullable String value); + void setIntervals(T view, @Nullable Integer value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EventNestedObjectPropsNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; + +public interface EventNestedObjectPropsNativeComponentViewManagerInterface { + void setDisabled(T view, boolean value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/EventPropsNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; + +public interface EventPropsNativeComponentViewManagerInterface { + void setDisabled(T view, boolean value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/FloatPropsNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; + +public interface FloatPropsNativeComponentViewManagerInterface { + void setBlurRadius(T view, float value); + void setBlurRadius2(T view, float value); + void setBlurRadius3(T view, float value); + void setBlurRadius4(T view, float value); + void setBlurRadius5(T view, float value); + void setBlurRadius6(T view, float value); + void setBlurRadiusNullable(T view, @Nullable Float value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ImagePropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; + +public interface ImagePropNativeComponentViewManagerInterface { + void setThumbImage(T view, @Nullable ReadableMap value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/IntegerPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; + +public interface IntegerPropNativeComponentViewManagerInterface { + void setProgress1(T view, int value); + void setProgress2(T view, int value); + void setProgress3(T view, int value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/InterfaceOnlyNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; + +public interface InterfaceOnlyNativeComponentViewManagerInterface { + void setTitle(T view, @Nullable String value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/MultiNativePropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; + +public interface MultiNativePropNativeComponentViewManagerInterface { + void setThumbImage(T view, @Nullable ReadableMap value); + void setColor(T view, @Nullable Integer value); + void setThumbTintColor(T view, @Nullable Integer value); + void setPoint(T view, @Nullable ReadableMap value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/NoPropsNoEventsNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; + +public interface NoPropsNoEventsNativeComponentViewManagerInterface { + // No props +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponentManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; + +public interface ObjectPropsNativeComponentManagerInterface { + void setObjectProp(T view, @Nullable ReadableMap value); + void setObjectArrayProp(T view, @Nullable ReadableMap value); + void setObjectPrimitiveRequiredProp(T view, @Nullable ReadableMap value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/PointPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; +import com.facebook.react.bridge.ReadableMap; + +public interface PointPropNativeComponentViewManagerInterface { + void setStartPoint(T view, @Nullable ReadableMap value); +} +", +} +`; + +exports[`GeneratePropsJavaInterface can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "java/com/facebook/react/viewmanagers/StringPropNativeComponentViewManagerInterface.java": "/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). +* +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. +* +* @generated by codegen project: GeneratePropsJavaInterface.js +*/ + +package com.facebook.react.viewmanagers; + +import android.view.View; +import androidx.annotation.Nullable; + +public interface StringPropNativeComponentViewManagerInterface { + void setPlaceholder(T view, @Nullable String value); + void setDefaultValue(T view, @Nullable String value); +} +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateShadowNodeCpp-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateShadowNodeCpp-test.js.snap new file mode 100644 index 000000000000..a37b7ccaf377 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateShadowNodeCpp-test.js.snap @@ -0,0 +1,401 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateShadowNodeCpp can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char ArrayPropsNativeComponentViewComponentName[] = \\"ArrayPropsNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char BooleanPropNativeComponentViewComponentName[] = \\"BooleanPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char ColorPropNativeComponentViewComponentName[] = \\"ColorPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char EdgeInsetsPropNativeComponentViewComponentName[] = \\"EdgeInsetsPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char EnumPropNativeComponentViewComponentName[] = \\"EnumPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char EventNestedObjectPropsNativeComponentViewComponentName[] = \\"EventNestedObjectPropsNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char EventPropsNativeComponentViewComponentName[] = \\"EventPropsNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char FloatPropsNativeComponentViewComponentName[] = \\"FloatPropsNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char ImagePropNativeComponentViewComponentName[] = \\"ImagePropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char IntegerPropNativeComponentViewComponentName[] = \\"IntegerPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char MultiNativePropNativeComponentViewComponentName[] = \\"MultiNativePropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char NoPropsNoEventsNativeComponentViewComponentName[] = \\"NoPropsNoEventsNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char ObjectPropsNativeComponentComponentName[] = \\"ObjectPropsNativeComponent\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char PointPropNativeComponentViewComponentName[] = \\"PointPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeCpp can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.cpp": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeCpp.js + */ + +#include + +namespace facebook { +namespace react { + +extern const char StringPropNativeComponentViewComponentName[] = \\"StringPropNativeComponentView\\"; + +} // namespace react +} // namespace facebook +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateShadowNodeH-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateShadowNodeH-test.js.snap new file mode 100644 index 000000000000..6faa17060237 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateShadowNodeH-test.js.snap @@ -0,0 +1,558 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateShadowNodeH can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char ArrayPropsNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using ArrayPropsNativeComponentViewShadowNode = ConcreteViewShadowNode< + ArrayPropsNativeComponentViewComponentName, + ArrayPropsNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char BooleanPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using BooleanPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + BooleanPropNativeComponentViewComponentName, + BooleanPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'ColorPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char ColorPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using ColorPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + ColorPropNativeComponentViewComponentName, + ColorPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char EdgeInsetsPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using EdgeInsetsPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + EdgeInsetsPropNativeComponentViewComponentName, + EdgeInsetsPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'EnumPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char EnumPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using EnumPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + EnumPropNativeComponentViewComponentName, + EnumPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +extern const char EventNestedObjectPropsNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using EventNestedObjectPropsNativeComponentViewShadowNode = ConcreteViewShadowNode< + EventNestedObjectPropsNativeComponentViewComponentName, + EventNestedObjectPropsNativeComponentViewProps, +EventNestedObjectPropsNativeComponentViewEventEmitter>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'EventPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +extern const char EventPropsNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using EventPropsNativeComponentViewShadowNode = ConcreteViewShadowNode< + EventPropsNativeComponentViewComponentName, + EventPropsNativeComponentViewProps, +EventPropsNativeComponentViewEventEmitter>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char FloatPropsNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using FloatPropsNativeComponentViewShadowNode = ConcreteViewShadowNode< + FloatPropsNativeComponentViewComponentName, + FloatPropsNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'ImagePropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char ImagePropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using ImagePropNativeComponentViewShadowNode = ConcreteViewShadowNode< + ImagePropNativeComponentViewComponentName, + ImagePropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char IntegerPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using IntegerPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + IntegerPropNativeComponentViewComponentName, + IntegerPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char MultiNativePropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using MultiNativePropNativeComponentViewShadowNode = ConcreteViewShadowNode< + MultiNativePropNativeComponentViewComponentName, + MultiNativePropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char NoPropsNoEventsNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using NoPropsNoEventsNativeComponentViewShadowNode = ConcreteViewShadowNode< + NoPropsNoEventsNativeComponentViewComponentName, + NoPropsNoEventsNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char ObjectPropsNativeComponentComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using ObjectPropsNativeComponentShadowNode = ConcreteViewShadowNode< + ObjectPropsNativeComponentComponentName, + ObjectPropsNativeComponentProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'PointPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char PointPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using PointPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + PointPropNativeComponentViewComponentName, + PointPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateShadowNodeH can generate for 'StringPropNativeComponent.js' 1`] = ` +Object { + "ShadowNodes.h": " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateShadowNodeH.js + */ + +#pragma once + +#include +#include + +namespace facebook { +namespace react { + +extern const char StringPropNativeComponentViewComponentName[]; + +/* + * \`ShadowNode\` for component. + */ +using StringPropNativeComponentViewShadowNode = ConcreteViewShadowNode< + StringPropNativeComponentViewComponentName, + StringPropNativeComponentViewProps>; + +} // namespace react +} // namespace facebook +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateViewConfigJs-test.js.snap b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateViewConfigJs-test.js.snap new file mode 100644 index 000000000000..9f50be668049 --- /dev/null +++ b/packages/react-native-codegen/e2e/__tests__/components/__snapshots__/GenerateViewConfigJs-test.js.snap @@ -0,0 +1,639 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateViewConfigJs can generate for 'ArrayPropsNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'ArrayPropsNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'ArrayPropsNativeComponentView', + + validAttributes: { + names: true, + disableds: true, + progress: true, + radii: true, + + colors: { + process: require('react-native/Libraries/StyleSheet/processColorArray'), + }, + + srcs: true, + points: true, + sizes: true, + object: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'BooleanPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'BooleanPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'BooleanPropNativeComponentView', + + validAttributes: { + disabled: true, + disabledNullable: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'ColorPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'ColorPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'ColorPropNativeComponentView', + + validAttributes: { + tintColor: { + process: require('react-native/Libraries/StyleSheet/processColor'), + }, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'EdgeInsetsPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'EdgeInsetsPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'EdgeInsetsPropNativeComponentView', + validAttributes: {}, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'EnumPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'EnumPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'EnumPropNativeComponentView', + + validAttributes: { + alignment: true, + intervals: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'EventNestedObjectPropsNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'EventNestedObjectPropsNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'EventNestedObjectPropsNativeComponentView', + + bubblingEventTypes: { + topChange: { + phasedRegistrationNames: { + captured: 'onChangeCapture', + bubbled: 'onChange', + }, + }, + }, + + validAttributes: { + disabled: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'EventPropsNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'EventPropsNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'EventPropsNativeComponentView', + + bubblingEventTypes: { + paperDirectName: { + phasedRegistrationNames: { + captured: 'onChangeCapture', + bubbled: 'onChange', + }, + }, + + topEnd: { + phasedRegistrationNames: { + captured: 'onEndCapture', + bubbled: 'onEnd', + }, + }, + + paperBubblingName: { + phasedRegistrationNames: { + captured: 'onEventBubblingWithPaperNameCapture', + bubbled: 'onEventBubblingWithPaperName', + }, + }, + }, + + directEventTypes: { + topEventDirect: { + registrationName: 'onEventDirect', + }, + + paperDirectName: { + registrationName: 'onEventDirectWithPaperName', + }, + + paperBubblingName: { + registrationName: 'onOrientationChange', + }, + }, + + validAttributes: { + disabled: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'FloatPropsNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'FloatPropsNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'FloatPropsNativeComponentView', + + validAttributes: { + blurRadius: true, + blurRadius2: true, + blurRadius3: true, + blurRadius4: true, + blurRadius5: true, + blurRadius6: true, + blurRadiusNullable: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'ImagePropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'ImagePropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'ImagePropNativeComponentView', + + validAttributes: { + thumbImage: { + process: require('react-native/Libraries/Image/resolveAssetSource'), + }, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'IntegerPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'IntegerPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'IntegerPropNativeComponentView', + + validAttributes: { + progress1: true, + progress2: true, + progress3: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'InterfaceOnlyNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'RCTInterfaceOnlyComponent'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'RCTInterfaceOnlyComponent', + + bubblingEventTypes: { + topChange: { + phasedRegistrationNames: { + captured: 'onChangeCapture', + bubbled: 'onChange', + }, + }, + }, + + validAttributes: { + title: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'MultiNativePropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'MultiNativePropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'MultiNativePropNativeComponentView', + + validAttributes: { + thumbImage: { + process: require('react-native/Libraries/Image/resolveAssetSource'), + }, + + color: { + process: require('react-native/Libraries/StyleSheet/processColor'), + }, + + thumbTintColor: { + process: require('react-native/Libraries/StyleSheet/processColor'), + }, + + point: { + diff: require('react-native/Libraries/Utilities/differ/pointsDiffer'), + }, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'NoPropsNoEventsNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'NoPropsNoEventsNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'NoPropsNoEventsNativeComponentView', + validAttributes: {}, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'ObjectPropsNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'ObjectPropsNativeComponent'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'ObjectPropsNativeComponent', + + validAttributes: { + objectProp: true, + objectArrayProp: true, + objectPrimitiveRequiredProp: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'PointPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'PointPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'PointPropNativeComponentView', + + validAttributes: { + startPoint: { + diff: require('react-native/Libraries/Utilities/differ/pointsDiffer'), + }, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; + +exports[`GenerateViewConfigJs can generate for 'StringPropNativeComponent.js' 1`] = ` +Map { + "RNCodegenModuleFixturesNativeViewConfig.js" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @flow + * + * @generated by codegen project: GenerateViewConfigJs.js + */ + +'use strict'; + +const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry'); + +let nativeComponentName = 'StringPropNativeComponentView'; + + +export const __INTERNAL_VIEW_CONFIG = { + uiViewClassName: 'StringPropNativeComponentView', + + validAttributes: { + placeholder: true, + defaultValue: true, + }, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); +", +} +`; diff --git a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js index 62f923d9581d..69ba5f7205ee 100644 --- a/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js +++ b/packages/react-native-codegen/e2e/__tests__/modules/GenerateModuleObjCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/e2e/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap b/packages/react-native-codegen/e2e/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap index 72435804ab95..f809a4eb4d78 100644 --- a/packages/react-native-codegen/e2e/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap +++ b/packages/react-native-codegen/e2e/__tests__/modules/__snapshots__/GenerateModuleObjCpp-test.js.snap @@ -2,10 +2,10 @@ exports[`GenerateModuleObjCpp can generate a header file NativeModule specs 1`] = ` "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -1192,10 +1192,10 @@ inline JS::NativeSampleTurboModuleOptional::Constants::Builder::Builder(Constant exports[`GenerateModuleObjCpp can generate a header file NativeModule specs with assume nonnull enabled 1`] = ` "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -2385,10 +2385,10 @@ NS_ASSUME_NONNULL_END exports[`GenerateModuleObjCpp can generate an implementation file NativeModule specs 1`] = ` "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index 92867c4e3161..7d7db0b69e71 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -1,6 +1,6 @@ { "name": "react-native-codegen", - "version": "0.0.8", + "version": "0.0.17", "description": "⚛️ Code generation tools for React Native", "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-codegen", "repository": { @@ -11,15 +11,16 @@ "scripts": { "build": "yarn clean && node scripts/build.js --verbose", "clean": "rm -rf lib", - "prepublish": "yarn run build" + "prepare": "yarn run build" }, "license": "MIT", "files": [ "lib" ], "dependencies": { + "@babel/parser": "^7.14.0", "flow-parser": "^0.121.0", - "jscodeshift": "^0.11.0", + "jscodeshift": "^0.13.1", "nullthrows": "^1.1.1" }, "devDependencies": { @@ -37,6 +38,6 @@ "invariant": "^2.2.4", "micromatch": "^4.0.2", "mkdirp": "^0.5.1", - "prettier": "1.19.1" + "prettier": "^2.4.1" } } diff --git a/packages/react-native-codegen/scripts/buck-oss/combine_js_to_schema.sh b/packages/react-native-codegen/scripts/buck-oss/combine_js_to_schema.sh index 85bfb85a9815..6c837aa334d6 100755 --- a/packages/react-native-codegen/scripts/buck-oss/combine_js_to_schema.sh +++ b/packages/react-native-codegen/scripts/buck-oss/combine_js_to_schema.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/scripts/buck-oss/generate-all.sh b/packages/react-native-codegen/scripts/buck-oss/generate-all.sh index a60d6f40fe86..9391bf80f254 100755 --- a/packages/react-native-codegen/scripts/buck-oss/generate-all.sh +++ b/packages/react-native-codegen/scripts/buck-oss/generate-all.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/scripts/build.js b/packages/react-native-codegen/scripts/build.js index 9eefd4fdbb8f..a8a34a61fbaf 100644 --- a/packages/react-native-codegen/scripts/build.js +++ b/packages/react-native-codegen/scripts/build.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -47,10 +47,7 @@ const fixedWidth = str => { if (lastString.length < WIDTH) { lastString += Array(WIDTH - lastString.length).join(chalk.dim('.')); } - return strs - .slice(0, -1) - .concat(lastString) - .join('\n'); + return strs.slice(0, -1).concat(lastString).join('\n'); }; function getBuildPath(file, buildFolder) { @@ -92,7 +89,7 @@ function buildFile(file, silent) { ); fs.writeFileSync(destPath, transformed); const source = fs.readFileSync(file).toString('utf-8'); - if (/\@flow/.test(source)) { + if (/@flow/.test(source)) { fs.createReadStream(file).pipe(fs.createWriteStream(destPath + '.flow')); } silent || diff --git a/packages/react-native-codegen/scripts/oss/build.sh b/packages/react-native-codegen/scripts/oss/build.sh index b5913f9f1d6a..fc9895851f44 100755 --- a/packages/react-native-codegen/scripts/oss/build.sh +++ b/packages/react-native-codegen/scripts/oss/build.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/CodegenSchema.js b/packages/react-native-codegen/src/CodegenSchema.js index 241017d53c03..5e152e001481 100644 --- a/packages/react-native-codegen/src/CodegenSchema.js +++ b/packages/react-native-codegen/src/CodegenSchema.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/SchemaValidator.js b/packages/react-native-codegen/src/SchemaValidator.js index 4905b9a7fa81..887c6eb60a9c 100644 --- a/packages/react-native-codegen/src/SchemaValidator.js +++ b/packages/react-native-codegen/src/SchemaValidator.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js b/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js index 76781b67e9ab..1a5896a7b158 100644 --- a/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js +++ b/packages/react-native-codegen/src/__tests__/SchemaValidator-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js index c01b10f70a34..1c8fc7bc2f43 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema-cli.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -13,13 +13,12 @@ const combine = require('./combine-js-to-schema'); const fs = require('fs'); -// $FlowFixMe[untyped-import] glob is untyped const glob = require('glob'); const path = require('path'); const [outfile, ...fileList] = process.argv.slice(2); -function filterJSFile(file) { +function filterJSFile(file: string) { return ( /^(Native.+|.+NativeComponent)/.test(path.basename(file)) && // NativeUIManager will be deprecated by Fabric UIManager. @@ -36,7 +35,7 @@ const allFiles = []; fileList.forEach(file => { if (fs.lstatSync(file).isDirectory()) { const dirFiles = glob - .sync(`${file}/**/*.js`, { + .sync(`${file}/**/*.{js,ts,tsx}`, { nodir: true, }) .filter(filterJSFile); diff --git a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js index cf2da06ef64e..71550527915e 100644 --- a/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js +++ b/packages/react-native-codegen/src/cli/combine/combine-js-to-schema.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -12,18 +12,26 @@ import type {SchemaType} from '../../CodegenSchema.js'; const FlowParser = require('../../parsers/flow'); +const TypeScriptParser = require('../../parsers/typescript'); const fs = require('fs'); +const path = require('path'); function combineSchemas(files: Array): SchemaType { return files.reduce( (merged, filename) => { const contents = fs.readFileSync(filename, 'utf8'); + if ( contents && (/export\s+default\s+\(?codegenNativeComponent) { files.forEach(filename => { + const isTypeScript = + path.extname(filename) === '.ts' || path.extname(filename) === '.tsx'; + console.log( filename, - JSON.stringify(FlowParser.parseFile(filename), null, 2), + JSON.stringify( + isTypeScript + ? TypeScriptParser.parseFile(filename) + : FlowParser.parseFile(filename), + null, + 2, + ), ); }); } diff --git a/packages/react-native-codegen/src/cli/parser/parser.sh b/packages/react-native-codegen/src/cli/parser/parser.sh index 7d7352abb4cc..56b708fe89ea 100755 --- a/packages/react-native-codegen/src/cli/parser/parser.sh +++ b/packages/react-native-codegen/src/cli/parser/parser.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. +# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/RNCodegen.js b/packages/react-native-codegen/src/generators/RNCodegen.js index 1343c598c7de..6444b2cfa87a 100644 --- a/packages/react-native-codegen/src/generators/RNCodegen.js +++ b/packages/react-native-codegen/src/generators/RNCodegen.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -34,13 +34,15 @@ const generatePropsJavaDelegate = require('./components/GeneratePropsJavaDelegat const generateTests = require('./components/GenerateTests.js'); const generateShadowNodeCpp = require('./components/GenerateShadowNodeCpp.js'); const generateShadowNodeH = require('./components/GenerateShadowNodeH.js'); +const generateThirdPartyFabricComponentsProviderObjCpp = require('./components/GenerateThirdPartyFabricComponentsProviderObjCpp.js'); +const generateThirdPartyFabricComponentsProviderH = require('./components/GenerateThirdPartyFabricComponentsProviderH.js'); const generateViewConfigJs = require('./components/GenerateViewConfigJs.js'); const path = require('path'); const schemaValidator = require('../SchemaValidator.js'); import type {SchemaType} from '../CodegenSchema'; -type Options = $ReadOnly<{ +type LibraryOptions = $ReadOnly<{ libraryName: string, schema: SchemaType, outputDirectory: string, @@ -48,7 +50,12 @@ type Options = $ReadOnly<{ assumeNonnull: boolean, }>; -type Generators = +type SchemasOptions = $ReadOnly<{ + schemas: {[string]: SchemaType}, + outputDirectory: string, +}>; + +type LibraryGenerators = | 'componentsAndroid' | 'componentsIOS' | 'descriptors' @@ -60,12 +67,19 @@ type Generators = | 'modulesCxx' | 'modulesIOS'; -type Config = $ReadOnly<{ - generators: Array, +type SchemasGenerators = 'providerIOS'; + +type LibraryConfig = $ReadOnly<{ + generators: Array, + test?: boolean, +}>; + +type SchemasConfig = $ReadOnly<{ + generators: Array, test?: boolean, }>; -const GENERATORS = { +const LIBRARY_GENERATORS = { descriptors: [generateComponentDescriptorH.generate], events: [generateEventEmitterCpp.generate, generateEventEmitterH.generate], props: [ @@ -113,6 +127,13 @@ const GENERATORS = { ], }; +const SCHEMAS_GENERATORS = { + providerIOS: [ + generateThirdPartyFabricComponentsProviderObjCpp.generate, + generateThirdPartyFabricComponentsProviderH.generate, + ], +}; + function writeMapToFiles(map: Map, outputDir: string) { let success = true; map.forEach((contents: string, fileName: string) => { @@ -153,14 +174,20 @@ function checkFilesForChanges( module.exports = { generate( - {libraryName, schema, outputDirectory, packageName, assumeNonnull}: Options, - {generators, test}: Config, + { + libraryName, + schema, + outputDirectory, + packageName, + assumeNonnull, + }: LibraryOptions, + {generators, test}: LibraryConfig, ): boolean { schemaValidator.validate(schema); const generatedFiles = []; for (const name of generators) { - for (const generator of GENERATORS[name]) { + for (const generator of LIBRARY_GENERATORS[name]) { generatedFiles.push( ...generator(libraryName, schema, packageName, assumeNonnull), ); @@ -175,7 +202,30 @@ module.exports = { return writeMapToFiles(filesToUpdate, outputDirectory); }, - generateViewConfig({libraryName, schema}: Options): string { + generateFromSchemas( + {schemas, outputDirectory}: SchemasOptions, + {generators, test}: SchemasConfig, + ): boolean { + Object.keys(schemas).forEach(libraryName => + schemaValidator.validate(schemas[libraryName]), + ); + + const generatedFiles = []; + for (const name of generators) { + for (const generator of SCHEMAS_GENERATORS[name]) { + generatedFiles.push(...generator(schemas)); + } + } + + const filesToUpdate = new Map([...generatedFiles]); + + if (test === true) { + return checkFilesForChanges(filesToUpdate, outputDirectory); + } + + return writeMapToFiles(filesToUpdate, outputDirectory); + }, + generateViewConfig({libraryName, schema}: LibraryOptions): string { schemaValidator.validate(schema); const result = generateViewConfigJs diff --git a/packages/react-native-codegen/src/generators/Utils.js b/packages/react-native-codegen/src/generators/Utils.js index 68c128360e15..b52c0230720f 100644 --- a/packages/react-native-codegen/src/generators/Utils.js +++ b/packages/react-native-codegen/src/generators/Utils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/CppHelpers.js b/packages/react-native-codegen/src/generators/components/CppHelpers.js index bbf8a48347b3..92ee6c2529b1 100644 --- a/packages/react-native-codegen/src/generators/components/CppHelpers.js +++ b/packages/react-native-codegen/src/generators/components/CppHelpers.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,10 +20,7 @@ function upperCaseFirst(inString: string): string { } function toSafeCppString(input: string): string { - return input - .split('-') - .map(upperCaseFirst) - .join(''); + return input.split('-').map(upperCaseFirst).join(''); } function toIntEnumValueName(propName: string, value: number): string { diff --git a/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js b/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js index 7e670d98e386..a7c795622f90 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateComponentDescriptorH.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,32 +15,39 @@ import type {SchemaType} from '../../CodegenSchema'; // File path -> contents type FilesOutput = Map; -const template = ` +const FileTemplate = ({ + componentDescriptors, + libraryName, +}: { + componentDescriptors: string, + libraryName: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateComponentDescriptorH.js */ #pragma once -#include +#include #include namespace facebook { namespace react { -::_COMPONENT_DESCRIPTORS_:: +${componentDescriptors} } // namespace react } // namespace facebook `; -const componentTemplate = ` -using ::_CLASSNAME_::ComponentDescriptor = ConcreteComponentDescriptor<::_CLASSNAME_::ShadowNode>; +const ComponentTemplate = ({className}: {className: string}) => + ` +using ${className}ComponentDescriptor = ConcreteComponentDescriptor<${className}ShadowNode>; `.trim(); module.exports = { @@ -70,16 +77,18 @@ module.exports = { if (components[componentName].interfaceOnly === true) { return; } - return componentTemplate.replace(/::_CLASSNAME_::/g, componentName); + + return ComponentTemplate({className: componentName}); }) .join('\n'); }) .filter(Boolean) .join('\n'); - const replacedTemplate = template - .replace(/::_COMPONENT_DESCRIPTORS_::/g, componentDescriptors) - .replace('::_LIBRARY_::', libraryName); + const replacedTemplate = FileTemplate({ + componentDescriptors, + libraryName, + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js index d664e3c2b8a3..ee619f4617f7 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateComponentHObjCpp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -37,58 +37,101 @@ function getOrdinalNumber(num: number): string { return 'unknown'; } -const protocolTemplate = ` -@protocol RCT::_COMPONENT_NAME_::ViewProtocol -::_METHODS_:: +const ProtocolTemplate = ({ + componentName, + methods, +}: { + componentName: string, + methods: string, +}) => + ` +@protocol RCT${componentName}ViewProtocol +${methods} @end `.trim(); -const commandHandlerIfCaseConvertArgTemplate = ` - NSObject *arg::_ARG_NUMBER_:: = args[::_ARG_NUMBER_::]; +const CommandHandlerIfCaseConvertArgTemplate = ({ + componentName, + expectedKind, + argNumber, + argNumberString, + expectedKindString, + argConversion, +}: { + componentName: string, + expectedKind: string, + argNumber: number, + argNumberString: string, + expectedKindString: string, + argConversion: string, +}) => + ` + NSObject *arg${argNumber} = args[${argNumber}]; #if RCT_DEBUG - if (!RCTValidateTypeOfViewCommandArgument(arg::_ARG_NUMBER_::, ::_EXPECTED_KIND_::, @"::_EXPECTED_KIND_STRING_::", @"::_COMPONENT_NAME_::", commandName, @"::_ARG_NUMBER_STR_::")) { + if (!RCTValidateTypeOfViewCommandArgument(arg${argNumber}, ${expectedKind}, @"${expectedKindString}", @"${componentName}", commandName, @"${argNumberString}")) { return; } #endif - ::_ARG_CONVERSION_:: + ${argConversion} `.trim(); -const commandHandlerIfCaseTemplate = ` -if ([commandName isEqualToString:@"::_COMMAND_NAME_::"]) { +const CommandHandlerIfCaseTemplate = ({ + componentName, + commandName, + numArgs, + convertArgs, + commandCall, +}: { + componentName: string, + commandName: string, + numArgs: number, + convertArgs: string, + commandCall: string, +}) => + ` +if ([commandName isEqualToString:@"${commandName}"]) { #if RCT_DEBUG - if ([args count] != ::_NUM_ARGS_::) { - RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"::_COMPONENT_NAME_::", commandName, (int)[args count], ::_NUM_ARGS_::); + if ([args count] != ${numArgs}) { + RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"${componentName}", commandName, (int)[args count], ${numArgs}); return; } #endif - ::_CONVERT_ARGS_:: + ${convertArgs} - ::_COMMAND_CALL_:: + ${commandCall} return; } `.trim(); -const commandHandlerTemplate = ` -RCT_EXTERN inline void RCT::_COMPONENT_NAME_::HandleCommand( - id componentView, +const CommandHandlerTemplate = ({ + componentName, + ifCases, +}: { + componentName: string, + ifCases: string, +}) => + ` +RCT_EXTERN inline void RCT${componentName}HandleCommand( + id componentView, NSString const *commandName, NSArray const *args) { - ::_IF_CASES_:: + ${ifCases} #if RCT_DEBUG - RCTLogError(@"%@ received command %@, which is not a supported command.", @"::_COMPONENT_NAME_::", commandName); + RCTLogError(@"%@ received command %@, which is not a supported command.", @"${componentName}", commandName); #endif } `.trim(); -const template = ` +const FileTemplate = ({componentContent}: {componentContent: string}) => + ` /** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * ${'@'}generated by codegen project: GenerateComponentHObjCpp.js */ @@ -99,7 +142,7 @@ const template = ` NS_ASSUME_NONNULL_BEGIN -::_COMPONENT_CONTENT_:: +${componentContent} NS_ASSUME_NONNULL_END `.trim(); @@ -225,7 +268,7 @@ function generateProtocol( component: ComponentShape, componentName: string, ): string { - const commands = component.commands + const methods = component.commands .map(command => { const params = command.typeAnnotation.params; const paramString = @@ -245,9 +288,10 @@ function generateProtocol( .join('\n') .trim(); - return protocolTemplate - .replace(/::_COMPONENT_NAME_::/g, componentName) - .replace('::_METHODS_::', commands); + return ProtocolTemplate({ + componentName, + methods, + }); } function generateConvertAndValidateParam( @@ -262,13 +306,14 @@ function generateConvertAndValidateParam( param.name } = ${getObjCRightHandAssignmentParamType(param, index)};`; - return commandHandlerIfCaseConvertArgTemplate - .replace(/::_COMPONENT_NAME_::/g, componentName) - .replace('::_ARG_CONVERSION_::', argConversion) - .replace(/::_ARG_NUMBER_::/g, '' + index) - .replace('::_ARG_NUMBER_STR_::', getOrdinalNumber(index + 1)) - .replace('::_EXPECTED_KIND_::', expectedKind) - .replace('::_EXPECTED_KIND_STRING_::', expectedKindString); + return CommandHandlerIfCaseConvertArgTemplate({ + componentName, + argConversion, + argNumber: index, + argNumberString: getOrdinalNumber(index + 1), + expectedKind, + expectedKindString, + }); } function generateCommandIfCase( @@ -294,12 +339,13 @@ function generateCommandIfCase( .join(' '); const commandCall = `[componentView ${command.name}${commandCallArgs}];`; - return commandHandlerIfCaseTemplate - .replace(/::_COMPONENT_NAME_::/g, componentName) - .replace(/::_COMMAND_NAME_::/g, command.name) - .replace(/::_NUM_ARGS_::/g, '' + params.length) - .replace('::_CONVERT_ARGS_::', convertArgs) - .replace('::_COMMAND_CALL_::', commandCall); + return CommandHandlerIfCaseTemplate({ + componentName, + commandName: command.name, + numArgs: params.length, + convertArgs, + commandCall, + }); } function generateCommandHandler( @@ -314,9 +360,10 @@ function generateCommandHandler( .map(command => generateCommandIfCase(command, componentName)) .join('\n\n'); - return commandHandlerTemplate - .replace(/::_COMPONENT_NAME_::/g, componentName) - .replace('::_IF_CASES_::', ifCases); + return CommandHandlerTemplate({ + componentName, + ifCases, + }); } module.exports = { @@ -362,10 +409,9 @@ module.exports = { .filter(Boolean) .join('\n\n'); - const replacedTemplate = template.replace( - '::_COMPONENT_CONTENT_::', + const replacedTemplate = FileTemplate({ componentContent, - ); + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js index 4702ed5614b9..59690c61e6e4 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterCpp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -24,41 +24,69 @@ type FilesOutput = Map; type ComponentCollection = $ReadOnly<{ [component: string]: ComponentShape, - ..., + ... }>; -const template = ` +const FileTemplate = ({ + events, + libraryName, +}: { + events: string, + libraryName: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateEventEmitterCpp.js */ -#include +#include namespace facebook { namespace react { -::_EVENTS_:: +${events} } // namespace react } // namespace facebook `; -const componentTemplate = ` -void ::_CLASSNAME_::EventEmitter::::_EVENT_NAME_::(::_STRUCT_NAME_:: event) const { - dispatchEvent("::_DISPATCH_EVENT_NAME_::", [event=std::move(event)](jsi::Runtime &runtime) { - ::_IMPLEMENTATION_:: +const ComponentTemplate = ({ + className, + eventName, + structName, + dispatchEventName, + implementation, +}: { + className: string, + eventName: string, + structName: string, + dispatchEventName: string, + implementation: string, +}) => + ` +void ${className}EventEmitter::${eventName}(${structName} event) const { + dispatchEvent("${dispatchEventName}", [event=std::move(event)](jsi::Runtime &runtime) { + ${implementation} }); } `.trim(); -const basicComponentTemplate = ` -void ::_CLASSNAME_::EventEmitter::::_EVENT_NAME_::() const { - dispatchEvent("::_DISPATCH_EVENT_NAME_::"); +const BasicComponentTemplate = ({ + className, + eventName, + dispatchEventName, +}: { + className: string, + eventName: string, + dispatchEventName: string, +}) => + ` +void ${className}EventEmitter::${eventName}() const { + dispatchEvent("${dispatchEventName}"); } `.trim(); @@ -171,18 +199,20 @@ function generateEvent(componentName: string, event): string { throw new Error('Expected the event name to start with `on`'); } - return componentTemplate - .replace(/::_CLASSNAME_::/g, componentName) - .replace(/::_EVENT_NAME_::/g, event.name) - .replace(/::_DISPATCH_EVENT_NAME_::/g, dispatchEventName) - .replace('::_STRUCT_NAME_::', generateEventStructName([event.name])) - .replace('::_IMPLEMENTATION_::', implementation); + return ComponentTemplate({ + className: componentName, + eventName: event.name, + dispatchEventName, + structName: generateEventStructName([event.name]), + implementation, + }); } - return basicComponentTemplate - .replace(/::_CLASSNAME_::/g, componentName) - .replace(/::_EVENT_NAME_::/g, event.name) - .replace(/::_DISPATCH_EVENT_NAME_::/g, dispatchEventName); + return BasicComponentTemplate({ + className: componentName, + eventName: event.name, + dispatchEventName, + }); } module.exports = { @@ -224,10 +254,10 @@ module.exports = { }) .join('\n'); - const replacedTemplate = template - .replace(/::_COMPONENT_EMITTERS_::/g, componentEmitters) - .replace('::_LIBRARY_::', libraryName) - .replace('::_EVENTS_::', componentEmitters); + const replacedTemplate = FileTemplate({ + libraryName, + events: componentEmitters, + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js index 65b4fc631087..009ff91d25b4 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateEventEmitterH.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -32,15 +32,15 @@ type StructsMap = Map; type ComponentCollection = $ReadOnly<{ [component: string]: ComponentShape, - ..., + ... }>; -const template = ` +const FileTemplate = ({componentEmitters}: {componentEmitters: string}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateEventEmitterH.js */ @@ -51,36 +51,61 @@ const template = ` namespace facebook { namespace react { -::_COMPONENT_EMITTERS_:: +${componentEmitters} } // namespace react } // namespace facebook `; -const componentTemplate = ` -class ::_CLASSNAME_::EventEmitter : public ViewEventEmitter { +const ComponentTemplate = ({ + className, + structs, + events, +}: { + className: string, + structs: string, + events: string, +}) => + ` +class ${className}EventEmitter : public ViewEventEmitter { public: using ViewEventEmitter::ViewEventEmitter; - ::_STRUCTS_:: + ${structs} - ::_EVENTS_:: + ${events} }; `.trim(); -const structTemplate = ` - struct ::_STRUCT_NAME_:: { - ::_FIELDS_:: +const StructTemplate = ({ + structName, + fields, +}: { + structName: string, + fields: string, +}) => + ` + struct ${structName} { + ${fields} }; `.trim(); -const enumTemplate = `enum class ::_ENUM_NAME_:: { - ::_VALUES_:: +const EnumTemplate = ({ + enumName, + values, + toCases, +}: { + enumName: string, + values: string, + toCases: string, +}) => + `enum class ${enumName} { + ${values} }; -static char const *toString(const ::_ENUM_NAME_:: value) { +static char const *toString(const ${enumName} value) { switch (value) { - ::_TO_CASES_:: + ${toCases} } } `.trim(); @@ -136,10 +161,11 @@ function generateEnum(structs, options, nameParts) { structs.set( structName, - enumTemplate - .replace(/::_ENUM_NAME_::/g, structName) - .replace('::_VALUES_::', fields) - .replace('::_TO_CASES_::', toCases), + EnumTemplate({ + enumName: structName, + values: fields, + toCases: toCases, + }), ); } @@ -196,9 +222,10 @@ function generateStruct( structs.set( structName, - structTemplate - .replace('::_STRUCT_NAME_::', structName) - .replace('::_FIELDS_::', fields), + StructTemplate({ + structName, + fields, + }), ); } @@ -271,27 +298,20 @@ module.exports = { .map(componentName => { const component = moduleComponents[componentName]; - const replacedTemplate = componentTemplate - .replace(/::_CLASSNAME_::/g, componentName) - .replace( - '::_STRUCTS_::', - indent(generateStructs(componentName, component), 2), - ) - .replace( - '::_EVENTS_::', - generateEvents(componentName, component), - ) - .trim(); + const replacedTemplate = ComponentTemplate({ + className: componentName, + structs: indent(generateStructs(componentName, component), 2), + events: generateEvents(componentName, component), + }); return replacedTemplate; }) .join('\n') : ''; - const replacedTemplate = template.replace( - /::_COMPONENT_EMITTERS_::/g, + const replacedTemplate = FileTemplate({ componentEmitters, - ); + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js index b29fdf7adf9d..40cc0faf8f3d 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsCpp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -16,35 +16,52 @@ const {convertDefaultTypeToString, getImports} = require('./CppHelpers'); // File path -> contents type FilesOutput = Map; -const template = ` +const FileTemplate = ({ + libraryName, + imports, + componentClasses, +}: { + libraryName: string, + imports: string, + componentClasses: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GeneratePropsCpp.js */ -#include -::_IMPORTS_:: +#include +${imports} namespace facebook { namespace react { -::_COMPONENT_CLASSES_:: +${componentClasses} } // namespace react } // namespace facebook `; -const componentTemplate = ` -::_CLASSNAME_::::::_CLASSNAME_::( +const ComponentTemplate = ({ + className, + extendClasses, + props, +}: { + className: string, + extendClasses: string, + props: string, +}) => + ` +${className}::${className}( const PropsParserContext &context, - const ::_CLASSNAME_:: &sourceProps, - const RawProps &rawProps):::_EXTEND_CLASSES_:: + const ${className} &sourceProps, + const RawProps &rawProps):${extendClasses} - ::_PROPS_:: + ${props} {} `.trim(); @@ -127,10 +144,11 @@ module.exports = { // $FlowFixMe[method-unbinding] added when improving typing for this parameters imports.forEach(allImports.add, allImports); - const replacedTemplate = componentTemplate - .replace(/::_CLASSNAME_::/g, newName) - .replace('::_EXTEND_CLASSES_::', extendString) - .replace('::_PROPS_::', propsString); + const replacedTemplate = ComponentTemplate({ + className: newName, + extendClasses: extendString, + props: propsString, + }); return replacedTemplate; }) @@ -139,17 +157,11 @@ module.exports = { .filter(Boolean) .join('\n'); - const replacedTemplate = template - .replace(/::_COMPONENT_CLASSES_::/g, componentProps) - .replace('::_LIBRARY_::', libraryName) - .replace( - '::_IMPORTS_::', - - Array.from(allImports) - .sort() - .join('\n') - .trim(), - ); + const replacedTemplate = FileTemplate({ + componentClasses: componentProps, + libraryName, + imports: Array.from(allImports).sort().join('\n').trim(), + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js index 6cb6ca5bc2b6..6d1d191e217e 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsH.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsH.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -32,107 +32,165 @@ import type { type FilesOutput = Map; type StructsMap = Map; -const template = ` +const FileTemplate = ({ + imports, + componentClasses, +}: { + imports: string, + componentClasses: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GeneratePropsH.js */ #pragma once -::_IMPORTS_:: +${imports} namespace facebook { namespace react { -::_COMPONENT_CLASSES_:: +${componentClasses} } // namespace react } // namespace facebook `; -const classTemplate = ` -::_ENUMS_:: -::_STRUCTS_:: -class ::_CLASSNAME_:: final::_EXTEND_CLASSES_:: { +const ClassTemplate = ({ + enums, + structs, + className, + props, + extendClasses, +}: { + enums: string, + structs: string, + className: string, + props: string, + extendClasses: string, +}) => + ` +${enums} +${structs} +class ${className} final${extendClasses} { public: - ::_CLASSNAME_::() = default; - ::_CLASSNAME_::(const PropsParserContext& context, const ::_CLASSNAME_:: &sourceProps, const RawProps &rawProps); + ${className}() = default; + ${className}(const PropsParserContext& context, const ${className} &sourceProps, const RawProps &rawProps); #pragma mark - Props - ::_PROPS_:: + ${props} }; `.trim(); -const enumTemplate = ` -enum class ::_ENUM_NAME_:: { ::_VALUES_:: }; - -static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ::_ENUM_NAME_:: &result) { +const EnumTemplate = ({ + enumName, + values, + fromCases, + toCases, +}: { + enumName: string, + values: string, + fromCases: string, + toCases: string, +}) => + ` +enum class ${enumName} { ${values} }; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ${enumName} &result) { auto string = (std::string)value; - ::_FROM_CASES_:: + ${fromCases} abort(); } -static inline std::string toString(const ::_ENUM_NAME_:: &value) { +static inline std::string toString(const ${enumName} &value) { switch (value) { - ::_TO_CASES_:: + ${toCases} } } `.trim(); -const intEnumTemplate = ` -enum class ::_ENUM_NAME_:: { ::_VALUES_:: }; - -static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ::_ENUM_NAME_:: &result) { +const IntEnumTemplate = ({ + enumName, + values, + fromCases, + toCases, +}: { + enumName: string, + values: string, + fromCases: string, + toCases: string, +}) => + ` +enum class ${enumName} { ${values} }; + +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ${enumName} &result) { assert(value.hasType()); auto integerValue = (int)value; - switch (integerValue) {::_FROM_CASES_:: + switch (integerValue) {${fromCases} } abort(); } -static inline std::string toString(const ::_ENUM_NAME_:: &value) { +static inline std::string toString(const ${enumName} &value) { switch (value) { - ::_TO_CASES_:: + ${toCases} } } `.trim(); -const structTemplate = `struct ::_STRUCT_NAME_:: { - ::_FIELDS_:: +const StructTemplate = ({ + structName, + fields, + fromCases, +}: { + structName: string, + fields: string, + fromCases: string, +}) => + `struct ${structName} { + ${fields} }; -static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ::_STRUCT_NAME_:: &result) { - auto map = (better::map)value; +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ${structName} &result) { + auto map = (butter::map)value; - ::_FROM_CASES_:: + ${fromCases} } -static inline std::string toString(const ::_STRUCT_NAME_:: &value) { - return "[Object ::_STRUCT_NAME_::]"; +static inline std::string toString(const ${structName} &value) { + return "[Object ${structName}]"; } `.trim(); -const arrayConversionFunction = `static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<::_STRUCT_NAME_::> &result) { +const ArrayConversionFunctionTemplate = ({ + structName, +}: { + structName: string, +}) => `static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<${structName}> &result) { auto items = (std::vector)value; for (const auto &item : items) { - ::_STRUCT_NAME_:: newItem; + ${structName} newItem; fromRawValue(context, item, newItem); result.emplace_back(newItem); } } `; -const doubleArrayConversionFunction = `static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector> &result) { +const DoubleArrayConversionFunctionTemplate = ({ + structName, +}: { + structName: string, +}) => `static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector> &result) { auto items = (std::vector>)value; for (const std::vector &item : items) { - auto nestedArray = std::vector<::_STRUCT_NAME_::>{}; + auto nestedArray = std::vector<${structName}>{}; for (const RawValue &nestedItem : item) { - ::_STRUCT_NAME_:: newItem; + ${structName} newItem; fromRawValue(context, nestedItem, newItem); nestedArray.emplace_back(newItem); } @@ -141,44 +199,57 @@ const doubleArrayConversionFunction = `static inline void fromRawValue(const Pro } `; -const arrayEnumTemplate = ` -using ::_ENUM_MASK_:: = uint32_t; - -enum class ::_ENUM_NAME_::: ::_ENUM_MASK_:: { - ::_VALUES_:: +const ArrayEnumTemplate = ({ + enumName, + enumMask, + values, + fromCases, + toCases, +}: { + enumName: string, + enumMask: string, + values: string, + fromCases: string, + toCases: string, +}) => + ` +using ${enumMask} = uint32_t; + +enum class ${enumName}: ${enumMask} { + ${values} }; constexpr bool operator&( - ::_ENUM_MASK_:: const lhs, - enum ::_ENUM_NAME_:: const rhs) { - return lhs & static_cast<::_ENUM_MASK_::>(rhs); + ${enumMask} const lhs, + enum ${enumName} const rhs) { + return lhs & static_cast<${enumMask}>(rhs); } -constexpr ::_ENUM_MASK_:: operator|( - ::_ENUM_MASK_:: const lhs, - enum ::_ENUM_NAME_:: const rhs) { - return lhs | static_cast<::_ENUM_MASK_::>(rhs); +constexpr ${enumMask} operator|( + ${enumMask} const lhs, + enum ${enumName} const rhs) { + return lhs | static_cast<${enumMask}>(rhs); } constexpr void operator|=( - ::_ENUM_MASK_:: &lhs, - enum ::_ENUM_NAME_:: const rhs) { - lhs = lhs | static_cast<::_ENUM_MASK_::>(rhs); + ${enumMask} &lhs, + enum ${enumName} const rhs) { + lhs = lhs | static_cast<${enumMask}>(rhs); } -static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ::_ENUM_MASK_:: &result) { +static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ${enumMask} &result) { auto items = std::vector{value}; for (const auto &item : items) { - ::_FROM_CASES_:: + ${fromCases} abort(); } } -static inline std::string toString(const ::_ENUM_MASK_:: &value) { +static inline std::string toString(const ${enumMask} &value) { auto result = std::string{}; auto separator = std::string{", "}; - ::_TO_CASES_:: + ${toCases} if (!result.empty()) { result.erase(result.length() - separator.length()); } @@ -320,12 +391,13 @@ function generateArrayEnumString( ) .join('\n' + ' '); - return arrayEnumTemplate - .replace(/::_ENUM_NAME_::/g, enumName) - .replace(/::_ENUM_MASK_::/g, getEnumMaskName(enumName)) - .replace('::_VALUES_::', values) - .replace('::_FROM_CASES_::', fromCases) - .replace('::_TO_CASES_::', toCases); + return ArrayEnumTemplate({ + enumName, + enumMask: getEnumMaskName(enumName), + values, + fromCases, + toCases, + }); } function generateStringEnum(componentName, prop) { @@ -352,11 +424,12 @@ function generateStringEnum(componentName, prop) { ) .join('\n' + ' '); - return enumTemplate - .replace(/::_ENUM_NAME_::/g, enumName) - .replace('::_VALUES_::', values.map(toSafeCppString).join(', ')) - .replace('::_FROM_CASES_::', fromCases) - .replace('::_TO_CASES_::', toCases); + return EnumTemplate({ + enumName, + values: values.map(toSafeCppString).join(', '), + fromCases: fromCases, + toCases: toCases, + }); } return ''; @@ -392,11 +465,12 @@ function generateIntEnum(componentName, prop) { .map(val => `${toIntEnumValueName(prop.name, val)} = ${val}`) .join(', '); - return intEnumTemplate - .replace(/::_ENUM_NAME_::/g, enumName) - .replace('::_VALUES_::', valueVariables) - .replace('::_FROM_CASES_::', fromCases) - .replace('::_TO_CASES_::', toCases); + return IntEnumTemplate({ + enumName, + values: valueVariables, + fromCases, + toCases, + }); } return ''; @@ -586,7 +660,7 @@ function generateStructs( elementProperties, nameParts.concat([prop.name]), ); - nestedStructs.forEach(function(value, key) { + nestedStructs.forEach(function (value, key) { structs.set(key, value); }); @@ -610,7 +684,7 @@ function generateStructs( elementProperties, nameParts.concat([prop.name]), ); - nestedStructs.forEach(function(value, key) { + nestedStructs.forEach(function (value, key) { structs.set(key, value); }); @@ -628,10 +702,12 @@ function generateStructs( `${[componentName, ...nameParts.concat([prop.name])].join( '', )}ArrayStruct`, - arrayConversionFunction.replace( - /::_STRUCT_NAME_::/g, - generateStructName(componentName, nameParts.concat([prop.name])), - ), + ArrayConversionFunctionTemplate({ + structName: generateStructName( + componentName, + nameParts.concat([prop.name]), + ), + }), ); } if ( @@ -649,7 +725,7 @@ function generateStructs( elementProperties, nameParts.concat([prop.name]), ); - nestedStructs.forEach(function(value, key) { + nestedStructs.forEach(function (value, key) { structs.set(key, value); }); @@ -667,10 +743,12 @@ function generateStructs( `${[componentName, ...nameParts.concat([prop.name])].join( '', )}ArrayArrayStruct`, - doubleArrayConversionFunction.replace( - /::_STRUCT_NAME_::/g, - generateStructName(componentName, nameParts.concat([prop.name])), - ), + DoubleArrayConversionFunctionTemplate({ + structName: generateStructName( + componentName, + nameParts.concat([prop.name]), + ), + }), ); } }); @@ -739,20 +817,21 @@ function generateStruct( const fromCases = properties .map(property => { - const variable = property.name; + const variable = 'tmp_' + property.name; return `auto ${variable} = map.find("${property.name}"); if (${variable} != map.end()) { - fromRawValue(context, ${variable}->second, result.${variable}); + fromRawValue(context, ${variable}->second, result.${property.name}); }`; }) .join('\n '); structs.set( structName, - structTemplate - .replace(/::_STRUCT_NAME_::/g, structName) - .replace('::_FIELDS_::', fields) - .replace('::_FROM_CASES_::', fromCases), + StructTemplate({ + structName, + fields, + fromCases, + }), ); } @@ -810,13 +889,13 @@ module.exports = { // $FlowFixMe[method-unbinding] added when improving typing for this parameters imports.forEach(allImports.add, allImports); - const replacedTemplate = classTemplate - .replace('::_ENUMS_::', enumString) - .replace('::_STRUCTS_::', structString) - .replace(/::_CLASSNAME_::/g, newName) - .replace('::_EXTEND_CLASSES_::', extendString) - .replace('::_PROPS_::', propsString) - .trim(); + const replacedTemplate = ClassTemplate({ + enums: enumString, + structs: structString, + className: newName, + extendClasses: extendString, + props: propsString, + }); return replacedTemplate; }) @@ -825,14 +904,10 @@ module.exports = { .filter(Boolean) .join('\n\n'); - const replacedTemplate = template - .replace(/::_COMPONENT_CLASSES_::/g, componentClasses) - .replace( - '::_IMPORTS_::', - Array.from(allImports) - .sort() - .join('\n'), - ); + const replacedTemplate = FileTemplate({ + componentClasses, + imports: Array.from(allImports).sort().join('\n'), + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js index 9f35f8e57546..17bdbda66ad1 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaDelegate.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -27,42 +27,58 @@ const { // File path -> contents type FilesOutput = Map; -const template = `/** -* Copyright (c) Facebook, Inc. and its affiliates. +const FileTemplate = ({ + packageName, + imports, + className, + extendClasses, + interfaceClassName, + methods, +}: { + packageName: string, + imports: string, + className: string, + extendClasses: string, + interfaceClassName: string, + methods: string, +}) => `/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * ${'@'}generated by codegen project: GeneratePropsJavaDelegate.js */ -package ::_PACKAGE_NAME_::; +package ${packageName}; -::_IMPORTS_:: +${imports} -public class ::_CLASSNAME_:: & ::_INTERFACE_CLASSNAME_::> extends BaseViewManagerDelegate { - public ::_CLASSNAME_::(U viewManager) { +public class ${className} & ${interfaceClassName}> extends BaseViewManagerDelegate { + public ${className}(U viewManager) { super(viewManager); } - ::_METHODS_:: + ${methods} } `; -const propSetterTemplate = ` +const PropSetterTemplate = ({propCases}: {propCases: string}) => + ` @Override public void setProperty(T view, String propName, @Nullable Object value) { - ::_PROP_CASES_:: + ${propCases} } -`; +`.trim(); -const commandsTemplate = ` +const CommandsTemplate = ({commandCases}: {commandCases: string}) => + ` @Override public void receiveCommand(T view, String commandName, ReadableArray args) { switch (commandName) { - ::_COMMAND_CASES_:: + ${commandCases} } } -`; +`.trim(); function getJavaValueForProp( prop: NamedShape, @@ -251,9 +267,9 @@ function getDelegateImports(component) { function generateMethods(propsString, commandsString): string { return [ - propSetterTemplate.trim().replace('::_PROP_CASES_::', propsString), + PropSetterTemplate({propCases: propsString}), commandsString != null - ? commandsTemplate.trim().replace('::_COMMAND_CASES_::', commandsString) + ? CommandsTemplate({commandCases: commandsString}) : '', ] .join('\n\n ') @@ -305,22 +321,14 @@ module.exports = { ); const extendString = getClassExtendString(component); - const replacedTemplate = template - .replace( - /::_IMPORTS_::/g, - Array.from(imports) - .sort() - .join('\n'), - ) - .replace(/::_PACKAGE_NAME_::/g, normalizedPackageName) - .replace(/::_CLASSNAME_::/g, className) - .replace('::_EXTEND_CLASSES_::', extendString) - .replace('::_PROP_CASES_::', propsString) - .replace( - '::_METHODS_::', - generateMethods(propsString, commandsString), - ) - .replace(/::_INTERFACE_CLASSNAME_::/g, interfaceClassName); + const replacedTemplate = FileTemplate({ + imports: Array.from(imports).sort().join('\n'), + packageName: normalizedPackageName, + className, + extendClasses: extendString, + methods: generateMethods(propsString, commandsString), + interfaceClassName: interfaceClassName, + }); files.set(`${outputDir}/${className}.java`, replacedTemplate); }); diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js index fd4e891dea5d..581564d10fc0 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaInterface.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,21 +26,33 @@ const { // File path -> contents type FilesOutput = Map; -const template = `/** -* Copyright (c) Facebook, Inc. and its affiliates. +const FileTemplate = ({ + packageName, + imports, + className, + extendClasses, + methods, +}: { + packageName: string, + imports: string, + className: string, + extendClasses: string, + methods: string, +}) => `/** +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * ${'@'}generated by codegen project: GeneratePropsJavaInterface.js */ -package ::_PACKAGE_NAME_::; +package ${packageName}; -::_IMPORTS_:: +${imports} -public interface ::_CLASSNAME_:: { - ::_METHODS_:: +public interface ${className} { + ${methods} } `; @@ -253,21 +265,15 @@ module.exports = { ); const extendString = getClassExtendString(component); - const replacedTemplate = template - .replace( - /::_IMPORTS_::/g, - Array.from(imports) - .sort() - .join('\n'), - ) - .replace(/::_PACKAGE_NAME_::/g, normalizedPackageName) - .replace(/::_CLASSNAME_::/g, className) - .replace('::_EXTEND_CLASSES_::', extendString) - .replace( - '::_METHODS_::', - [propsString, commandsString].join('\n' + ' ').trimRight(), - ) - .replace('::_COMMAND_HANDLERS_::', commandsString); + const replacedTemplate = FileTemplate({ + imports: Array.from(imports).sort().join('\n'), + packageName: normalizedPackageName, + className, + extendClasses: extendString, + methods: [propsString, commandsString] + .join('\n' + ' ') + .trimRight(), + }); files.set(`${outputDir}/${className}.java`, replacedTemplate); }); diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js index f80ad58863f7..eb7b1091dc77 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/PojoCollector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js index f5fa8c77f01f..66b11f26c8c3 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js index 72829ec3dd5d..3e3e2ad532dd 100644 --- a/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js +++ b/packages/react-native-codegen/src/generators/components/GeneratePropsJavaPojo/serializePojo.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -264,7 +264,7 @@ function serializePojo(pojo: Pojo, basePackageName: string): string { .join('\n'); return `/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js index 4c11da440c38..82cb8ffd5ab5 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js +++ b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeCpp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,29 +15,36 @@ import type {SchemaType} from '../../CodegenSchema'; // File path -> contents type FilesOutput = Map; -const template = ` +const FileTemplate = ({ + libraryName, + componentNames, +}: { + libraryName: string, + componentNames: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateShadowNodeCpp.js */ -#include +#include namespace facebook { namespace react { -::_COMPONENT_NAMES_:: +${componentNames} } // namespace react } // namespace facebook `; -const componentTemplate = ` -extern const char ::_CLASSNAME_::ComponentName[] = "::_CLASSNAME_::"; +const ComponentTemplate = ({className}: {className: string}) => + ` +extern const char ${className}ComponentName[] = "${className}"; `.trim(); module.exports = { @@ -67,10 +74,9 @@ module.exports = { if (components[componentName].interfaceOnly === true) { return; } - const replacedTemplate = componentTemplate.replace( - /::_CLASSNAME_::/g, - componentName, - ); + const replacedTemplate = ComponentTemplate({ + className: componentName, + }); return replacedTemplate; }) @@ -79,9 +85,10 @@ module.exports = { .filter(Boolean) .join('\n'); - const replacedTemplate = template - .replace(/::_COMPONENT_NAMES_::/g, componentNames) - .replace('::_LIBRARY_::', libraryName); + const replacedTemplate = FileTemplate({ + componentNames, + libraryName, + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js index c976955ce0f3..f661afa9e857 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js +++ b/packages/react-native-codegen/src/generators/components/GenerateShadowNodeH.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,39 +15,54 @@ import type {SchemaType} from '../../CodegenSchema'; // File path -> contents type FilesOutput = Map; -const template = ` +const FileTemplate = ({ + imports, + libraryName, + componentClasses, +}: { + imports: string, + libraryName: string, + componentClasses: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateShadowNodeH.js */ #pragma once -::_IMPORTS_::#include +${imports}#include #include namespace facebook { namespace react { -::_COMPONENT_CLASSES_:: +${componentClasses} } // namespace react } // namespace facebook `; -const componentTemplate = ` -extern const char ::_CLASSNAME_::ComponentName[]; +const ComponentTemplate = ({ + className, + eventEmitter, +}: { + className: string, + eventEmitter: string, +}) => + ` +extern const char ${className}ComponentName[]; /* - * \`ShadowNode\` for <::_CLASSNAME_::> component. + * \`ShadowNode\` for <${className}> component. */ -using ::_CLASSNAME_::ShadowNode = ConcreteViewShadowNode< - ::_CLASSNAME_::ComponentName, - ::_CLASSNAME_::Props::_EVENT_EMITTER_::>; +using ${className}ShadowNode = ConcreteViewShadowNode< + ${className}ComponentName, + ${className}Props${eventEmitter}>; `.trim(); module.exports = { @@ -91,9 +106,10 @@ module.exports = { ? `,\n${componentName}EventEmitter` : ''; - const replacedTemplate = componentTemplate - .replace(/::_CLASSNAME_::/g, componentName) - .replace('::_EVENT_EMITTER_::', eventEmitter); + const replacedTemplate = ComponentTemplate({ + className: componentName, + eventEmitter, + }); return replacedTemplate; }) @@ -104,10 +120,11 @@ module.exports = { const eventEmitterImport = `#include \n`; - const replacedTemplate = template - .replace(/::_COMPONENT_CLASSES_::/g, moduleResults) - .replace('::_LIBRARY_::', libraryName) - .replace('::_IMPORTS_::', hasAnyEvents ? eventEmitterImport : ''); + const replacedTemplate = FileTemplate({ + componentClasses: moduleResults, + libraryName, + imports: hasAnyEvents ? eventEmitterImport : '', + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GenerateTests.js b/packages/react-native-codegen/src/generators/components/GenerateTests.js index 1681fd9922fa..dbaffefdd721 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateTests.js +++ b/packages/react-native-codegen/src/generators/components/GenerateTests.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -23,37 +23,56 @@ type TestCase = $ReadOnly<{ raw?: boolean, }>; -const fileTemplate = ` +const FileTemplate = ({ + libraryName, + imports, + componentTests, +}: { + libraryName: string, + imports: string, + componentTests: string, +}) => + ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateTests.js * */ #include #include -#include -::_IMPORTS_:: +#include +${imports} using namespace facebook::react; -::_COMPONENT_TESTS_:: -`; - -const testTemplate = ` -TEST(::_COMPONENT_NAME_::_::_TEST_NAME_::, etc) { +${componentTests} +`.trim(); + +const TestTemplate = ({ + componentName, + testName, + propName, + propValue, +}: { + componentName: string, + testName: string, + propName: string, + propValue: string, +}) => ` +TEST(${componentName}_${testName}, etc) { auto propParser = RawPropsParser(); - propParser.prepare<::_COMPONENT_NAME_::>(); - auto const &sourceProps = ::_COMPONENT_NAME_::(); - auto const &rawProps = RawProps(folly::dynamic::object("::_PROP_NAME_::", ::_PROP_VALUE_::)); + propParser.prepare<${componentName}>(); + auto const &sourceProps = ${componentName}(); + auto const &rawProps = RawProps(folly::dynamic::object("${propName}", ${propValue})); ContextContainer contextContainer{}; PropsParserContext parserContext{-1, contextContainer}; rawProps.parse(propParser, parserContext); - ::_COMPONENT_NAME_::(parserContext, sourceProps, rawProps); + ${componentName}(parserContext, sourceProps, rawProps); } `; @@ -120,11 +139,12 @@ function generateTestsString(name, component) { const value = !raw && typeof propValue === 'string' ? `"${propValue}"` : propValue; - return testTemplate - .replace(/::_COMPONENT_NAME_::/g, name) - .replace(/::_TEST_NAME_::/g, testName != null ? testName : propName) - .replace(/::_PROP_NAME_::/g, propName) - .replace(/::_PROP_VALUE_::/g, String(value)); + return TestTemplate({ + componentName: name, + testName: testName != null ? testName : propName, + propName, + propValue: String(value), + }); } const testCases = component.props.reduce((cases, prop) => { @@ -182,16 +202,13 @@ module.exports = { .filter(Boolean) .join(''); - const imports = Array.from(allImports) - .sort() - .join('\n') - .trim(); + const imports = Array.from(allImports).sort().join('\n').trim(); - const replacedTemplate = fileTemplate - .replace(/::_IMPORTS_::/g, imports) - .replace(/::_LIBRARY_NAME_::/g, libraryName) - .replace(/::_COMPONENT_TESTS_::/g, componentTests) - .trim(); + const replacedTemplate = FileTemplate({ + imports, + libraryName, + componentTests, + }); return new Map([[fileName, replacedTemplate]]); }, diff --git a/packages/react-native-codegen/src/generators/components/GenerateThirdPartyFabricComponentsProviderH.js b/packages/react-native-codegen/src/generators/components/GenerateThirdPartyFabricComponentsProviderH.js new file mode 100644 index 000000000000..cddb1302d754 --- /dev/null +++ b/packages/react-native-codegen/src/generators/components/GenerateThirdPartyFabricComponentsProviderH.js @@ -0,0 +1,107 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +import type {SchemaType} from '../../CodegenSchema'; + +// File path -> contents +type FilesOutput = Map; + +const FileTemplate = ({lookupFuncs}: {lookupFuncs: string}) => ` +/* + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * ${'@'}generated by GenerateRCTThirdPartyFabricComponentsProviderH + */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage" + +#import + +#ifdef __cplusplus +extern "C" { +#endif + +Class RCTThirdPartyFabricComponentsProvider(const char *name); + +${lookupFuncs} + +#ifdef __cplusplus +} +#endif + +#pragma GCC diagnostic pop + +`; + +const LookupFuncTemplate = ({ + className, + libraryName, +}: { + className: string, + libraryName: string, +}) => + ` +Class ${className}Cls(void) __attribute__((used)); // ${libraryName} +`.trim(); + +module.exports = { + generate(schemas: {[string]: SchemaType}): FilesOutput { + const fileName = 'RCTThirdPartyFabricComponentsProvider.h'; + + const lookupFuncs = Object.keys(schemas) + .map(libraryName => { + const schema = schemas[libraryName]; + return Object.keys(schema.modules) + .map(moduleName => { + const module = schema.modules[moduleName]; + if (module.type !== 'Component') { + return; + } + + const {components} = module; + // No components in this module + if (components == null) { + return null; + } + + return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return !( + component.excludedPlatforms && + component.excludedPlatforms.includes('iOS') + ); + }) + .map(componentName => { + return LookupFuncTemplate({ + className: componentName, + libraryName, + }); + }) + .join('\n'); + }) + .filter(Boolean) + .join('\n'); + }) + .join('\n'); + + const replacedTemplate = FileTemplate({ + lookupFuncs, + }); + + return new Map([[fileName, replacedTemplate]]); + }, +}; diff --git a/packages/react-native-codegen/src/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js b/packages/react-native-codegen/src/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js new file mode 100644 index 000000000000..549633cd1604 --- /dev/null +++ b/packages/react-native-codegen/src/generators/components/GenerateThirdPartyFabricComponentsProviderObjCpp.js @@ -0,0 +1,103 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +import type {SchemaType} from '../../CodegenSchema'; + +// File path -> contents +type FilesOutput = Map; + +const FileTemplate = ({lookupMap}: {lookupMap: string}) => ` +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * ${'@'}generated by GenerateRCTThirdPartyFabricComponentsProviderCpp + */ + +// OSS-compatibility layer + +#import "RCTThirdPartyFabricComponentsProvider.h" + +#import +#import + +Class RCTThirdPartyFabricComponentsProvider(const char *name) { + static std::unordered_map sFabricComponentsClassMap = { +${lookupMap} + }; + + auto p = sFabricComponentsClassMap.find(name); + if (p != sFabricComponentsClassMap.end()) { + auto classFunc = p->second; + return classFunc(); + } + return nil; +} +`; + +const LookupMapTemplate = ({ + className, + libraryName, +}: { + className: string, + libraryName: string, +}) => ` + {"${className}", ${className}Cls}, // ${libraryName}`; + +module.exports = { + generate(schemas: {[string]: SchemaType}): FilesOutput { + const fileName = 'RCTThirdPartyFabricComponentsProvider.mm'; + + const lookupMap = Object.keys(schemas) + .map(libraryName => { + const schema = schemas[libraryName]; + return Object.keys(schema.modules) + .map(moduleName => { + const module = schema.modules[moduleName]; + if (module.type !== 'Component') { + return; + } + + const {components} = module; + // No components in this module + if (components == null) { + return null; + } + + return Object.keys(components) + .filter(componentName => { + const component = components[componentName]; + return !( + component.excludedPlatforms && + component.excludedPlatforms.includes('iOS') + ); + }) + .map(componentName => { + const replacedTemplate = LookupMapTemplate({ + className: componentName, + libraryName, + }); + + return replacedTemplate; + }); + }) + .filter(Boolean); + }) + .join('\n'); + + const replacedTemplate = FileTemplate({lookupMap}); + + return new Map([[fileName, replacedTemplate]]); + }, +}; diff --git a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js index 8a16c6742753..7dff6eaccc02 100644 --- a/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js +++ b/packages/react-native-codegen/src/generators/components/GenerateViewConfigJs.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,12 +17,18 @@ import type {SchemaType} from '../../CodegenSchema'; // File path -> contents type FilesOutput = Map; -const template = ` +const FileTemplate = ({ + imports, + componentConfig, +}: { + imports: string, + componentConfig: string, +}) => ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -31,9 +37,9 @@ const template = ` 'use strict'; -::_IMPORTS_:: +${imports} -::_COMPONENT_CONFIG_:: +${componentConfig} `; // We use this to add to a set. Need to make sure we aren't importing @@ -54,14 +60,17 @@ function getReactDiffProcessValue(typeAnnotation) { case 'ReservedPropTypeAnnotation': switch (typeAnnotation.name) { case 'ColorPrimitive': - return j.template.expression`{ process: require('processColor') }`; + return j.template + .expression`{ process: require('react-native/Libraries/StyleSheet/processColor') }`; case 'ImageSourcePrimitive': return j.template - .expression`{ process: require('resolveAssetSource') }`; + .expression`{ process: require('react-native/Libraries/Image/resolveAssetSource') }`; case 'PointPrimitive': - return j.template.expression`{ diff: require('pointsDiffer') }`; + return j.template + .expression`{ diff: require('react-native/Libraries/Utilities/differ/pointsDiffer') }`; case 'EdgeInsetsPrimitive': - return j.template.expression`{ diff: require('insetsDiffer') }`; + return j.template + .expression`{ diff: require('react-native/Libraries/Utilities/differ/insetsDiffer') }`; default: (typeAnnotation.name: empty); throw new Error( @@ -73,7 +82,7 @@ function getReactDiffProcessValue(typeAnnotation) { switch (typeAnnotation.elementType.name) { case 'ColorPrimitive': return j.template - .expression`{ process: require('processColorArray') }`; + .expression`{ process: require('react-native/Libraries/StyleSheet/processColorArray') }`; case 'ImageSourcePrimitive': return j.literal(true); case 'PointPrimitive': @@ -93,19 +102,63 @@ function getReactDiffProcessValue(typeAnnotation) { } } -const componentTemplate = ` -let nativeComponentName = '::_COMPONENT_NAME_WITH_COMPAT_SUPPORT_::'; -::_DEPRECATION_CHECK_:: -export default NativeComponentRegistry.get(nativeComponentName, () => VIEW_CONFIG); +const ComponentTemplate = ({ + componentName, + paperComponentName, + paperComponentNameDeprecated, +}: { + componentName: string, + paperComponentName: ?string, + paperComponentNameDeprecated: ?string, +}) => { + const nativeComponentName = paperComponentName ?? componentName; + + return ` +let nativeComponentName = '${nativeComponentName}'; +${ + paperComponentNameDeprecated != null + ? DeprecatedComponentNameCheckTemplate({ + componentName, + paperComponentNameDeprecated, + }) + : '' +} + +export const __INTERNAL_VIEW_CONFIG = VIEW_CONFIG; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); `.trim(); +}; -const deprecatedComponentTemplate = ` -if (UIManager.getViewManagerConfig('::_COMPONENT_NAME_::')) { - nativeComponentName = '::_COMPONENT_NAME_::'; -} else if (UIManager.getViewManagerConfig('::_COMPONENT_NAME_DEPRECATED_::')) { - nativeComponentName = '::_COMPONENT_NAME_DEPRECATED_::'; +// If static view configs are enabled, get whether the native component exists +// in the app binary using hasViewManagerConfig() instead of getViewManagerConfig(). +// Old getViewManagerConfig() checks for the existance of the native Paper view manager. +// New hasViewManagerConfig() queries Fabric’s native component registry directly. +const DeprecatedComponentNameCheckTemplate = ({ + componentName, + paperComponentNameDeprecated, +}: { + componentName: string, + paperComponentNameDeprecated: string, +}) => + ` +const staticViewConfigsEnabled = global.__fbStaticViewConfig === true; +if (staticViewConfigsEnabled) { + if (UIManager.hasViewManagerConfig('${componentName}')) { + nativeComponentName = '${componentName}'; + } else if (UIManager.hasViewManagerConfig('${paperComponentNameDeprecated}')) { + nativeComponentName = '${paperComponentNameDeprecated}'; + } else { + throw new Error('Failed to find native component for either "${componentName}" or "${paperComponentNameDeprecated}", with SVC enabled.'); + } } else { - throw new Error('Failed to find native component for either "::_COMPONENT_NAME_::" or "::_COMPONENT_NAME_DEPRECATED_::"'); + if (UIManager.getViewManagerConfig('${componentName}')) { + nativeComponentName = '${componentName}'; + } else if (UIManager.getViewManagerConfig('${paperComponentNameDeprecated}')) { + nativeComponentName = '${paperComponentNameDeprecated}'; + } else { + throw new Error('Failed to find native component for either "${componentName}" or "${paperComponentNameDeprecated}", with SVC disabled.'); + } } `.trim(); @@ -120,13 +173,6 @@ function normalizeInputEventName(name) { return name; } -// Replicates the behavior of viewConfig in RCTComponentData.m -function getValidAttributesForEvents(events) { - return events.map(eventType => { - return j.property('init', j.identifier(eventType.name), j.literal(true)); - }); -} - function generateBubblingEventInfo(event, nameOveride) { return j.property( 'init', @@ -199,7 +245,6 @@ function buildViewConfig( getReactDiffProcessValue(schemaProp.typeAnnotation), ); }), - ...getValidAttributesForEvents(componentEvents), ]); const bubblingEventNames = component.events @@ -212,8 +257,9 @@ function buildViewConfig( bubblingEvents.push( generateBubblingEventInfo(event, event.paperTopLevelNameDeprecated), ); + } else { + bubblingEvents.push(generateBubblingEventInfo(event)); } - bubblingEvents.push(generateBubblingEventInfo(event)); return bubblingEvents; }, []); @@ -236,8 +282,9 @@ function buildViewConfig( directEvents.push( generateDirectEventInfo(event, event.paperTopLevelNameDeprecated), ); + } else { + directEvents.push(generateDirectEventInfo(event)); } - directEvents.push(generateDirectEventInfo(event)); return directEvents; }, []); @@ -342,33 +389,22 @@ module.exports = { .map((componentName: string) => { const component = components[componentName]; - const paperComponentName = component.paperComponentName - ? component.paperComponentName - : componentName; - if (component.paperComponentNameDeprecated) { imports.add(UIMANAGER_IMPORT); } - const deprecatedCheckBlock = component.paperComponentNameDeprecated - ? deprecatedComponentTemplate - .replace(/::_COMPONENT_NAME_::/g, componentName) - .replace( - /::_COMPONENT_NAME_DEPRECATED_::/g, - component.paperComponentNameDeprecated || '', - ) - : ''; - - const replacedTemplate = componentTemplate - .replace(/::_COMPONENT_NAME_::/g, componentName) - .replace( - /::_COMPONENT_NAME_WITH_COMPAT_SUPPORT_::/g, - paperComponentName, - ) - .replace(/::_DEPRECATION_CHECK_::/, deprecatedCheckBlock); + const replacedTemplate = ComponentTemplate({ + componentName, + paperComponentName: component.paperComponentName, + paperComponentNameDeprecated: + component.paperComponentNameDeprecated, + }); const replacedSourceRoot = j.withParser('flow')(replacedTemplate); + const paperComponentName = + component.paperComponentName ?? componentName; + replacedSourceRoot .find(j.Identifier, { name: 'VIEW_CONFIG', @@ -406,14 +442,10 @@ module.exports = { .filter(Boolean) .join('\n\n'); - const replacedTemplate = template - .replace(/::_COMPONENT_CONFIG_::/g, moduleResults) - .replace( - '::_IMPORTS_::', - Array.from(imports) - .sort() - .join('\n'), - ); + const replacedTemplate = FileTemplate({ + componentConfig: moduleResults, + imports: Array.from(imports).sort().join('\n'), + }); return new Map([[fileName, replacedTemplate]]); } catch (error) { diff --git a/packages/react-native-codegen/src/generators/components/JavaHelpers.js b/packages/react-native-codegen/src/generators/components/JavaHelpers.js index e59fe7df4f85..421ed3e58513 100644 --- a/packages/react-native-codegen/src/generators/components/JavaHelpers.js +++ b/packages/react-native-codegen/src/generators/components/JavaHelpers.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -60,7 +60,17 @@ function getImports( } }); - function addImportsForNativeName(name) { + function addImportsForNativeName( + name: + | 'ColorPrimitive' + | 'EdgeInsetsPrimitive' + | 'ImageSourcePrimitive' + | 'PointPrimitive' + | $TEMPORARY$string<'ColorPrimitive'> + | $TEMPORARY$string<'EdgeInsetsPrimitive'> + | $TEMPORARY$string<'ImageSourcePrimitive'> + | $TEMPORARY$string<'PointPrimitive'>, + ) { switch (name) { case 'ColorPrimitive': if (type === 'delegate') { 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 69529644cc42..1498da712738 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 @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentDescriptorH-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentDescriptorH-test.js index 02133c76f905..233663143103 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentDescriptorH-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentDescriptorH-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentHObjCpp-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentHObjCpp-test.js index 52b638973aae..8e3d0caf63c1 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentHObjCpp-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateComponentHObjCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterCpp-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterCpp-test.js index 14ac106e959b..e6028d81705c 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterCpp-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterH-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterH-test.js index 2b6a26422aa3..73d4dacc9c16 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterH-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateEventEmitterH-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsCpp-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsCpp-test.js index f9b9332a1259..e808259e18db 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsCpp-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsH-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsH-test.js index 77305fc2c4a0..5fd7d66f2aa0 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsH-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsH-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaDelegate-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaDelegate-test.js index 36f1f9e8a5ca..7901c9f58a45 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaDelegate-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaDelegate-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaInterface-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaInterface-test.js index cc1eadab41ab..6849a80f9f75 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaInterface-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaInterface-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaPojo-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaPojo-test.js index 80b2df4dd042..5de44fa4cb21 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaPojo-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GeneratePropsJavaPojo-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeCpp-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeCpp-test.js index b3cc7efdcab2..90d194c0ea21 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeCpp-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeH-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeH-test.js index ea704d4773d6..e21cd6a9caf0 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeH-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateShadowNodeH-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateTests-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateTests-test.js index 6961d0b1754e..df9215da4dca 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateTests-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateTests-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderH-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderH-test.js new file mode 100644 index 000000000000..5c2a06332487 --- /dev/null +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderH-test.js @@ -0,0 +1,21 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const fixtures = require('../__test_fixtures__/fixtures.js'); +const generator = require('../GenerateThirdPartyFabricComponentsProviderH.js'); + +describe('GenerateThirdPartyFabricComponentsProviderH', () => { + it(`can generate fixtures`, () => { + expect(generator.generate(fixtures)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js new file mode 100644 index 000000000000..06badb829aed --- /dev/null +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js @@ -0,0 +1,21 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const fixtures = require('../__test_fixtures__/fixtures.js'); +const generator = require('../GenerateThirdPartyFabricComponentsProviderObjCpp.js'); + +describe('GenerateThirdPartyFabricComponentsProviderObjCpp', () => { + it(`can generate fixtures`, () => { + expect(generator.generate(fixtures)).toMatchSnapshot(); + }); +}); diff --git a/packages/react-native-codegen/src/generators/components/__tests__/GenerateViewConfigJs-test.js b/packages/react-native-codegen/src/generators/components/__tests__/GenerateViewConfigJs-test.js index dbb69c014570..da1136da5cdc 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/GenerateViewConfigJs-test.js +++ b/packages/react-native-codegen/src/generators/components/__tests__/GenerateViewConfigJs-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap index 34b1f425bc41..20ab6f69ffd1 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentDescriptorH-test.js.snap @@ -4,10 +4,10 @@ exports[`GenerateComponentDescriptorH can generate fixture ARRAY_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -32,10 +32,10 @@ exports[`GenerateComponentDescriptorH can generate fixture ARRAY_PROPS_WITH_NEST Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -60,10 +60,10 @@ exports[`GenerateComponentDescriptorH can generate fixture BOOLEAN_PROP 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -88,10 +88,10 @@ exports[`GenerateComponentDescriptorH can generate fixture COLOR_PROP 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -116,10 +116,10 @@ exports[`GenerateComponentDescriptorH can generate fixture COMMANDS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -144,10 +144,10 @@ exports[`GenerateComponentDescriptorH can generate fixture COMMANDS_AND_PROPS 1` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -172,10 +172,10 @@ exports[`GenerateComponentDescriptorH can generate fixture DOUBLE_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -200,10 +200,10 @@ exports[`GenerateComponentDescriptorH can generate fixture EVENT_NESTED_OBJECT_P Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -228,10 +228,10 @@ exports[`GenerateComponentDescriptorH can generate fixture EVENT_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -256,10 +256,10 @@ exports[`GenerateComponentDescriptorH can generate fixture EVENTS_WITH_PAPER_NAM Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -284,10 +284,10 @@ exports[`GenerateComponentDescriptorH can generate fixture EXCLUDE_ANDROID 1`] = Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -312,10 +312,10 @@ exports[`GenerateComponentDescriptorH can generate fixture EXCLUDE_ANDROID_IOS 1 Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -340,10 +340,10 @@ exports[`GenerateComponentDescriptorH can generate fixture FLOAT_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -368,10 +368,10 @@ exports[`GenerateComponentDescriptorH can generate fixture IMAGE_PROP 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -396,10 +396,10 @@ exports[`GenerateComponentDescriptorH can generate fixture INSETS_PROP 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -424,10 +424,10 @@ exports[`GenerateComponentDescriptorH can generate fixture INT32_ENUM_PROP 1`] = Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -452,10 +452,10 @@ exports[`GenerateComponentDescriptorH can generate fixture INTEGER_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -480,10 +480,10 @@ exports[`GenerateComponentDescriptorH can generate fixture INTERFACE_ONLY 1`] = Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -508,10 +508,10 @@ exports[`GenerateComponentDescriptorH can generate fixture MULTI_NATIVE_PROP 1`] Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -536,10 +536,10 @@ exports[`GenerateComponentDescriptorH can generate fixture NO_PROPS_NO_EVENTS 1` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -564,10 +564,10 @@ exports[`GenerateComponentDescriptorH can generate fixture OBJECT_PROPS 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -592,10 +592,10 @@ exports[`GenerateComponentDescriptorH can generate fixture POINT_PROP 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -620,10 +620,10 @@ exports[`GenerateComponentDescriptorH can generate fixture STRING_ENUM_PROP 1`] Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -648,10 +648,10 @@ exports[`GenerateComponentDescriptorH can generate fixture STRING_PROP 1`] = ` Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -676,10 +676,10 @@ exports[`GenerateComponentDescriptorH can generate fixture TWO_COMPONENTS_DIFFER Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ @@ -705,10 +705,10 @@ exports[`GenerateComponentDescriptorH can generate fixture TWO_COMPONENTS_SAME_F Map { "ComponentDescriptors.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateComponentDescriptorH.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap index 68e1b8f98344..d21fa8930f0b 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateComponentHObjCpp-test.js.snap @@ -3,10 +3,10 @@ exports[`GenerateComponentHObjCpp can generate fixture ARRAY_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -28,10 +28,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -53,10 +53,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture BOOLEAN_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -78,10 +78,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture COLOR_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -103,10 +103,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture COMMANDS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -205,10 +205,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -289,10 +289,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -314,10 +314,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -339,10 +339,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture EVENT_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -364,10 +364,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -389,10 +389,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -414,10 +414,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -437,10 +437,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture FLOAT_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -462,10 +462,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture IMAGE_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -487,10 +487,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture INSETS_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -512,10 +512,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture INT32_ENUM_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -537,10 +537,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture INTEGER_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -562,10 +562,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture INTERFACE_ONLY 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -587,10 +587,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -612,10 +612,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -637,10 +637,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture OBJECT_PROPS 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -662,10 +662,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture POINT_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -687,10 +687,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture STRING_ENUM_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -712,10 +712,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture STRING_PROP 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -737,10 +737,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ @@ -766,10 +766,10 @@ NS_ASSUME_NONNULL_END", exports[`GenerateComponentHObjCpp can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = ` Map { "RCTComponentViewHelpers.h" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GenerateComponentHObjCpp.js */ 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 04c08736f743..8d0858dc93bf 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 @@ -4,10 +4,10 @@ exports[`GenerateEventEmitterCpp can generate fixture ARRAY_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -29,10 +29,10 @@ exports[`GenerateEventEmitterCpp can generate fixture ARRAY_PROPS_WITH_NESTED_OB Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -54,10 +54,10 @@ exports[`GenerateEventEmitterCpp can generate fixture BOOLEAN_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -79,10 +79,10 @@ exports[`GenerateEventEmitterCpp can generate fixture COLOR_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -104,10 +104,10 @@ exports[`GenerateEventEmitterCpp can generate fixture COMMANDS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -129,10 +129,10 @@ exports[`GenerateEventEmitterCpp can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -154,10 +154,10 @@ exports[`GenerateEventEmitterCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -179,10 +179,10 @@ exports[`GenerateEventEmitterCpp can generate fixture EVENT_NESTED_OBJECT_PROPS Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -222,10 +222,10 @@ exports[`GenerateEventEmitterCpp can generate fixture EVENT_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -273,10 +273,10 @@ exports[`GenerateEventEmitterCpp can generate fixture EVENTS_WITH_PAPER_NAME 1`] Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -311,10 +311,10 @@ exports[`GenerateEventEmitterCpp can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -336,10 +336,10 @@ exports[`GenerateEventEmitterCpp can generate fixture EXCLUDE_ANDROID_IOS 1`] = Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -361,10 +361,10 @@ exports[`GenerateEventEmitterCpp can generate fixture FLOAT_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -386,10 +386,10 @@ exports[`GenerateEventEmitterCpp can generate fixture IMAGE_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -411,10 +411,10 @@ exports[`GenerateEventEmitterCpp can generate fixture INSETS_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -436,10 +436,10 @@ exports[`GenerateEventEmitterCpp can generate fixture INT32_ENUM_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -461,10 +461,10 @@ exports[`GenerateEventEmitterCpp can generate fixture INTEGER_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -486,10 +486,10 @@ exports[`GenerateEventEmitterCpp can generate fixture INTERFACE_ONLY 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -517,10 +517,10 @@ exports[`GenerateEventEmitterCpp can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -542,10 +542,10 @@ exports[`GenerateEventEmitterCpp can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -567,10 +567,10 @@ exports[`GenerateEventEmitterCpp can generate fixture OBJECT_PROPS 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -592,10 +592,10 @@ exports[`GenerateEventEmitterCpp can generate fixture POINT_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -617,10 +617,10 @@ exports[`GenerateEventEmitterCpp can generate fixture STRING_ENUM_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -642,10 +642,10 @@ exports[`GenerateEventEmitterCpp can generate fixture STRING_PROP 1`] = ` Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -667,10 +667,10 @@ exports[`GenerateEventEmitterCpp can generate fixture TWO_COMPONENTS_DIFFERENT_F Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ @@ -693,10 +693,10 @@ exports[`GenerateEventEmitterCpp can generate fixture TWO_COMPONENTS_SAME_FILE 1 Map { "EventEmitters.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterCpp.js */ 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 18e1a2ce0d48..f04e069ca253 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 @@ -4,10 +4,10 @@ exports[`GenerateEventEmitterH can generate fixture ARRAY_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -30,10 +30,10 @@ exports[`GenerateEventEmitterH can generate fixture ARRAY_PROPS_WITH_NESTED_OBJE Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -56,10 +56,10 @@ exports[`GenerateEventEmitterH can generate fixture BOOLEAN_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -82,10 +82,10 @@ exports[`GenerateEventEmitterH can generate fixture COLOR_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -108,10 +108,10 @@ exports[`GenerateEventEmitterH can generate fixture COMMANDS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -134,10 +134,10 @@ exports[`GenerateEventEmitterH can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -160,10 +160,10 @@ exports[`GenerateEventEmitterH can generate fixture DOUBLE_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -186,10 +186,10 @@ exports[`GenerateEventEmitterH can generate fixture EVENT_NESTED_OBJECT_PROPS 1` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -231,10 +231,10 @@ exports[`GenerateEventEmitterH can generate fixture EVENT_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -295,10 +295,10 @@ exports[`GenerateEventEmitterH can generate fixture EVENTS_WITH_PAPER_NAME 1`] = Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -336,10 +336,10 @@ exports[`GenerateEventEmitterH can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -362,10 +362,10 @@ exports[`GenerateEventEmitterH can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -388,10 +388,10 @@ exports[`GenerateEventEmitterH can generate fixture FLOAT_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -414,10 +414,10 @@ exports[`GenerateEventEmitterH can generate fixture IMAGE_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -440,10 +440,10 @@ exports[`GenerateEventEmitterH can generate fixture INSETS_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -466,10 +466,10 @@ exports[`GenerateEventEmitterH can generate fixture INT32_ENUM_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -492,10 +492,10 @@ exports[`GenerateEventEmitterH can generate fixture INTEGER_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -518,10 +518,10 @@ exports[`GenerateEventEmitterH can generate fixture INTERFACE_ONLY 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -553,10 +553,10 @@ exports[`GenerateEventEmitterH can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -579,10 +579,10 @@ exports[`GenerateEventEmitterH can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -605,10 +605,10 @@ exports[`GenerateEventEmitterH can generate fixture OBJECT_PROPS 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -631,10 +631,10 @@ exports[`GenerateEventEmitterH can generate fixture POINT_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -657,10 +657,10 @@ exports[`GenerateEventEmitterH can generate fixture STRING_ENUM_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -683,10 +683,10 @@ exports[`GenerateEventEmitterH can generate fixture STRING_PROP 1`] = ` Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -709,10 +709,10 @@ exports[`GenerateEventEmitterH can generate fixture TWO_COMPONENTS_DIFFERENT_FIL Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ @@ -735,10 +735,10 @@ exports[`GenerateEventEmitterH can generate fixture TWO_COMPONENTS_SAME_FILE 1`] Map { "EventEmitters.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateEventEmitterH.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap index 3e5a5b031f97..2d54a94ffbe3 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsCpp-test.js.snap @@ -4,10 +4,10 @@ exports[`GeneratePropsCpp can generate fixture ARRAY_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -48,10 +48,10 @@ exports[`GeneratePropsCpp can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -81,10 +81,10 @@ exports[`GeneratePropsCpp can generate fixture BOOLEAN_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -114,10 +114,10 @@ exports[`GeneratePropsCpp can generate fixture COLOR_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -147,10 +147,10 @@ exports[`GeneratePropsCpp can generate fixture COMMANDS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -180,10 +180,10 @@ exports[`GeneratePropsCpp can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -213,10 +213,10 @@ exports[`GeneratePropsCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -251,10 +251,10 @@ exports[`GeneratePropsCpp can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -284,10 +284,10 @@ exports[`GeneratePropsCpp can generate fixture EVENT_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -317,10 +317,10 @@ exports[`GeneratePropsCpp can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -350,10 +350,10 @@ exports[`GeneratePropsCpp can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -383,10 +383,10 @@ exports[`GeneratePropsCpp can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -410,10 +410,10 @@ exports[`GeneratePropsCpp can generate fixture FLOAT_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -448,10 +448,10 @@ exports[`GeneratePropsCpp can generate fixture IMAGE_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -482,10 +482,10 @@ exports[`GeneratePropsCpp can generate fixture INSETS_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -515,10 +515,10 @@ exports[`GeneratePropsCpp can generate fixture INT32_ENUM_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -548,10 +548,10 @@ exports[`GeneratePropsCpp can generate fixture INTEGER_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -583,10 +583,10 @@ exports[`GeneratePropsCpp can generate fixture INTERFACE_ONLY 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -616,10 +616,10 @@ exports[`GeneratePropsCpp can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -653,10 +653,10 @@ exports[`GeneratePropsCpp can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -686,10 +686,10 @@ exports[`GeneratePropsCpp can generate fixture OBJECT_PROPS 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -720,10 +720,10 @@ exports[`GeneratePropsCpp can generate fixture POINT_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -753,10 +753,10 @@ exports[`GeneratePropsCpp can generate fixture STRING_ENUM_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -786,10 +786,10 @@ exports[`GeneratePropsCpp can generate fixture STRING_PROP 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -820,10 +820,10 @@ exports[`GeneratePropsCpp can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ @@ -860,10 +860,10 @@ exports[`GeneratePropsCpp can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = ` Map { "Props.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsCpp.js */ 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 707ce40d932b..d2bd083f9ee5 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 @@ -4,10 +4,10 @@ exports[`GeneratePropsH can generate fixture ARRAY_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -84,11 +84,11 @@ struct ArrayPropsNativeComponentObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto stringProp = map.find(\\"stringProp\\"); - if (stringProp != map.end()) { - fromRawValue(context, stringProp->second, result.stringProp); + auto tmp_stringProp = map.find(\\"stringProp\\"); + if (tmp_stringProp != map.end()) { + fromRawValue(context, tmp_stringProp->second, result.stringProp); } } @@ -111,11 +111,11 @@ struct ArrayPropsNativeComponentArrayObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto stringProp = map.find(\\"stringProp\\"); - if (stringProp != map.end()) { - fromRawValue(context, stringProp->second, result.stringProp); + auto tmp_stringProp = map.find(\\"stringProp\\"); + if (tmp_stringProp != map.end()) { + fromRawValue(context, tmp_stringProp->second, result.stringProp); } } @@ -138,11 +138,11 @@ struct ArrayPropsNativeComponentArrayStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto object = map.find(\\"object\\"); - if (object != map.end()) { - fromRawValue(context, object->second, result.object); + auto tmp_object = map.find(\\"object\\"); + if (tmp_object != map.end()) { + fromRawValue(context, tmp_object->second, result.object); } } @@ -165,11 +165,11 @@ struct ArrayPropsNativeComponentArrayOfArrayOfObjectStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentArrayOfArrayOfObjectStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto stringProp = map.find(\\"stringProp\\"); - if (stringProp != map.end()) { - fromRawValue(context, stringProp->second, result.stringProp); + auto tmp_stringProp = map.find(\\"stringProp\\"); + if (tmp_stringProp != map.end()) { + fromRawValue(context, tmp_stringProp->second, result.stringProp); } } @@ -220,10 +220,10 @@ exports[`GeneratePropsH can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -247,19 +247,19 @@ struct ArrayPropsNativeComponentNativePrimitivesStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ArrayPropsNativeComponentNativePrimitivesStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto colors = map.find(\\"colors\\"); - if (colors != map.end()) { - fromRawValue(context, colors->second, result.colors); + auto tmp_colors = map.find(\\"colors\\"); + if (tmp_colors != map.end()) { + fromRawValue(context, tmp_colors->second, result.colors); } - auto srcs = map.find(\\"srcs\\"); - if (srcs != map.end()) { - fromRawValue(context, srcs->second, result.srcs); + auto tmp_srcs = map.find(\\"srcs\\"); + if (tmp_srcs != map.end()) { + fromRawValue(context, tmp_srcs->second, result.srcs); } - auto points = map.find(\\"points\\"); - if (points != map.end()) { - fromRawValue(context, points->second, result.points); + auto tmp_points = map.find(\\"points\\"); + if (tmp_points != map.end()) { + fromRawValue(context, tmp_points->second, result.points); } } @@ -296,10 +296,10 @@ exports[`GeneratePropsH can generate fixture BOOLEAN_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -331,10 +331,10 @@ exports[`GeneratePropsH can generate fixture COLOR_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -367,10 +367,10 @@ exports[`GeneratePropsH can generate fixture COMMANDS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -402,10 +402,10 @@ exports[`GeneratePropsH can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -437,10 +437,10 @@ exports[`GeneratePropsH can generate fixture DOUBLE_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -477,10 +477,10 @@ exports[`GeneratePropsH can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -512,10 +512,10 @@ exports[`GeneratePropsH can generate fixture EVENT_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -547,10 +547,10 @@ exports[`GeneratePropsH can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -582,10 +582,10 @@ exports[`GeneratePropsH can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -617,10 +617,10 @@ exports[`GeneratePropsH can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -643,10 +643,10 @@ exports[`GeneratePropsH can generate fixture FLOAT_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -683,10 +683,10 @@ exports[`GeneratePropsH can generate fixture IMAGE_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -719,10 +719,10 @@ exports[`GeneratePropsH can generate fixture INSETS_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -755,10 +755,10 @@ exports[`GeneratePropsH can generate fixture INT32_ENUM_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -817,10 +817,10 @@ exports[`GeneratePropsH can generate fixture INTEGER_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -854,10 +854,10 @@ exports[`GeneratePropsH can generate fixture INTERFACE_ONLY 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -889,10 +889,10 @@ exports[`GeneratePropsH can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -930,10 +930,10 @@ exports[`GeneratePropsH can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -965,10 +965,10 @@ exports[`GeneratePropsH can generate fixture OBJECT_PROPS 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -1022,11 +1022,11 @@ struct ObjectPropsObjectPropObjectArrayPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectArrayPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto array = map.find(\\"array\\"); - if (array != map.end()) { - fromRawValue(context, array->second, result.array); + auto tmp_array = map.find(\\"array\\"); + if (tmp_array != map.end()) { + fromRawValue(context, tmp_array->second, result.array); } } @@ -1041,19 +1041,19 @@ struct ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropObjectPrimitiveRequiredPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto image = map.find(\\"image\\"); - if (image != map.end()) { - fromRawValue(context, image->second, result.image); + auto tmp_image = map.find(\\"image\\"); + if (tmp_image != map.end()) { + fromRawValue(context, tmp_image->second, result.image); } - auto color = map.find(\\"color\\"); - if (color != map.end()) { - fromRawValue(context, color->second, result.color); + auto tmp_color = map.find(\\"color\\"); + if (tmp_color != map.end()) { + fromRawValue(context, tmp_color->second, result.color); } - auto point = map.find(\\"point\\"); - if (point != map.end()) { - fromRawValue(context, point->second, result.point); + auto tmp_point = map.find(\\"point\\"); + if (tmp_point != map.end()) { + fromRawValue(context, tmp_point->second, result.point); } } @@ -1066,11 +1066,11 @@ struct ObjectPropsObjectPropNestedPropANestedPropBStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropANestedPropBStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto nestedPropC = map.find(\\"nestedPropC\\"); - if (nestedPropC != map.end()) { - fromRawValue(context, nestedPropC->second, result.nestedPropC); + auto tmp_nestedPropC = map.find(\\"nestedPropC\\"); + if (tmp_nestedPropC != map.end()) { + fromRawValue(context, tmp_nestedPropC->second, result.nestedPropC); } } @@ -1083,11 +1083,11 @@ struct ObjectPropsObjectPropNestedPropAStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedPropAStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto nestedPropB = map.find(\\"nestedPropB\\"); - if (nestedPropB != map.end()) { - fromRawValue(context, nestedPropB->second, result.nestedPropB); + auto tmp_nestedPropB = map.find(\\"nestedPropB\\"); + if (tmp_nestedPropB != map.end()) { + fromRawValue(context, tmp_nestedPropB->second, result.nestedPropB); } } @@ -1100,11 +1100,11 @@ struct ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyArrayPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto stringProp = map.find(\\"stringProp\\"); - if (stringProp != map.end()) { - fromRawValue(context, stringProp->second, result.stringProp); + auto tmp_stringProp = map.find(\\"stringProp\\"); + if (tmp_stringProp != map.end()) { + fromRawValue(context, tmp_stringProp->second, result.stringProp); } } @@ -1127,11 +1127,11 @@ struct ObjectPropsObjectPropNestedArrayAsPropertyStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropNestedArrayAsPropertyStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto arrayProp = map.find(\\"arrayProp\\"); - if (arrayProp != map.end()) { - fromRawValue(context, arrayProp->second, result.arrayProp); + auto tmp_arrayProp = map.find(\\"arrayProp\\"); + if (tmp_arrayProp != map.end()) { + fromRawValue(context, tmp_arrayProp->second, result.arrayProp); } } @@ -1153,47 +1153,47 @@ struct ObjectPropsObjectPropStruct { }; static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, ObjectPropsObjectPropStruct &result) { - auto map = (better::map)value; + auto map = (butter::map)value; - auto stringProp = map.find(\\"stringProp\\"); - if (stringProp != map.end()) { - fromRawValue(context, stringProp->second, result.stringProp); + auto tmp_stringProp = map.find(\\"stringProp\\"); + if (tmp_stringProp != map.end()) { + fromRawValue(context, tmp_stringProp->second, result.stringProp); } - auto booleanProp = map.find(\\"booleanProp\\"); - if (booleanProp != map.end()) { - fromRawValue(context, booleanProp->second, result.booleanProp); + auto tmp_booleanProp = map.find(\\"booleanProp\\"); + if (tmp_booleanProp != map.end()) { + fromRawValue(context, tmp_booleanProp->second, result.booleanProp); } - auto floatProp = map.find(\\"floatProp\\"); - if (floatProp != map.end()) { - fromRawValue(context, floatProp->second, result.floatProp); + auto tmp_floatProp = map.find(\\"floatProp\\"); + if (tmp_floatProp != map.end()) { + fromRawValue(context, tmp_floatProp->second, result.floatProp); } - auto intProp = map.find(\\"intProp\\"); - if (intProp != map.end()) { - fromRawValue(context, intProp->second, result.intProp); + auto tmp_intProp = map.find(\\"intProp\\"); + if (tmp_intProp != map.end()) { + fromRawValue(context, tmp_intProp->second, result.intProp); } - auto stringEnumProp = map.find(\\"stringEnumProp\\"); - if (stringEnumProp != map.end()) { - fromRawValue(context, stringEnumProp->second, result.stringEnumProp); + auto tmp_stringEnumProp = map.find(\\"stringEnumProp\\"); + if (tmp_stringEnumProp != map.end()) { + fromRawValue(context, tmp_stringEnumProp->second, result.stringEnumProp); } - auto intEnumProp = map.find(\\"intEnumProp\\"); - if (intEnumProp != map.end()) { - fromRawValue(context, intEnumProp->second, result.intEnumProp); + auto tmp_intEnumProp = map.find(\\"intEnumProp\\"); + if (tmp_intEnumProp != map.end()) { + fromRawValue(context, tmp_intEnumProp->second, result.intEnumProp); } - auto objectArrayProp = map.find(\\"objectArrayProp\\"); - if (objectArrayProp != map.end()) { - fromRawValue(context, objectArrayProp->second, result.objectArrayProp); + auto tmp_objectArrayProp = map.find(\\"objectArrayProp\\"); + if (tmp_objectArrayProp != map.end()) { + fromRawValue(context, tmp_objectArrayProp->second, result.objectArrayProp); } - auto objectPrimitiveRequiredProp = map.find(\\"objectPrimitiveRequiredProp\\"); - if (objectPrimitiveRequiredProp != map.end()) { - fromRawValue(context, objectPrimitiveRequiredProp->second, result.objectPrimitiveRequiredProp); + auto tmp_objectPrimitiveRequiredProp = map.find(\\"objectPrimitiveRequiredProp\\"); + if (tmp_objectPrimitiveRequiredProp != map.end()) { + fromRawValue(context, tmp_objectPrimitiveRequiredProp->second, result.objectPrimitiveRequiredProp); } - auto nestedPropA = map.find(\\"nestedPropA\\"); - if (nestedPropA != map.end()) { - fromRawValue(context, nestedPropA->second, result.nestedPropA); + auto tmp_nestedPropA = map.find(\\"nestedPropA\\"); + if (tmp_nestedPropA != map.end()) { + fromRawValue(context, tmp_nestedPropA->second, result.nestedPropA); } - auto nestedArrayAsProperty = map.find(\\"nestedArrayAsProperty\\"); - if (nestedArrayAsProperty != map.end()) { - fromRawValue(context, nestedArrayAsProperty->second, result.nestedArrayAsProperty); + auto tmp_nestedArrayAsProperty = map.find(\\"nestedArrayAsProperty\\"); + if (tmp_nestedArrayAsProperty != map.end()) { + fromRawValue(context, tmp_nestedArrayAsProperty->second, result.nestedArrayAsProperty); } } @@ -1220,10 +1220,10 @@ exports[`GeneratePropsH can generate fixture POINT_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -1256,10 +1256,10 @@ exports[`GeneratePropsH can generate fixture STRING_ENUM_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -1309,10 +1309,10 @@ exports[`GeneratePropsH can generate fixture STRING_PROP 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -1345,10 +1345,10 @@ exports[`GeneratePropsH can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ @@ -1390,10 +1390,10 @@ exports[`GeneratePropsH can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = ` Map { "Props.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GeneratePropsH.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap index 2b062c4f906b..9cd5fb54c8af 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaDelegate-test.js.snap @@ -3,10 +3,10 @@ exports[`GeneratePropsJavaDelegate can generate fixture ARRAY_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerDelegate.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -71,10 +71,10 @@ public class ArrayPropsNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -109,10 +109,10 @@ public class ArrayPropsNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -146,10 +146,10 @@ public class BooleanPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -184,10 +184,10 @@ public class ColorPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -228,10 +228,10 @@ public class CommandNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -278,10 +278,10 @@ public class CommandNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -330,10 +330,10 @@ public class DoublePropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -367,10 +367,10 @@ public class EventsNestedObjectNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -404,10 +404,10 @@ public class EventsNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -439,10 +439,10 @@ exports[`GeneratePropsJavaDelegate can generate fixture EXCLUDE_ANDROID_IOS 1`] exports[`GeneratePropsJavaDelegate can generate fixture FLOAT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/FloatPropNativeComponentManagerDelegate.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -491,10 +491,10 @@ public class FloatPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -529,10 +529,10 @@ public class ImagePropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -567,10 +567,10 @@ public class InsetsPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -604,10 +604,10 @@ public class Int32EnumPropsNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -647,10 +647,10 @@ public class IntegerPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -684,10 +684,10 @@ public class InterfaceOnlyComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -732,10 +732,10 @@ public class ImageColorPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -763,10 +763,10 @@ public class NoPropsNoEventsComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -801,10 +801,10 @@ public class ObjectPropsManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -839,10 +839,10 @@ public class PointPropNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -876,10 +876,10 @@ public class StringEnumPropsNativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -916,10 +916,10 @@ public class StringPropComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -948,10 +948,10 @@ public class MultiFile1NativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -985,10 +985,10 @@ public class MultiFile2NativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ @@ -1017,10 +1017,10 @@ public class MultiComponent1NativeComponentManagerDelegate "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaDelegate.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap index 2add98876ce4..550da64c73b0 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaInterface-test.js.snap @@ -3,10 +3,10 @@ exports[`GeneratePropsJavaInterface can generate fixture ARRAY_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -37,10 +37,10 @@ public interface ArrayPropsNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = ` Map { "java/com/facebook/react/viewmanagers/ArrayPropsNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -61,10 +61,10 @@ public interface ArrayPropsNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture BOOLEAN_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/BooleanPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -83,10 +83,10 @@ public interface BooleanPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture COLOR_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/ColorPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -106,10 +106,10 @@ public interface ColorPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture COMMANDS 1`] = ` Map { "java/com/facebook/react/viewmanagers/CommandNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -130,10 +130,10 @@ public interface CommandNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/CommandNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -155,10 +155,10 @@ public interface CommandNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture DOUBLE_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/DoublePropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -182,10 +182,10 @@ public interface DoublePropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/EventsNestedObjectNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -204,10 +204,10 @@ public interface EventsNestedObjectNativeComponentManagerInterface "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -226,10 +226,10 @@ public interface EventsNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "java/com/facebook/react/viewmanagers/InterfaceOnlyComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -252,10 +252,10 @@ exports[`GeneratePropsJavaInterface can generate fixture EXCLUDE_ANDROID_IOS 1`] exports[`GeneratePropsJavaInterface can generate fixture FLOAT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/FloatPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -279,10 +279,10 @@ public interface FloatPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture IMAGE_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/ImagePropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -303,10 +303,10 @@ public interface ImagePropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture INSETS_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/InsetsPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -327,10 +327,10 @@ public interface InsetsPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture INT32_ENUM_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Int32EnumPropsNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -350,10 +350,10 @@ public interface Int32EnumPropsNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture INTEGER_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/IntegerPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -374,10 +374,10 @@ public interface IntegerPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture INTERFACE_ONLY 1`] = ` Map { "java/com/facebook/react/viewmanagers/InterfaceOnlyComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -397,10 +397,10 @@ public interface InterfaceOnlyComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/ImageColorPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -424,10 +424,10 @@ public interface ImageColorPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "java/com/facebook/react/viewmanagers/NoPropsNoEventsComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -446,10 +446,10 @@ public interface NoPropsNoEventsComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture OBJECT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/ObjectPropsManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -470,10 +470,10 @@ public interface ObjectPropsManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture POINT_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/PointPropNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -494,10 +494,10 @@ public interface PointPropNativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture STRING_ENUM_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/StringEnumPropsNativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -517,10 +517,10 @@ public interface StringEnumPropsNativeComponentManagerInterface exports[`GeneratePropsJavaInterface can generate fixture STRING_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/StringPropComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -541,10 +541,10 @@ public interface StringPropComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = ` Map { "java/com/facebook/react/viewmanagers/MultiFile1NativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -558,10 +558,10 @@ public interface MultiFile1NativeComponentManagerInterface { } ", "java/com/facebook/react/viewmanagers/MultiFile2NativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -580,10 +580,10 @@ public interface MultiFile2NativeComponentManagerInterface { exports[`GeneratePropsJavaInterface can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = ` Map { "java/com/facebook/react/viewmanagers/MultiComponent1NativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ @@ -597,10 +597,10 @@ public interface MultiComponent1NativeComponentManagerInterface } ", "java/com/facebook/react/viewmanagers/MultiComponent2NativeComponentManagerInterface.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. +* Do not edit this file as changes may cause incorrect behavior and will be lost +* once the code is regenerated. * * @generated by codegen project: GeneratePropsJavaInterface.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap index bc6b90358a26..25f4abc590c2 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GeneratePropsJavaPojo-test.js.snap @@ -3,7 +3,7 @@ exports[`GeneratePropsJavaPojo can generate fixture ARRAY_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentPropsObjectElement.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -26,7 +26,7 @@ public class ArrayPropsNativeComponentPropsObjectElement { } ", "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentPropsArrayElementObjectElement.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -49,7 +49,7 @@ public class ArrayPropsNativeComponentPropsArrayElementObjectElement { } ", "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentPropsArrayElement.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -72,7 +72,7 @@ public class ArrayPropsNativeComponentPropsArrayElement { } ", "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentPropsArrayOfArrayOfObjectElementElement.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -95,7 +95,7 @@ public class ArrayPropsNativeComponentPropsArrayOfArrayOfObjectElementElement { } ", "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -174,7 +174,7 @@ public class ArrayPropsNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = ` Map { "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentPropsNativePrimitivesElement.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -208,7 +208,7 @@ public class ArrayPropsNativeComponentPropsNativePrimitivesElement { } ", "java/com/facebook/react/viewmanagers/Slider/ArrayPropsNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -236,7 +236,7 @@ public class ArrayPropsNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture BOOLEAN_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/BooleanPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -263,7 +263,7 @@ public class BooleanPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture COLOR_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/ColorPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -291,7 +291,7 @@ public class ColorPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture COMMANDS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/CommandNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -315,7 +315,7 @@ public class CommandNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/CommandNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -343,7 +343,7 @@ public class CommandNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture DOUBLE_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/DoublePropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -395,7 +395,7 @@ public class DoublePropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/EventsNestedObjectNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -422,7 +422,7 @@ public class EventsNestedObjectNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture EVENT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/EventsNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -449,7 +449,7 @@ public class EventsNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/InterfaceOnlyComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -477,7 +477,7 @@ exports[`GeneratePropsJavaPojo can generate fixture EXCLUDE_ANDROID_IOS 1`] = `M exports[`GeneratePropsJavaPojo can generate fixture FLOAT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/FloatPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -529,7 +529,7 @@ public class FloatPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture IMAGE_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Slider/ImagePropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -558,7 +558,7 @@ public class ImagePropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture INSETS_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/ScrollView/InsetsPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -587,7 +587,7 @@ public class InsetsPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture INT32_ENUM_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/Int32EnumPropsNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -615,7 +615,7 @@ public class Int32EnumPropsNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture INTEGER_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/IntegerPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -652,7 +652,7 @@ public class IntegerPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture INTERFACE_ONLY 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/InterfaceOnlyComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -680,7 +680,7 @@ public class InterfaceOnlyComponentProps { exports[`GeneratePropsJavaPojo can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Slider/ImageColorPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -724,7 +724,7 @@ public class ImageColorPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "java/com/facebook/react/viewmanagers/NoPropsNoEvents/NoPropsNoEventsComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -748,7 +748,7 @@ public class NoPropsNoEventsComponentProps { exports[`GeneratePropsJavaPojo can generate fixture OBJECT_PROPS 1`] = ` Map { "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectPropObjectArrayProp.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -771,7 +771,7 @@ public class ObjectPropsPropsObjectPropObjectArrayProp { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectPropObjectPrimitiveRequiredProp.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -805,7 +805,7 @@ public class ObjectPropsPropsObjectPropObjectPrimitiveRequiredProp { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectPropNestedPropANestedPropB.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -828,7 +828,7 @@ public class ObjectPropsPropsObjectPropNestedPropANestedPropB { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectPropNestedPropA.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -850,7 +850,7 @@ public class ObjectPropsPropsObjectPropNestedPropA { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectPropNestedArrayAsPropertyArrayPropElement.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -873,7 +873,7 @@ public class ObjectPropsPropsObjectPropNestedArrayAsPropertyArrayPropElement { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectPropNestedArrayAsProperty.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -896,7 +896,7 @@ public class ObjectPropsPropsObjectPropNestedArrayAsProperty { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsPropsObjectProp.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -964,7 +964,7 @@ public class ObjectPropsPropsObjectProp { } ", "java/com/facebook/react/viewmanagers/ObjectPropsNativeComponent/ObjectPropsProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -991,7 +991,7 @@ public class ObjectPropsProps { exports[`GeneratePropsJavaPojo can generate fixture POINT_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/PointPropNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1020,7 +1020,7 @@ public class PointPropNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture STRING_ENUM_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/StringEnumPropsNativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1048,7 +1048,7 @@ public class StringEnumPropsNativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture STRING_PROP 1`] = ` Map { "java/com/facebook/react/viewmanagers/Switch/StringPropComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1081,7 +1081,7 @@ public class StringPropComponentProps { exports[`GeneratePropsJavaPojo can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = ` Map { "java/com/facebook/react/viewmanagers/ComponentFile1/MultiFile1NativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1103,7 +1103,7 @@ public class MultiFile1NativeComponentProps { } ", "java/com/facebook/react/viewmanagers/ComponentFile2/MultiFile2NativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1130,7 +1130,7 @@ public class MultiFile2NativeComponentProps { exports[`GeneratePropsJavaPojo can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = ` Map { "java/com/facebook/react/viewmanagers/MyComponents/MultiComponent1NativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1152,7 +1152,7 @@ public class MultiComponent1NativeComponentProps { } ", "java/com/facebook/react/viewmanagers/MyComponents/MultiComponent2NativeComponentProps.java" => "/** -* Copyright (c) Facebook, Inc. and its affiliates. +* Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap index f953c291ba49..028d4fcbde95 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeCpp-test.js.snap @@ -4,10 +4,10 @@ exports[`GenerateShadowNodeCpp can generate fixture ARRAY_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -29,10 +29,10 @@ exports[`GenerateShadowNodeCpp can generate fixture ARRAY_PROPS_WITH_NESTED_OBJE Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -54,10 +54,10 @@ exports[`GenerateShadowNodeCpp can generate fixture BOOLEAN_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -79,10 +79,10 @@ exports[`GenerateShadowNodeCpp can generate fixture COLOR_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -104,10 +104,10 @@ exports[`GenerateShadowNodeCpp can generate fixture COMMANDS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -129,10 +129,10 @@ exports[`GenerateShadowNodeCpp can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -154,10 +154,10 @@ exports[`GenerateShadowNodeCpp can generate fixture DOUBLE_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -179,10 +179,10 @@ exports[`GenerateShadowNodeCpp can generate fixture EVENT_NESTED_OBJECT_PROPS 1` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -204,10 +204,10 @@ exports[`GenerateShadowNodeCpp can generate fixture EVENT_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -229,10 +229,10 @@ exports[`GenerateShadowNodeCpp can generate fixture EVENTS_WITH_PAPER_NAME 1`] = Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -254,10 +254,10 @@ exports[`GenerateShadowNodeCpp can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -279,10 +279,10 @@ exports[`GenerateShadowNodeCpp can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -304,10 +304,10 @@ exports[`GenerateShadowNodeCpp can generate fixture FLOAT_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -329,10 +329,10 @@ exports[`GenerateShadowNodeCpp can generate fixture IMAGE_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -354,10 +354,10 @@ exports[`GenerateShadowNodeCpp can generate fixture INSETS_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -379,10 +379,10 @@ exports[`GenerateShadowNodeCpp can generate fixture INT32_ENUM_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -404,10 +404,10 @@ exports[`GenerateShadowNodeCpp can generate fixture INTEGER_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -429,10 +429,10 @@ exports[`GenerateShadowNodeCpp can generate fixture INTERFACE_ONLY 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -454,10 +454,10 @@ exports[`GenerateShadowNodeCpp can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -479,10 +479,10 @@ exports[`GenerateShadowNodeCpp can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -504,10 +504,10 @@ exports[`GenerateShadowNodeCpp can generate fixture OBJECT_PROPS 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -529,10 +529,10 @@ exports[`GenerateShadowNodeCpp can generate fixture POINT_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -554,10 +554,10 @@ exports[`GenerateShadowNodeCpp can generate fixture STRING_ENUM_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -579,10 +579,10 @@ exports[`GenerateShadowNodeCpp can generate fixture STRING_PROP 1`] = ` Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -604,10 +604,10 @@ exports[`GenerateShadowNodeCpp can generate fixture TWO_COMPONENTS_DIFFERENT_FIL Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ @@ -630,10 +630,10 @@ exports[`GenerateShadowNodeCpp can generate fixture TWO_COMPONENTS_SAME_FILE 1`] Map { "ShadowNodes.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeCpp.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap index bb34cfbab427..d70c0fe1a5ec 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateShadowNodeH-test.js.snap @@ -4,10 +4,10 @@ exports[`GenerateShadowNodeH can generate fixture ARRAY_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -39,10 +39,10 @@ exports[`GenerateShadowNodeH can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -74,10 +74,10 @@ exports[`GenerateShadowNodeH can generate fixture BOOLEAN_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -109,10 +109,10 @@ exports[`GenerateShadowNodeH can generate fixture COLOR_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -144,10 +144,10 @@ exports[`GenerateShadowNodeH can generate fixture COMMANDS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -179,10 +179,10 @@ exports[`GenerateShadowNodeH can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -214,10 +214,10 @@ exports[`GenerateShadowNodeH can generate fixture DOUBLE_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -249,10 +249,10 @@ exports[`GenerateShadowNodeH can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -286,10 +286,10 @@ exports[`GenerateShadowNodeH can generate fixture EVENT_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -323,10 +323,10 @@ exports[`GenerateShadowNodeH can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -351,10 +351,10 @@ exports[`GenerateShadowNodeH can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -386,10 +386,10 @@ exports[`GenerateShadowNodeH can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -421,10 +421,10 @@ exports[`GenerateShadowNodeH can generate fixture FLOAT_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -456,10 +456,10 @@ exports[`GenerateShadowNodeH can generate fixture IMAGE_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -491,10 +491,10 @@ exports[`GenerateShadowNodeH can generate fixture INSETS_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -526,10 +526,10 @@ exports[`GenerateShadowNodeH can generate fixture INT32_ENUM_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -561,10 +561,10 @@ exports[`GenerateShadowNodeH can generate fixture INTEGER_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -596,10 +596,10 @@ exports[`GenerateShadowNodeH can generate fixture INTERFACE_ONLY 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -624,10 +624,10 @@ exports[`GenerateShadowNodeH can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -659,10 +659,10 @@ exports[`GenerateShadowNodeH can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -694,10 +694,10 @@ exports[`GenerateShadowNodeH can generate fixture OBJECT_PROPS 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -729,10 +729,10 @@ exports[`GenerateShadowNodeH can generate fixture POINT_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -764,10 +764,10 @@ exports[`GenerateShadowNodeH can generate fixture STRING_ENUM_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -799,10 +799,10 @@ exports[`GenerateShadowNodeH can generate fixture STRING_PROP 1`] = ` Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -834,10 +834,10 @@ exports[`GenerateShadowNodeH can generate fixture TWO_COMPONENTS_DIFFERENT_FILES Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ @@ -878,10 +878,10 @@ exports[`GenerateShadowNodeH can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = Map { "ShadowNodes.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateShadowNodeH.js */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap index a7981270dcde..14a07e9534c0 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateTests-test.js.snap @@ -3,10 +3,10 @@ exports[`GenerateTests can generate fixture ARRAY_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -39,10 +39,10 @@ TEST(ArrayPropsNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture ARRAY_PROPS_WITH_NESTED_OBJECT 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -74,10 +74,10 @@ TEST(ArrayPropsNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture BOOLEAN_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -122,10 +122,10 @@ TEST(BooleanPropNativeComponentProps_disabled, etc) { exports[`GenerateTests can generate fixture COLOR_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -170,10 +170,10 @@ TEST(ColorPropNativeComponentProps_tintColor, etc) { exports[`GenerateTests can generate fixture COMMANDS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -205,10 +205,10 @@ TEST(CommandNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -253,10 +253,10 @@ TEST(CommandNativeComponentProps_accessibilityHint, etc) { exports[`GenerateTests can generate fixture DOUBLE_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -288,10 +288,10 @@ TEST(DoublePropNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -336,10 +336,10 @@ TEST(EventsNestedObjectNativeComponentProps_disabled, etc) { exports[`GenerateTests can generate fixture EVENT_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -384,10 +384,10 @@ TEST(EventsNativeComponentProps_disabled, etc) { exports[`GenerateTests can generate fixture EVENTS_WITH_PAPER_NAME 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -419,10 +419,10 @@ TEST(InterfaceOnlyComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -454,10 +454,10 @@ TEST(ExcludedAndroidComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -489,10 +489,10 @@ TEST(ExcludedAndroidIosComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture FLOAT_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -602,10 +602,10 @@ TEST(FloatPropNativeComponentProps_blurRadius6, etc) { exports[`GenerateTests can generate fixture IMAGE_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -651,10 +651,10 @@ TEST(ImagePropNativeComponentProps_thumbImage, etc) { exports[`GenerateTests can generate fixture INSETS_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -686,10 +686,10 @@ TEST(InsetsPropNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture INT32_ENUM_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -721,10 +721,10 @@ TEST(Int32EnumPropsNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture INTEGER_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -756,10 +756,10 @@ TEST(IntegerPropNativeComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture INTERFACE_ONLY 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -804,10 +804,10 @@ TEST(InterfaceOnlyComponentProps_accessibilityHint, etc) { exports[`GenerateTests can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -892,10 +892,10 @@ TEST(ImageColorPropNativeComponentProps_point, etc) { exports[`GenerateTests can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -927,10 +927,10 @@ TEST(NoPropsNoEventsComponentProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture OBJECT_PROPS 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -963,10 +963,10 @@ TEST(ObjectPropsProps_DoesNotDie, etc) { exports[`GenerateTests can generate fixture POINT_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -1011,10 +1011,10 @@ TEST(PointPropNativeComponentProps_startPoint, etc) { exports[`GenerateTests can generate fixture STRING_ENUM_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -1085,10 +1085,10 @@ TEST(StringEnumPropsNativeComponentProps_alignment_BottomRight, etc) { exports[`GenerateTests can generate fixture STRING_PROP 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -1146,10 +1146,10 @@ TEST(StringPropComponentProps_accessibilityRole, etc) { exports[`GenerateTests can generate fixture TWO_COMPONENTS_DIFFERENT_FILES 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ @@ -1220,10 +1220,10 @@ TEST(MultiFile2NativeComponentProps_disabled, etc) { exports[`GenerateTests can generate fixture TWO_COMPONENTS_SAME_FILE 1`] = ` Map { "Tests.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateTests.js * */ diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap new file mode 100644 index 000000000000..46ad5bcb81a6 --- /dev/null +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderH-test.js.snap @@ -0,0 +1,63 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateThirdPartyFabricComponentsProviderH can generate fixtures 1`] = ` +Map { + "RCTThirdPartyFabricComponentsProvider.h" => " +/* + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by GenerateRCTThirdPartyFabricComponentsProviderH + */ + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored \\"-Wreturn-type-c-linkage\\" + +#import + +#ifdef __cplusplus +extern \\"C\\" { +#endif + +Class RCTThirdPartyFabricComponentsProvider(const char *name); + +Class NoPropsNoEventsComponentCls(void) __attribute__((used)); // NO_PROPS_NO_EVENTS +Class InterfaceOnlyComponentCls(void) __attribute__((used)); // INTERFACE_ONLY +Class BooleanPropNativeComponentCls(void) __attribute__((used)); // BOOLEAN_PROP +Class StringPropComponentCls(void) __attribute__((used)); // STRING_PROP +Class IntegerPropNativeComponentCls(void) __attribute__((used)); // INTEGER_PROPS +Class DoublePropNativeComponentCls(void) __attribute__((used)); // DOUBLE_PROPS +Class FloatPropNativeComponentCls(void) __attribute__((used)); // FLOAT_PROPS +Class ColorPropNativeComponentCls(void) __attribute__((used)); // COLOR_PROP +Class ImagePropNativeComponentCls(void) __attribute__((used)); // IMAGE_PROP +Class PointPropNativeComponentCls(void) __attribute__((used)); // POINT_PROP +Class InsetsPropNativeComponentCls(void) __attribute__((used)); // INSETS_PROP +Class ArrayPropsNativeComponentCls(void) __attribute__((used)); // ARRAY_PROPS +Class ArrayPropsNativeComponentCls(void) __attribute__((used)); // ARRAY_PROPS_WITH_NESTED_OBJECT +Class ObjectPropsCls(void) __attribute__((used)); // OBJECT_PROPS +Class ImageColorPropNativeComponentCls(void) __attribute__((used)); // MULTI_NATIVE_PROP +Class StringEnumPropsNativeComponentCls(void) __attribute__((used)); // STRING_ENUM_PROP +Class Int32EnumPropsNativeComponentCls(void) __attribute__((used)); // INT32_ENUM_PROP +Class EventsNativeComponentCls(void) __attribute__((used)); // EVENT_PROPS +Class InterfaceOnlyComponentCls(void) __attribute__((used)); // EVENTS_WITH_PAPER_NAME +Class EventsNestedObjectNativeComponentCls(void) __attribute__((used)); // EVENT_NESTED_OBJECT_PROPS +Class MultiComponent1NativeComponentCls(void) __attribute__((used)); // TWO_COMPONENTS_SAME_FILE +Class MultiComponent2NativeComponentCls(void) __attribute__((used)); // TWO_COMPONENTS_SAME_FILE +Class MultiFile1NativeComponentCls(void) __attribute__((used)); // TWO_COMPONENTS_DIFFERENT_FILES +Class MultiFile2NativeComponentCls(void) __attribute__((used)); // TWO_COMPONENTS_DIFFERENT_FILES +Class CommandNativeComponentCls(void) __attribute__((used)); // COMMANDS +Class CommandNativeComponentCls(void) __attribute__((used)); // COMMANDS_AND_PROPS +Class ExcludedAndroidComponentCls(void) __attribute__((used)); // EXCLUDE_ANDROID + + +#ifdef __cplusplus +} +#endif + +#pragma GCC diagnostic pop + +", +} +`; diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap new file mode 100644 index 000000000000..fd1ed6671544 --- /dev/null +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateThirdPartyFabricComponentsProviderObjCpp-test.js.snap @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`GenerateThirdPartyFabricComponentsProviderObjCpp can generate fixtures 1`] = ` +Map { + "RCTThirdPartyFabricComponentsProvider.mm" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by GenerateRCTThirdPartyFabricComponentsProviderCpp + */ + +// OSS-compatibility layer + +#import \\"RCTThirdPartyFabricComponentsProvider.h\\" + +#import +#import + +Class RCTThirdPartyFabricComponentsProvider(const char *name) { + static std::unordered_map sFabricComponentsClassMap = { + + {\\"NoPropsNoEventsComponent\\", NoPropsNoEventsComponentCls}, // NO_PROPS_NO_EVENTS + + {\\"InterfaceOnlyComponent\\", InterfaceOnlyComponentCls}, // INTERFACE_ONLY + + {\\"BooleanPropNativeComponent\\", BooleanPropNativeComponentCls}, // BOOLEAN_PROP + + {\\"StringPropComponent\\", StringPropComponentCls}, // STRING_PROP + + {\\"IntegerPropNativeComponent\\", IntegerPropNativeComponentCls}, // INTEGER_PROPS + + {\\"DoublePropNativeComponent\\", DoublePropNativeComponentCls}, // DOUBLE_PROPS + + {\\"FloatPropNativeComponent\\", FloatPropNativeComponentCls}, // FLOAT_PROPS + + {\\"ColorPropNativeComponent\\", ColorPropNativeComponentCls}, // COLOR_PROP + + {\\"ImagePropNativeComponent\\", ImagePropNativeComponentCls}, // IMAGE_PROP + + {\\"PointPropNativeComponent\\", PointPropNativeComponentCls}, // POINT_PROP + + {\\"InsetsPropNativeComponent\\", InsetsPropNativeComponentCls}, // INSETS_PROP + + {\\"ArrayPropsNativeComponent\\", ArrayPropsNativeComponentCls}, // ARRAY_PROPS + + {\\"ArrayPropsNativeComponent\\", ArrayPropsNativeComponentCls}, // ARRAY_PROPS_WITH_NESTED_OBJECT + + {\\"ObjectProps\\", ObjectPropsCls}, // OBJECT_PROPS + + {\\"ImageColorPropNativeComponent\\", ImageColorPropNativeComponentCls}, // MULTI_NATIVE_PROP + + {\\"StringEnumPropsNativeComponent\\", StringEnumPropsNativeComponentCls}, // STRING_ENUM_PROP + + {\\"Int32EnumPropsNativeComponent\\", Int32EnumPropsNativeComponentCls}, // INT32_ENUM_PROP + + {\\"EventsNativeComponent\\", EventsNativeComponentCls}, // EVENT_PROPS + + {\\"InterfaceOnlyComponent\\", InterfaceOnlyComponentCls}, // EVENTS_WITH_PAPER_NAME + + {\\"EventsNestedObjectNativeComponent\\", EventsNestedObjectNativeComponentCls}, // EVENT_NESTED_OBJECT_PROPS + + {\\"MultiComponent1NativeComponent\\", MultiComponent1NativeComponentCls}, // TWO_COMPONENTS_SAME_FILE, + {\\"MultiComponent2NativeComponent\\", MultiComponent2NativeComponentCls}, // TWO_COMPONENTS_SAME_FILE + + {\\"MultiFile1NativeComponent\\", MultiFile1NativeComponentCls}, // TWO_COMPONENTS_DIFFERENT_FILES, + {\\"MultiFile2NativeComponent\\", MultiFile2NativeComponentCls}, // TWO_COMPONENTS_DIFFERENT_FILES + + {\\"CommandNativeComponent\\", CommandNativeComponentCls}, // COMMANDS + + {\\"CommandNativeComponent\\", CommandNativeComponentCls}, // COMMANDS_AND_PROPS + + {\\"ExcludedAndroidComponent\\", ExcludedAndroidComponentCls}, // EXCLUDE_ANDROID + + }; + + auto p = sFabricComponentsClassMap.find(name); + if (p != sFabricComponentsClassMap.end()) { + auto classFunc = p->second; + return classFunc(); + } + return nil; +} +", +} +`; diff --git a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap index cf218e0b23e7..c6fd84f913b2 100644 --- a/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap +++ b/packages/react-native-codegen/src/generators/components/__tests__/__snapshots__/GenerateViewConfigJs-test.js.snap @@ -4,10 +4,10 @@ exports[`GenerateViewConfigJs can generate fixture ARRAY_PROPS 1`] = ` Map { "ARRAY_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -20,7 +20,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ArrayPropsNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ArrayPropsNativeComponent', validAttributes: { @@ -30,7 +31,7 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ radii: true, colors: { - process: require('processColorArray'), + process: require('react-native/Libraries/StyleSheet/processColorArray'), }, srcs: true, @@ -40,7 +41,9 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ array: true, arrayOfArrayOfObject: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -49,10 +52,10 @@ exports[`GenerateViewConfigJs can generate fixture ARRAY_PROPS_WITH_NESTED_OBJEC Map { "ARRAY_PROPS_WITH_NESTED_OBJECTNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -65,13 +68,16 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ArrayPropsNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ArrayPropsNativeComponent', validAttributes: { nativePrimitives: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -80,10 +86,10 @@ exports[`GenerateViewConfigJs can generate fixture BOOLEAN_PROP 1`] = ` Map { "BOOLEAN_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -96,13 +102,16 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'BooleanPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'BooleanPropNativeComponent', validAttributes: { disabled: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -111,10 +120,10 @@ exports[`GenerateViewConfigJs can generate fixture COLOR_PROP 1`] = ` Map { "COLOR_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -127,15 +136,18 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ColorPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ColorPropNativeComponent', validAttributes: { tintColor: { - process: require('processColor'), + process: require('react-native/Libraries/StyleSheet/processColor'), }, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -144,10 +156,10 @@ exports[`GenerateViewConfigJs can generate fixture COMMANDS 1`] = ` Map { "COMMANDSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -161,10 +173,13 @@ const {dispatchCommand} = require(\\"react-native/Libraries/Renderer/shims/React let nativeComponentName = 'CommandNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'CommandNativeComponent', validAttributes: {}, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); export const Commands = { flashScrollIndicators(ref) { @@ -183,10 +198,10 @@ exports[`GenerateViewConfigJs can generate fixture COMMANDS_AND_PROPS 1`] = ` Map { "COMMANDS_AND_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -200,13 +215,16 @@ const {dispatchCommand} = require(\\"react-native/Libraries/Renderer/shims/React let nativeComponentName = 'CommandNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'CommandNativeComponent', validAttributes: { accessibilityHint: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); export const Commands = { handleRootTag(ref, rootTag) { @@ -225,10 +243,10 @@ exports[`GenerateViewConfigJs can generate fixture DOUBLE_PROPS 1`] = ` Map { "DOUBLE_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -241,7 +259,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'DoublePropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'DoublePropNativeComponent', validAttributes: { @@ -252,7 +271,9 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ blurRadius5: true, blurRadius6: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -261,10 +282,10 @@ exports[`GenerateViewConfigJs can generate fixture EVENT_NESTED_OBJECT_PROPS 1`] Map { "EVENT_NESTED_OBJECT_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -277,7 +298,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'EventsNestedObjectNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'EventsNestedObjectNativeComponent', bubblingEventTypes: { @@ -291,9 +313,10 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ validAttributes: { disabled: true, - onChange: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -302,10 +325,10 @@ exports[`GenerateViewConfigJs can generate fixture EVENT_PROPS 1`] = ` Map { "EVENT_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -318,7 +341,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'EventsNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'EventsNativeComponent', bubblingEventTypes: { @@ -349,12 +373,10 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ validAttributes: { disabled: true, - onChange: true, - onEventDirect: true, - onOrientationChange: true, - onEnd: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -363,10 +385,10 @@ exports[`GenerateViewConfigJs can generate fixture EVENTS_WITH_PAPER_NAME 1`] = Map { "EVENTS_WITH_PAPER_NAMENativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -379,7 +401,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'RCTInterfaceOnlyComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'RCTInterfaceOnlyComponent', bubblingEventTypes: { @@ -389,30 +412,18 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ bubbled: 'onChange', }, }, - - topChange: { - phasedRegistrationNames: { - captured: 'onChangeCapture', - bubbled: 'onChange', - }, - }, }, directEventTypes: { paperDirectChange: { registrationName: 'onDire tChange', }, - - topDire tChange: { - registrationName: 'onDire tChange', - }, }, - validAttributes: { - onChange: true, - onDire tChange: true, - }, -})); + validAttributes: {}, +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -421,10 +432,10 @@ exports[`GenerateViewConfigJs can generate fixture EXCLUDE_ANDROID 1`] = ` Map { "EXCLUDE_ANDROIDNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -437,10 +448,13 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ExcludedAndroidComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ExcludedAndroidComponent', validAttributes: {}, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -449,10 +463,10 @@ exports[`GenerateViewConfigJs can generate fixture EXCLUDE_ANDROID_IOS 1`] = ` Map { "EXCLUDE_ANDROID_IOSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -465,10 +479,13 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ExcludedAndroidIosComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ExcludedAndroidIosComponent', validAttributes: {}, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -477,10 +494,10 @@ exports[`GenerateViewConfigJs can generate fixture FLOAT_PROPS 1`] = ` Map { "FLOAT_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -493,7 +510,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'FloatPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'FloatPropNativeComponent', validAttributes: { @@ -504,7 +522,9 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ blurRadius5: true, blurRadius6: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -513,10 +533,10 @@ exports[`GenerateViewConfigJs can generate fixture IMAGE_PROP 1`] = ` Map { "IMAGE_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -529,15 +549,18 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ImagePropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ImagePropNativeComponent', validAttributes: { thumbImage: { - process: require('resolveAssetSource'), + process: require('react-native/Libraries/Image/resolveAssetSource'), }, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -546,10 +569,10 @@ exports[`GenerateViewConfigJs can generate fixture INSETS_PROP 1`] = ` Map { "INSETS_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -562,15 +585,18 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'InsetsPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'InsetsPropNativeComponent', validAttributes: { contentInset: { - diff: require('insetsDiffer'), + diff: require('react-native/Libraries/Utilities/differ/insetsDiffer'), }, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -579,10 +605,10 @@ exports[`GenerateViewConfigJs can generate fixture INT32_ENUM_PROP 1`] = ` Map { "INT32_ENUM_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -595,13 +621,16 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'Int32EnumPropsNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'Int32EnumPropsNativeComponent', validAttributes: { maxInterval: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -610,10 +639,10 @@ exports[`GenerateViewConfigJs can generate fixture INTEGER_PROPS 1`] = ` Map { "INTEGER_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -626,7 +655,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'IntegerPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'IntegerPropNativeComponent', validAttributes: { @@ -634,7 +664,9 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ progress2: true, progress3: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -643,10 +675,10 @@ exports[`GenerateViewConfigJs can generate fixture INTERFACE_ONLY 1`] = ` Map { "INTERFACE_ONLYNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -659,7 +691,8 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'RCTInterfaceOnlyComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'RCTInterfaceOnlyComponent', bubblingEventTypes: { @@ -673,9 +706,10 @@ export default NativeComponentRegistry.get(nativeComponentName, () => ({ validAttributes: { accessibilityHint: true, - onChange: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -684,10 +718,10 @@ exports[`GenerateViewConfigJs can generate fixture MULTI_NATIVE_PROP 1`] = ` Map { "MULTI_NATIVE_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -700,27 +734,30 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ImageColorPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ImageColorPropNativeComponent', validAttributes: { thumbImage: { - process: require('resolveAssetSource'), + process: require('react-native/Libraries/Image/resolveAssetSource'), }, color: { - process: require('processColor'), + process: require('react-native/Libraries/StyleSheet/processColor'), }, thumbTintColor: { - process: require('processColor'), + process: require('react-native/Libraries/StyleSheet/processColor'), }, point: { - diff: require('pointsDiffer'), + diff: require('react-native/Libraries/Utilities/differ/pointsDiffer'), }, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -729,10 +766,10 @@ exports[`GenerateViewConfigJs can generate fixture NO_PROPS_NO_EVENTS 1`] = ` Map { "NO_PROPS_NO_EVENTSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -745,10 +782,13 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'NoPropsNoEventsComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'NoPropsNoEventsComponent', validAttributes: {}, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -757,10 +797,10 @@ exports[`GenerateViewConfigJs can generate fixture OBJECT_PROPS 1`] = ` Map { "OBJECT_PROPSNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -773,13 +813,16 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'ObjectProps'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'ObjectProps', validAttributes: { objectProp: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -788,10 +831,10 @@ exports[`GenerateViewConfigJs can generate fixture POINT_PROP 1`] = ` Map { "POINT_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -804,15 +847,18 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'PointPropNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'PointPropNativeComponent', validAttributes: { startPoint: { - diff: require('pointsDiffer'), + diff: require('react-native/Libraries/Utilities/differ/pointsDiffer'), }, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -821,10 +867,10 @@ exports[`GenerateViewConfigJs can generate fixture STRING_ENUM_PROP 1`] = ` Map { "STRING_ENUM_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -837,13 +883,16 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'StringEnumPropsNativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'StringEnumPropsNativeComponent', validAttributes: { alignment: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -852,10 +901,10 @@ exports[`GenerateViewConfigJs can generate fixture STRING_PROP 1`] = ` Map { "STRING_PROPNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -868,14 +917,17 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'StringPropComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'StringPropComponent', validAttributes: { accessibilityHint: true, accessibilityRole: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -884,10 +936,10 @@ exports[`GenerateViewConfigJs can generate fixture TWO_COMPONENTS_DIFFERENT_FILE Map { "TWO_COMPONENTS_DIFFERENT_FILESNativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -900,23 +952,29 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'MultiFile1NativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'MultiFile1NativeComponent', validAttributes: { disabled: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); let nativeComponentName = 'MultiFile2NativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'MultiFile2NativeComponent', validAttributes: { disabled: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -925,10 +983,10 @@ exports[`GenerateViewConfigJs can generate fixture TWO_COMPONENTS_SAME_FILE 1`] Map { "TWO_COMPONENTS_SAME_FILENativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -941,23 +999,29 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ let nativeComponentName = 'MultiComponent1NativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'MultiComponent1NativeComponent', validAttributes: { disabled: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); let nativeComponentName = 'MultiComponent2NativeComponent'; -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'MultiComponent2NativeComponent', validAttributes: { disabled: true, }, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; @@ -966,10 +1030,10 @@ exports[`GenerateViewConfigJs can generate fixture with a deprecated view config Map { "DEPRECATED_VIEW_CONFIG_NAMENativeViewConfig.js" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @flow * @@ -982,17 +1046,31 @@ const NativeComponentRegistry = require('react-native/Libraries/NativeComponent/ const {UIManager} = require(\\"react-native\\") let nativeComponentName = 'NativeComponentName'; -if (UIManager.getViewManagerConfig('NativeComponentName')) { - nativeComponentName = 'NativeComponentName'; -} else if (UIManager.getViewManagerConfig('DeprecatedNativeComponentName')) { - nativeComponentName = 'DeprecatedNativeComponentName'; +const staticViewConfigsEnabled = global.__fbStaticViewConfig === true; +if (staticViewConfigsEnabled) { + if (UIManager.hasViewManagerConfig('NativeComponentName')) { + nativeComponentName = 'NativeComponentName'; + } else if (UIManager.hasViewManagerConfig('DeprecatedNativeComponentName')) { + nativeComponentName = 'DeprecatedNativeComponentName'; + } else { + throw new Error('Failed to find native component for either \\"NativeComponentName\\" or \\"DeprecatedNativeComponentName\\", with SVC enabled.'); + } } else { - throw new Error('Failed to find native component for either \\"NativeComponentName\\" or \\"DeprecatedNativeComponentName\\"'); + if (UIManager.getViewManagerConfig('NativeComponentName')) { + nativeComponentName = 'NativeComponentName'; + } else if (UIManager.getViewManagerConfig('DeprecatedNativeComponentName')) { + nativeComponentName = 'DeprecatedNativeComponentName'; + } else { + throw new Error('Failed to find native component for either \\"NativeComponentName\\" or \\"DeprecatedNativeComponentName\\", with SVC disabled.'); + } } -export default NativeComponentRegistry.get(nativeComponentName, () => ({ + +export const __INTERNAL_VIEW_CONFIG = { uiViewClassName: 'NativeComponentName', validAttributes: {}, -})); +}; + +export default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG); ", } `; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js index 27eba9c32f1e..e432ee481212 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleCpp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -77,10 +77,10 @@ const FileTemplate = ({ modules: string, }>) => { return `/** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleH.js */ @@ -162,11 +162,8 @@ function serializePropertyIntoHostFunction( property: NativeModulePropertyShape, resolveAlias: AliasResolver, ): string { - const [ - propertyTypeAnnotation, - ] = unwrapNullable( - property.typeAnnotation, - ); + const [propertyTypeAnnotation] = + unwrapNullable(property.typeAnnotation); const isVoid = propertyTypeAnnotation.returnTypeAnnotation.type === 'VoidTypeAnnotation'; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js index fe919e910cef..076e1a92b974 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleH.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -43,10 +43,10 @@ const FileTemplate = ({ modules: string, }>) => { return `/** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleH.js */ @@ -138,11 +138,10 @@ module.exports = { const traversedProperties = properties .map(prop => { - const [ - propTypeAnnotation, - ] = unwrapNullable( - prop.typeAnnotation, - ); + const [propTypeAnnotation] = + unwrapNullable( + prop.typeAnnotation, + ); const traversedArgs = propTypeAnnotation.params .map(param => { const translatedParam = translatePrimitiveJSTypeToCpp( diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js index e5d5ecb141b1..e6b63f725a22 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJavaSpec.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -37,14 +37,14 @@ function FileTemplate( const {packageName, className, methods, imports} = config; return ` /** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleJavaSpec.js * - * @nolint + * ${'@'}nolint */ package ${packageName}; @@ -100,10 +100,8 @@ function translateFunctionParamToJavaType( imports: Set, ): string { const {optional, typeAnnotation: nullableTypeAnnotation} = param; - const [ - typeAnnotation, - nullable, - ] = unwrapNullable(nullableTypeAnnotation); + const [typeAnnotation, nullable] = + unwrapNullable(nullableTypeAnnotation); const isRequired = !optional && !nullable; function wrapIntoNullableIfNeeded(generatedType: string) { @@ -169,12 +167,10 @@ function translateFunctionReturnTypeToJavaType( resolveAlias: AliasResolver, imports: Set, ): string { - const [ - returnTypeAnnotation, - nullable, - ] = unwrapNullable( - nullableReturnTypeAnnotation, - ); + const [returnTypeAnnotation, nullable] = + unwrapNullable( + nullableReturnTypeAnnotation, + ); function wrapIntoNullableIfNeeded(generatedType: string) { if (nullable) { @@ -234,12 +230,10 @@ function getFalsyReturnStatementFromReturnType( createErrorMessage: (typeName: string) => string, resolveAlias: AliasResolver, ): string { - const [ - returnTypeAnnotation, - nullable, - ] = unwrapNullable( - nullableReturnTypeAnnotation, - ); + const [returnTypeAnnotation, nullable] = + unwrapNullable( + nullableReturnTypeAnnotation, + ); let realTypeAnnotation = returnTypeAnnotation; if (realTypeAnnotation.type === 'TypeAliasTypeAnnotation') { @@ -288,9 +282,8 @@ function buildGetConstantsMethod( method: NativeModulePropertyShape, imports: Set, ): string { - const [ - methodTypeAnnotation, - ] = unwrapNullable(method.typeAnnotation); + const [methodTypeAnnotation] = + unwrapNullable(method.typeAnnotation); if ( methodTypeAnnotation.returnTypeAnnotation.type === 'ObjectTypeAnnotation' ) { @@ -405,11 +398,10 @@ module.exports = { return buildGetConstantsMethod(method, imports); } - const [ - methodTypeAnnotation, - ] = unwrapNullable( - method.typeAnnotation, - ); + const [methodTypeAnnotation] = + unwrapNullable( + method.typeAnnotation, + ); // Handle return type const translatedReturnType = translateFunctionReturnTypeToJavaType( diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js index 60b7274b7868..a000849647d5 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniCpp.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -99,10 +99,10 @@ const FileTemplate = ({ }>) => { return ` /** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleJniCpp.js */ @@ -184,10 +184,8 @@ function translateParamTypeToJniType( resolveAlias: AliasResolver, ): string { const {optional, typeAnnotation: nullableTypeAnnotation} = param; - const [ - typeAnnotation, - nullable, - ] = unwrapNullable(nullableTypeAnnotation); + const [typeAnnotation, nullable] = + unwrapNullable(nullableTypeAnnotation); const isRequired = !optional && !nullable; let realTypeAnnotation = typeAnnotation; @@ -291,9 +289,8 @@ function translateMethodTypeToJniSignature( resolveAlias: AliasResolver, ): string { const {name, typeAnnotation} = property; - let [ - {returnTypeAnnotation, params}, - ] = unwrapNullable(typeAnnotation); + let [{returnTypeAnnotation, params}] = + unwrapNullable(typeAnnotation); params = [...params]; let processedReturnTypeAnnotation = returnTypeAnnotation; @@ -330,11 +327,8 @@ function translateMethodForImplementation( property: NativeModulePropertyShape, resolveAlias: AliasResolver, ): string { - const [ - propertyTypeAnnotation, - ] = unwrapNullable( - property.typeAnnotation, - ); + const [propertyTypeAnnotation] = + unwrapNullable(property.typeAnnotation); const {returnTypeAnnotation} = propertyTypeAnnotation; if ( @@ -395,11 +389,10 @@ module.exports = { hasteModuleName, methods: properties .map(({name: propertyName, typeAnnotation}) => { - const [ - {returnTypeAnnotation, params}, - ] = unwrapNullable( - typeAnnotation, - ); + const [{returnTypeAnnotation, params}] = + unwrapNullable( + typeAnnotation, + ); if ( propertyName === 'getConstants' && diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js index a893fea829f1..9713650c97e3 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleJniH.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -35,10 +35,10 @@ const HeaderFileTemplate = ({ }: $ReadOnly<{modules: string, libraryName: string}>) => { return ` /** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleJniH.js */ @@ -63,7 +63,7 @@ std::shared_ptr ${libraryName}_ModuleProvider(const std::string mod // Note: this Android.mk template includes dependencies for both NativeModule and components. const AndroidMkTemplate = ({libraryName}: $ReadOnly<{libraryName: string}>) => { - return `# Copyright (c) Facebook, Inc. and its affiliates. + return `# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -77,15 +77,16 @@ LOCAL_MODULE := react_codegen_${libraryName} LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/${libraryName}/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/${libraryName} -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\ -DLOG_TAG=\\"ReactNative\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) `; @@ -121,7 +122,7 @@ module.exports = { [ 'jni/Android.mk', AndroidMkTemplate({ - libraryName: `${libraryName.toLowerCase()}`, + libraryName: libraryName, }), ], ]); diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js index e92bcb66eb3d..725809dfdf65 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/StructCollector.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/Utils.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/Utils.js index ffbfea1b8cc7..59121a4b52fa 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/Utils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js index d11a5a8c23d8..a9685f7ac118 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeConstantsStruct.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -188,7 +188,7 @@ function toObjCValue( depth + 1, ); - const RCTConvertVecToArray = transformer => { + const RCTConvertVecToArray = (transformer: string) => { return `RCTConvert${ !isRequired ? 'Optional' : '' }VecToArray(${value}, ${transformer})`; diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js index fdcb2ab31066..66b08d826528 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeRegularStruct.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js index 170ac77c8fe8..d5b38f45357a 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/header/serializeStruct.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js index 59a2ca93501e..cd1aa762bbd2 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,7 @@ */ 'use strict'; +import type {NativeModulePropertyShape} from '../../../CodegenSchema'; import type {SchemaType} from '../../../CodegenSchema'; import type {MethodSerializationOutput} from './serializeMethod'; @@ -58,10 +59,10 @@ const HeaderFileTemplate = ({ assumeNonnull: boolean, }>) => `/** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleObjCpp * @@ -98,10 +99,10 @@ const SourceFileTemplate = ({ headerFileName: string, moduleImplementations: string, }>) => `/** - * ${'C'}opyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * ${'@'}generated by codegen project: GenerateModuleObjCpp * @@ -142,7 +143,7 @@ module.exports = { const structCollector = new StructCollector(); const methodSerializations: Array = []; - const serializeProperty = property => { + const serializeProperty = (property: NativeModulePropertyShape) => { methodSerializations.push( ...serializeMethod( hasteModuleName, diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js index 6f5c742a346b..bb258919c6bc 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/serializeMethod.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js index 14796e88a65d..2d9eb34d2564 100644 --- a/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js +++ b/packages/react-native-codegen/src/generators/modules/GenerateModuleObjCpp/source/serializeModule.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/Utils.js b/packages/react-native-codegen/src/generators/modules/Utils.js index 10017bb420bb..b89df46a01f8 100644 --- a/packages/react-native-codegen/src/generators/modules/Utils.js +++ b/packages/react-native-codegen/src/generators/modules/Utils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js index eb1f8ddd6f1e..c7090ef89531 100644 --- a/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/generators/modules/__test_fixtures__/fixtures.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -1459,11 +1459,25 @@ const REAL_MODULE_EXAMPLE: SchemaType = { }, }; +const SAMPLE_WITH_UPPERCASE_NAME: SchemaType = { + modules: { + NativeSampleTurboModule: { + type: 'NativeModule', + aliases: {}, + spec: { + properties: [], + }, + moduleNames: ['SampleTurboModule'], + }, + }, +}; + module.exports = { - COMPLEX_OBJECTS, - TWO_MODULES_DIFFERENT_FILES, - EMPTY_NATIVE_MODULES, - SIMPLE_NATIVE_MODULES, - NATIVE_MODULES_WITH_TYPE_ALIASES, - REAL_MODULE_EXAMPLE, + complex_objects: COMPLEX_OBJECTS, + two_modules_different_files: TWO_MODULES_DIFFERENT_FILES, + empty_native_modules: EMPTY_NATIVE_MODULES, + simple_native_modules: SIMPLE_NATIVE_MODULES, + native_modules_with_type_aliases: NATIVE_MODULES_WITH_TYPE_ALIASES, + real_module_example: REAL_MODULE_EXAMPLE, + SampleWithUppercaseName: SAMPLE_WITH_UPPERCASE_NAME, }; diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleCpp-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleCpp-test.js index a03ef0508b78..dfef8d4cdb8c 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleCpp-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js index 3acbc7f638f9..43c2ccf080ed 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleH-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js index e73d46fa5e9a..0d7431c05285 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleHObjCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js index 854d21388c18..53cbac6ba70b 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJavaSpec-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js index 0dfc249f7145..59f2568c770d 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniCpp-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniH-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniH-test.js index 4e9e116b9619..3321f9f68b2e 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniH-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleJniH-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js index c1a4feb400ad..bb4428292c53 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js +++ b/packages/react-native-codegen/src/generators/modules/__tests__/GenerateModuleMm-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap index 4b0e7d22201d..dadb4aafb906 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleCpp-test.js.snap @@ -1,17 +1,47 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleCpp can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleCpp can generate fixture SampleWithUppercaseName 1`] = ` Map { "NativeModules.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ -#include +#include + +namespace facebook { +namespace react { + + + +NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr jsInvoker) + : TurboModule(\\"SampleTurboModule\\", jsInvoker) { + +} + + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateModuleCpp can generate fixture complex_objects 1`] = ` +Map { + "NativeModules.cpp" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#include namespace facebook { namespace react { @@ -47,18 +77,18 @@ NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared } `; -exports[`GenerateModuleCpp can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleCpp can generate fixture empty_native_modules 1`] = ` Map { "NativeModules.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ -#include +#include namespace facebook { namespace react { @@ -77,18 +107,18 @@ NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared } `; -exports[`GenerateModuleCpp can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleCpp can generate fixture native_modules_with_type_aliases 1`] = ` Map { "NativeModules.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ -#include +#include namespace facebook { namespace react { @@ -114,18 +144,18 @@ AliasTurboModuleCxxSpecJSI::AliasTurboModuleCxxSpecJSI(std::shared_ptr "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ -#include +#include namespace facebook { namespace react { @@ -196,18 +226,18 @@ NativeExceptionsManagerCxxSpecJSI::NativeExceptionsManagerCxxSpecJSI(std::shared } `; -exports[`GenerateModuleCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleCpp can generate fixture simple_native_modules 1`] = ` Map { "NativeModules.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ -#include +#include namespace facebook { namespace react { @@ -270,18 +300,18 @@ NativeSampleTurboModuleCxxSpecJSI::NativeSampleTurboModuleCxxSpecJSI(std::shared } `; -exports[`GenerateModuleCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleCpp can generate fixture two_modules_different_files 1`] = ` Map { "NativeModules.cpp" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ -#include +#include namespace facebook { namespace react { diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap index 318f5c85f43e..b07d89987497 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleH-test.js.snap @@ -1,12 +1,44 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleH can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleH can generate fixture SampleWithUppercaseName 1`] = ` Map { "NativeModules.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleH.js + */ + +#pragma once + +#include + +namespace facebook { +namespace react { +class JSI_EXPORT NativeSampleTurboModuleCxxSpecJSI : public TurboModule { +protected: + NativeSampleTurboModuleCxxSpecJSI(std::shared_ptr jsInvoker); + +public: + + +}; + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateModuleH can generate fixture complex_objects 1`] = ` +Map { + "NativeModules.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ @@ -35,13 +67,13 @@ virtual void getArrays(jsi::Runtime &rt, const jsi::Object &options) = 0; } `; -exports[`GenerateModuleH can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleH can generate fixture empty_native_modules 1`] = ` Map { "NativeModules.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ @@ -67,13 +99,13 @@ public: } `; -exports[`GenerateModuleH can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleH can generate fixture native_modules_with_type_aliases 1`] = ` Map { "NativeModules.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ @@ -100,13 +132,13 @@ virtual void cropImage(jsi::Runtime &rt, const jsi::Object &cropData) = 0; } `; -exports[`GenerateModuleH can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleH can generate fixture real_module_example 1`] = ` Map { "NativeModules.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ @@ -155,13 +187,13 @@ virtual void dismissRedbox(jsi::Runtime &rt) = 0; } `; -exports[`GenerateModuleH can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleH can generate fixture simple_native_modules 1`] = ` Map { "NativeModules.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ @@ -197,13 +229,13 @@ virtual jsi::Value getValueWithPromise(jsi::Runtime &rt, bool error) = 0; } `; -exports[`GenerateModuleH can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleH can generate fixture two_modules_different_files 1`] = ` Map { "NativeModules.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleH.js */ diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap index 232d40e7dc11..0a4751b99bd8 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleHObjCpp-test.js.snap @@ -1,12 +1,63 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleHObjCpp can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleHObjCpp can generate fixture SampleWithUppercaseName 1`] = ` Map { - "COMPLEX_OBJECTS.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "SampleWithUppercaseName.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#ifndef __cplusplus +#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. +#endif +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + + +@protocol NativeSampleTurboModuleSpec + + + +@end +namespace facebook { + namespace react { + /** + * ObjC++ class for module 'NativeSampleTurboModule' + */ + class JSI_EXPORT NativeSampleTurboModuleSpecJSI : public ObjCTurboModule { + public: + NativeSampleTurboModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms); + }; + } // namespace react +} // namespace facebook + +", +} +`; + +exports[`GenerateModuleHObjCpp can generate fixture complex_objects 1`] = ` +Map { + "complex_objects.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -258,13 +309,13 @@ inline facebook::react::LazyVector "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "empty_native_modules.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -309,13 +360,13 @@ namespace facebook { } `; -exports[`GenerateModuleHObjCpp can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleHObjCpp can generate fixture native_modules_with_type_aliases 1`] = ` Map { - "NATIVE_MODULES_WITH_TYPE_ALIASES.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "native_modules_with_type_aliases.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -480,13 +531,13 @@ inline folly::Optional JS::AliasTurboModule::Options::allowExternalStorage } `; -exports[`GenerateModuleHObjCpp can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleHObjCpp can generate fixture real_module_example 1`] = ` Map { - "REAL_MODULE_EXAMPLE.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "real_module_example.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -770,13 +821,13 @@ inline bool JS::NativeImagePickerIOS::SpecOpenCameraDialogConfig::videoMode() co } `; -exports[`GenerateModuleHObjCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleHObjCpp can generate fixture simple_native_modules 1`] = ` Map { - "SIMPLE_NATIVE_MODULES.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "simple_native_modules.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -876,13 +927,13 @@ inline JS::NativeSampleTurboModule::Constants::Builder::Builder(Constants i) : _ } `; -exports[`GenerateModuleHObjCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleHObjCpp can generate fixture two_modules_different_files 1`] = ` Map { - "TWO_MODULES_DIFFERENT_FILES.h" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "two_modules_different_files.h" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap index f7654f6e4c3f..f6d505050f16 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJavaSpec-test.js.snap @@ -1,13 +1,47 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleJavaSpec can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleJavaSpec can generate fixture SampleWithUppercaseName 1`] = ` Map { "java/com/facebook/fbreact/specs/NativeSampleTurboModuleSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJavaSpec.js + * + * @nolint + */ + +package com.facebook.fbreact.specs; + +import com.facebook.proguard.annotations.DoNotStrip; +import com.facebook.react.bridge.ReactApplicationContext; +import com.facebook.react.bridge.ReactContextBaseJavaModule; +import com.facebook.react.bridge.ReactMethod; +import com.facebook.react.bridge.ReactModuleWithSpec; +import com.facebook.react.turbomodule.core.interfaces.TurboModule; + +public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaModule implements ReactModuleWithSpec, TurboModule { + public NativeSampleTurboModuleSpec(ReactApplicationContext reactContext) { + super(reactContext); + } + + +} +", +} +`; + +exports[`GenerateModuleJavaSpec can generate fixture complex_objects 1`] = ` +Map { + "java/com/facebook/fbreact/specs/NativeSampleTurboModuleSpec.java" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -52,14 +86,14 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo } `; -exports[`GenerateModuleJavaSpec can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleJavaSpec can generate fixture empty_native_modules 1`] = ` Map { "java/com/facebook/fbreact/specs/NativeSampleTurboModuleSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -86,14 +120,14 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo } `; -exports[`GenerateModuleJavaSpec can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleJavaSpec can generate fixture native_modules_with_type_aliases 1`] = ` Map { "java/com/facebook/fbreact/specs/AliasTurboModuleSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -123,14 +157,14 @@ public abstract class AliasTurboModuleSpec extends ReactContextBaseJavaModule im } `; -exports[`GenerateModuleJavaSpec can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleJavaSpec can generate fixture real_module_example 1`] = ` Map { "java/com/facebook/fbreact/specs/NativeCameraRollManagerSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -169,10 +203,10 @@ public abstract class NativeCameraRollManagerSpec extends ReactContextBaseJavaMo ", "java/com/facebook/fbreact/specs/NativeExceptionsManagerSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -219,14 +253,14 @@ public abstract class NativeExceptionsManagerSpec extends ReactContextBaseJavaMo } `; -exports[`GenerateModuleJavaSpec can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleJavaSpec can generate fixture simple_native_modules 1`] = ` Map { "java/com/facebook/fbreact/specs/NativeSampleTurboModuleSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -331,14 +365,14 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo } `; -exports[`GenerateModuleJavaSpec can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleJavaSpec can generate fixture two_modules_different_files 1`] = ` Map { "java/com/facebook/fbreact/specs/NativeSampleTurboModuleSpec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * @@ -366,10 +400,10 @@ public abstract class NativeSampleTurboModuleSpec extends ReactContextBaseJavaMo ", "java/com/facebook/fbreact/specs/NativeSampleTurboModule2Spec.java" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJavaSpec.js * diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap index 328f1a34779a..bcec9b13ef82 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniCpp-test.js.snap @@ -1,18 +1,55 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleJniCpp can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleJniCpp can generate fixture SampleWithUppercaseName 1`] = ` Map { - "jni/COMPLEX_OBJECTS-generated.cpp" => " + "jni/SampleWithUppercaseName-generated.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ -#include \\"COMPLEX_OBJECTS.h\\" +#include \\"SampleWithUppercaseName.h\\" + +namespace facebook { +namespace react { + + + +NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms) + : JavaTurboModule(params) { + +} + +std::shared_ptr SampleWithUppercaseName_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { + if (moduleName == \\"SampleTurboModule\\") { + return std::make_shared(params); + } + return nullptr; +} + +} // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateModuleJniCpp can generate fixture complex_objects 1`] = ` +Map { + "jni/complex_objects-generated.cpp" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniCpp.js + */ + +#include \\"complex_objects.h\\" namespace facebook { namespace react { @@ -41,7 +78,7 @@ NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboMo methodMap_[\\"getArrays\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getArrays}; } -std::shared_ptr COMPLEX_OBJECTS_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr complex_objects_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\\") { return std::make_shared(params); } @@ -54,19 +91,19 @@ std::shared_ptr COMPLEX_OBJECTS_ModuleProvider(const std::string mo } `; -exports[`GenerateModuleJniCpp can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleJniCpp can generate fixture empty_native_modules 1`] = ` Map { - "jni/EMPTY_NATIVE_MODULES-generated.cpp" => " + "jni/empty_native_modules-generated.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ -#include \\"EMPTY_NATIVE_MODULES.h\\" +#include \\"empty_native_modules.h\\" namespace facebook { namespace react { @@ -78,7 +115,7 @@ NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboMo } -std::shared_ptr EMPTY_NATIVE_MODULES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr empty_native_modules_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\\") { return std::make_shared(params); } @@ -91,19 +128,19 @@ std::shared_ptr EMPTY_NATIVE_MODULES_ModuleProvider(const std::stri } `; -exports[`GenerateModuleJniCpp can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleJniCpp can generate fixture native_modules_with_type_aliases 1`] = ` Map { - "jni/NATIVE_MODULES_WITH_TYPE_ALIASES-generated.cpp" => " + "jni/native_modules_with_type_aliases-generated.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ -#include \\"NATIVE_MODULES_WITH_TYPE_ALIASES.h\\" +#include \\"native_modules_with_type_aliases.h\\" namespace facebook { namespace react { @@ -119,7 +156,7 @@ AliasTurboModuleSpecJSI::AliasTurboModuleSpecJSI(const JavaTurboModule::InitPara methodMap_[\\"cropImage\\"] = MethodMetadata {1, __hostFunction_AliasTurboModuleSpecJSI_cropImage}; } -std::shared_ptr NATIVE_MODULES_WITH_TYPE_ALIASES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr native_modules_with_type_aliases_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"AliasTurboModule\\") { return std::make_shared(params); } @@ -132,19 +169,19 @@ std::shared_ptr NATIVE_MODULES_WITH_TYPE_ALIASES_ModuleProvider(con } `; -exports[`GenerateModuleJniCpp can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleJniCpp can generate fixture real_module_example 1`] = ` Map { - "jni/REAL_MODULE_EXAMPLE-generated.cpp" => " + "jni/real_module_example-generated.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ -#include \\"REAL_MODULE_EXAMPLE.h\\" +#include \\"real_module_example.h\\" namespace facebook { namespace react { @@ -198,7 +235,7 @@ NativeExceptionsManagerSpecJSI::NativeExceptionsManagerSpecJSI(const JavaTurboMo methodMap_[\\"dismissRedbox\\"] = MethodMetadata {0, __hostFunction_NativeExceptionsManagerSpecJSI_dismissRedbox}; } -std::shared_ptr REAL_MODULE_EXAMPLE_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr real_module_example_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"CameraRollManager\\") { return std::make_shared(params); } @@ -214,19 +251,19 @@ std::shared_ptr REAL_MODULE_EXAMPLE_ModuleProvider(const std::strin } `; -exports[`GenerateModuleJniCpp can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleJniCpp can generate fixture simple_native_modules 1`] = ` Map { - "jni/SIMPLE_NATIVE_MODULES-generated.cpp" => " + "jni/simple_native_modules-generated.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ -#include \\"SIMPLE_NATIVE_MODULES.h\\" +#include \\"simple_native_modules.h\\" namespace facebook { namespace react { @@ -290,7 +327,7 @@ NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const JavaTurboMo methodMap_[\\"getValueWithPromise\\"] = MethodMetadata {1, __hostFunction_NativeSampleTurboModuleSpecJSI_getValueWithPromise}; } -std::shared_ptr SIMPLE_NATIVE_MODULES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr simple_native_modules_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\\") { return std::make_shared(params); } @@ -303,19 +340,19 @@ std::shared_ptr SIMPLE_NATIVE_MODULES_ModuleProvider(const std::str } `; -exports[`GenerateModuleJniCpp can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleJniCpp can generate fixture two_modules_different_files 1`] = ` Map { - "jni/TWO_MODULES_DIFFERENT_FILES-generated.cpp" => " + "jni/two_modules_different_files-generated.cpp" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniCpp.js */ -#include \\"TWO_MODULES_DIFFERENT_FILES.h\\" +#include \\"two_modules_different_files.h\\" namespace facebook { namespace react { @@ -339,7 +376,7 @@ NativeSampleTurboModule2SpecJSI::NativeSampleTurboModule2SpecJSI(const JavaTurbo methodMap_[\\"voidFunc\\"] = MethodMetadata {0, __hostFunction_NativeSampleTurboModule2SpecJSI_voidFunc}; } -std::shared_ptr TWO_MODULES_DIFFERENT_FILES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { +std::shared_ptr two_modules_different_files_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms) { if (moduleName == \\"SampleTurboModule\\") { return std::make_shared(params); } diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap index 5f68533849b1..77135639f4c7 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleJniH-test.js.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleJniH can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleJniH can generate fixture SampleWithUppercaseName 1`] = ` Map { - "jni/COMPLEX_OBJECTS.h" => " + "jni/SampleWithUppercaseName.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniH.js */ @@ -30,12 +30,77 @@ public: }; -std::shared_ptr COMPLEX_OBJECTS_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr SampleWithUppercaseName_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace react } // namespace facebook ", - "jni/Android.mk" => "# Copyright (c) Facebook, Inc. and its affiliates. + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := react_codegen_SampleWithUppercaseName + +LOCAL_C_INCLUDES := $(LOCAL_PATH) + +LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/SampleWithUppercaseName/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) + +LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/SampleWithUppercaseName + +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug + +LOCAL_CFLAGS := \\\\ + -DLOG_TAG=\\\\\\"ReactNative\\\\\\" + +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall + +include $(BUILD_SHARED_LIBRARY) +", +} +`; + +exports[`GenerateModuleJniH can generate fixture complex_objects 1`] = ` +Map { + "jni/complex_objects.h" => " +/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleJniH.js + */ + +#pragma once + +#include +#include +#include + +namespace facebook { +namespace react { + +/** + * JNI C++ class for module 'NativeSampleTurboModule' + */ +class JSI_EXPORT NativeSampleTurboModuleSpecJSI : public JavaTurboModule { +public: + NativeSampleTurboModuleSpecJSI(const JavaTurboModule::InitParams ¶ms); +}; + + +std::shared_ptr complex_objects_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); + +} // namespace react +} // namespace facebook +", + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -49,29 +114,30 @@ LOCAL_MODULE := react_codegen_complex_objects LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/complex_objects/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/complex_objects -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\\\ -DLOG_TAG=\\\\\\"ReactNative\\\\\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) ", } `; -exports[`GenerateModuleJniH can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleJniH can generate fixture empty_native_modules 1`] = ` Map { - "jni/EMPTY_NATIVE_MODULES.h" => " + "jni/empty_native_modules.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniH.js */ @@ -94,12 +160,12 @@ public: }; -std::shared_ptr EMPTY_NATIVE_MODULES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr empty_native_modules_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace react } // namespace facebook ", - "jni/Android.mk" => "# Copyright (c) Facebook, Inc. and its affiliates. + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -113,29 +179,30 @@ LOCAL_MODULE := react_codegen_empty_native_modules LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/empty_native_modules/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/empty_native_modules -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\\\ -DLOG_TAG=\\\\\\"ReactNative\\\\\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) ", } `; -exports[`GenerateModuleJniH can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleJniH can generate fixture native_modules_with_type_aliases 1`] = ` Map { - "jni/NATIVE_MODULES_WITH_TYPE_ALIASES.h" => " + "jni/native_modules_with_type_aliases.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniH.js */ @@ -158,12 +225,12 @@ public: }; -std::shared_ptr NATIVE_MODULES_WITH_TYPE_ALIASES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr native_modules_with_type_aliases_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace react } // namespace facebook ", - "jni/Android.mk" => "# Copyright (c) Facebook, Inc. and its affiliates. + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -177,29 +244,30 @@ LOCAL_MODULE := react_codegen_native_modules_with_type_aliases LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/native_modules_with_type_aliases/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/native_modules_with_type_aliases -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\\\ -DLOG_TAG=\\\\\\"ReactNative\\\\\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) ", } `; -exports[`GenerateModuleJniH can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleJniH can generate fixture real_module_example 1`] = ` Map { - "jni/REAL_MODULE_EXAMPLE.h" => " + "jni/real_module_example.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniH.js */ @@ -230,12 +298,12 @@ public: }; -std::shared_ptr REAL_MODULE_EXAMPLE_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr real_module_example_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace react } // namespace facebook ", - "jni/Android.mk" => "# Copyright (c) Facebook, Inc. and its affiliates. + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -249,29 +317,30 @@ LOCAL_MODULE := react_codegen_real_module_example LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/real_module_example/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/real_module_example -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\\\ -DLOG_TAG=\\\\\\"ReactNative\\\\\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) ", } `; -exports[`GenerateModuleJniH can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleJniH can generate fixture simple_native_modules 1`] = ` Map { - "jni/SIMPLE_NATIVE_MODULES.h" => " + "jni/simple_native_modules.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniH.js */ @@ -294,12 +363,12 @@ public: }; -std::shared_ptr SIMPLE_NATIVE_MODULES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr simple_native_modules_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace react } // namespace facebook ", - "jni/Android.mk" => "# Copyright (c) Facebook, Inc. and its affiliates. + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -313,29 +382,30 @@ LOCAL_MODULE := react_codegen_simple_native_modules LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/simple_native_modules/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/simple_native_modules -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\\\ -DLOG_TAG=\\\\\\"ReactNative\\\\\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) ", } `; -exports[`GenerateModuleJniH can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleJniH can generate fixture two_modules_different_files 1`] = ` Map { - "jni/TWO_MODULES_DIFFERENT_FILES.h" => " + "jni/two_modules_different_files.h" => " /** - * Copyright (c) Facebook, Inc. and its affiliates. + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleJniH.js */ @@ -366,12 +436,12 @@ public: }; -std::shared_ptr TWO_MODULES_DIFFERENT_FILES_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); +std::shared_ptr two_modules_different_files_ModuleProvider(const std::string moduleName, const JavaTurboModule::InitParams ¶ms); } // namespace react } // namespace facebook ", - "jni/Android.mk" => "# Copyright (c) Facebook, Inc. and its affiliates. + "jni/Android.mk" => "# Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. @@ -385,15 +455,16 @@ LOCAL_MODULE := react_codegen_two_modules_different_files LOCAL_C_INCLUDES := $(LOCAL_PATH) LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp) $(wildcard $(LOCAL_PATH)/react/renderer/components/two_modules_different_files/*.cpp) +LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(LOCAL_SRC_FILES)) LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/react/renderer/components/two_modules_different_files -LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libreact_debug libreact_render_debug +LOCAL_SHARED_LIBRARIES := libjsi libglog libfolly_json libyoga libreact_nativemodule_core librrc_view libreact_render_core libreact_render_graphics libfbjni libturbomodulejsijni libreact_codegen_rncore libreact_debug libreact_render_debug LOCAL_CFLAGS := \\\\ -DLOG_TAG=\\\\\\"ReactNative\\\\\\" -LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall +LOCAL_CFLAGS += -fexceptions -frtti -std=c++17 -Wall include $(BUILD_SHARED_LIBRARY) ", diff --git a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap index 3053a5fee6ac..6e9a1acec387 100644 --- a/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap +++ b/packages/react-native-codegen/src/generators/modules/__tests__/__snapshots__/GenerateModuleMm-test.js.snap @@ -1,12 +1,12 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`GenerateModuleMm can generate fixture COMPLEX_OBJECTS 1`] = ` +exports[`GenerateModuleMm can generate fixture SampleWithUppercaseName 1`] = ` Map { - "COMPLEX_OBJECTS-generated.mm" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "SampleWithUppercaseName-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -15,7 +15,39 @@ Map { * must have a single output. More files => more genrule()s => slower builds. */ -#import \\"COMPLEX_OBJECTS.h\\" +#import \\"SampleWithUppercaseName.h\\" + + +namespace facebook { + namespace react { + + + NativeSampleTurboModuleSpecJSI::NativeSampleTurboModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms) + : ObjCTurboModule(params) { + + } + } // namespace react +} // namespace facebook +", +} +`; + +exports[`GenerateModuleMm can generate fixture complex_objects 1`] = ` +Map { + "complex_objects-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). + * + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. + * + * @generated by codegen project: GenerateModuleObjCpp + * + * We create an umbrella header (and corresponding implementation) here since + * Cxx compilation in BUCK has a limitation: source-code producing genrule()s + * must have a single output. More files => more genrule()s => slower builds. + */ + +#import \\"complex_objects.h\\" @implementation RCTCxxConvert (NativeSampleTurboModule_SpecDifficultAE) + (RCTManagedPointer *)JS_NativeSampleTurboModule_SpecDifficultAE:(id)json @@ -93,13 +125,13 @@ namespace facebook { } `; -exports[`GenerateModuleMm can generate fixture EMPTY_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleMm can generate fixture empty_native_modules 1`] = ` Map { - "EMPTY_NATIVE_MODULES-generated.mm" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "empty_native_modules-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -108,7 +140,7 @@ Map { * must have a single output. More files => more genrule()s => slower builds. */ -#import \\"EMPTY_NATIVE_MODULES.h\\" +#import \\"empty_native_modules.h\\" namespace facebook { @@ -125,13 +157,13 @@ namespace facebook { } `; -exports[`GenerateModuleMm can generate fixture NATIVE_MODULES_WITH_TYPE_ALIASES 1`] = ` +exports[`GenerateModuleMm can generate fixture native_modules_with_type_aliases 1`] = ` Map { - "NATIVE_MODULES_WITH_TYPE_ALIASES-generated.mm" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "native_modules_with_type_aliases-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -140,7 +172,7 @@ Map { * must have a single output. More files => more genrule()s => slower builds. */ -#import \\"NATIVE_MODULES_WITH_TYPE_ALIASES.h\\" +#import \\"native_modules_with_type_aliases.h\\" @implementation RCTCxxConvert (AliasTurboModule_OptionsOffset) + (RCTManagedPointer *)JS_AliasTurboModule_OptionsOffset:(id)json @@ -185,13 +217,13 @@ namespace facebook { } `; -exports[`GenerateModuleMm can generate fixture REAL_MODULE_EXAMPLE 1`] = ` +exports[`GenerateModuleMm can generate fixture real_module_example 1`] = ` Map { - "REAL_MODULE_EXAMPLE-generated.mm" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "real_module_example-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -200,7 +232,7 @@ Map { * must have a single output. More files => more genrule()s => slower builds. */ -#import \\"REAL_MODULE_EXAMPLE.h\\" +#import \\"real_module_example.h\\" @implementation RCTCxxConvert (NativeCameraRollManager_GetPhotosParams) + (RCTManagedPointer *)JS_NativeCameraRollManager_GetPhotosParams:(id)json @@ -317,13 +349,13 @@ namespace facebook { } `; -exports[`GenerateModuleMm can generate fixture SIMPLE_NATIVE_MODULES 1`] = ` +exports[`GenerateModuleMm can generate fixture simple_native_modules 1`] = ` Map { - "SIMPLE_NATIVE_MODULES-generated.mm" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "simple_native_modules-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -332,7 +364,7 @@ Map { * must have a single output. More files => more genrule()s => slower builds. */ -#import \\"SIMPLE_NATIVE_MODULES.h\\" +#import \\"simple_native_modules.h\\" namespace facebook { @@ -424,13 +456,13 @@ namespace facebook { } `; -exports[`GenerateModuleMm can generate fixture TWO_MODULES_DIFFERENT_FILES 1`] = ` +exports[`GenerateModuleMm can generate fixture two_modules_different_files 1`] = ` Map { - "TWO_MODULES_DIFFERENT_FILES-generated.mm" => "/** - * Copyright (c) Facebook, Inc. and its affiliates. + "two_modules_different_files-generated.mm" => "/** + * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * Do not edit this file as changes may cause incorrect behavior and will be lost + * once the code is regenerated. * * @generated by codegen project: GenerateModuleObjCpp * @@ -439,7 +471,7 @@ Map { * must have a single output. More files => more genrule()s => slower builds. */ -#import \\"TWO_MODULES_DIFFERENT_FILES.h\\" +#import \\"two_modules_different_files.h\\" namespace facebook { diff --git a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js index b5a8f8a127cc..957c96791037 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/failures.js @@ -1,18 +1,19 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format + * @lint-ignore-every LICENSELINT */ 'use strict'; const COMMANDS_DEFINED_INLINE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -48,7 +49,7 @@ export default (codegenNativeComponent( const COMMANDS_DEFINED_MULTIPLE_TIMES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -89,7 +90,7 @@ export default (codegenNativeComponent( const COMMANDS_DEFINED_WITHOUT_REF = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -127,7 +128,7 @@ export default (codegenNativeComponent( const COMMANDS_DEFINED_WITH_NULLABLE_REF = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -165,7 +166,7 @@ export default (codegenNativeComponent( const COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -208,7 +209,7 @@ export default (codegenNativeComponent( const COMMANDS_DEFINED_WITHOUT_METHOD_NAMES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -249,7 +250,7 @@ export default (codegenNativeComponent( const NULLABLE_WITH_DEFAULT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -278,7 +279,7 @@ export default (codegenNativeComponent( const NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -307,7 +308,7 @@ export default (codegenNativeComponent( const PROPS_CONFLICT_NAMES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -337,7 +338,7 @@ export default (codegenNativeComponent( const PROPS_CONFLICT_WITH_SPREAD_PROPS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -371,7 +372,7 @@ export default (codegenNativeComponent( const PROPS_SPREAD_CONFLICTS_WITH_PROPS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -405,7 +406,7 @@ export default (codegenNativeComponent( const PROP_NUMBER_TYPE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -434,7 +435,7 @@ export default (codegenNativeComponent( const PROP_MIXED_ENUM = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -463,7 +464,7 @@ export default (codegenNativeComponent( const PROP_ENUM_BOOLEAN = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -492,7 +493,7 @@ export default (codegenNativeComponent( const PROP_ARRAY_MIXED_ENUM = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -521,7 +522,7 @@ export default (codegenNativeComponent( const PROP_ARRAY_ENUM_BOOLEAN = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -550,7 +551,7 @@ export default (codegenNativeComponent( const PROP_ARRAY_ENUM_INT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js index ef77f69d3127..6868574c90d6 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__test_fixtures__/fixtures.js @@ -1,11 +1,12 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format + * @lint-ignore-every LICENSELINT */ 'use strict'; @@ -86,7 +87,7 @@ const EVENT_DEFINITION = ` const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -126,7 +127,7 @@ export default (codegenNativeComponent('Module', { const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -167,7 +168,7 @@ export default codegenNativeComponent('Module', { const NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -194,7 +195,7 @@ export default (codegenNativeComponent('Module', { const ALL_PROP_TYPES_NO_EVENTS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -318,7 +319,7 @@ export default (codegenNativeComponent( const ARRAY_PROP_TYPES_NO_EVENTS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -471,7 +472,7 @@ export default (codegenNativeComponent( const OBJECT_PROP_TYPES_NO_EVENTS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -563,7 +564,7 @@ export default (codegenNativeComponent( const PROPS_ALIASED_LOCALLY = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -608,7 +609,7 @@ export default (codegenNativeComponent( const EVENTS_DEFINED_INLINE_WITH_ALL_TYPES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -717,7 +718,7 @@ export default (codegenNativeComponent( const EVENTS_DEFINED_AS_NULL_INLINE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -766,7 +767,7 @@ export default (codegenNativeComponent( const PROPS_AND_EVENTS_TYPES_EXPORTED = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -809,7 +810,7 @@ export default (codegenNativeComponent( const PROPS_AS_EXTERNAL_TYPES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -839,7 +840,7 @@ export default (codegenNativeComponent( const COMMANDS_DEFINED_WITH_ALL_TYPES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -889,7 +890,7 @@ export default (codegenNativeComponent( const COMMANDS_WITH_EXTERNAL_TYPES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -939,7 +940,7 @@ export default (codegenNativeComponent( const COMMANDS_AND_EVENTS_TYPES_EXPORTED = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap b/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap index 48836ae86894..5f52a06d5438 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap +++ b/packages/react-native-codegen/src/parsers/flow/components/__tests__/__snapshots__/component-parser-test.js.snap @@ -16,7 +16,7 @@ exports[`RN Codegen Flow Parser Fails with error message NON_OPTIONAL_KEY_WITH_D exports[`RN Codegen Flow Parser Fails with error message NULLABLE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the ? annotation in front of it."`; -exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", recieved \\"BooleanLiteralTypeAnnotation\\""`; +exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteralTypeAnnotation\\""`; exports[`RN Codegen Flow Parser Fails with error message PROP_ARRAY_ENUM_INT 1`] = `"Arrays of int enums are not supported (see: \\"someProp\\")"`; diff --git a/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js b/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js index 9c93fe7f7c85..8c5a3c3457a8 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js +++ b/packages/react-native-codegen/src/parsers/flow/components/__tests__/component-parser-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/components/commands.js b/packages/react-native-codegen/src/parsers/flow/components/commands.js index c967645211f6..163b5feb5e67 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/commands.js +++ b/packages/react-native-codegen/src/parsers/flow/components/commands.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -20,7 +20,7 @@ const {getValueFromTypes} = require('../utils.js'); type EventTypeAST = Object; -function buildCommandSchema(property, types: TypeDeclarationMap) { +function buildCommandSchema(property: EventTypeAST, types: TypeDeclarationMap) { const name = property.key.name; const optional = property.optional; const value = getValueFromTypes(property.value, types); diff --git a/packages/react-native-codegen/src/parsers/flow/components/events.js b/packages/react-native-codegen/src/parsers/flow/components/events.js index b950f8245590..acb98d0c8890 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/events.js +++ b/packages/react-native-codegen/src/parsers/flow/components/events.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -191,11 +191,8 @@ function buildEventSchema( return null; } - const { - argumentProps, - bubblingType, - paperTopLevelNameDeprecated, - } = findEventArgumentsAndType(typeAnnotation, types); + const {argumentProps, bubblingType, paperTopLevelNameDeprecated} = + findEventArgumentsAndType(typeAnnotation, types); if (bubblingType && argumentProps) { if (paperTopLevelNameDeprecated != null) { @@ -237,7 +234,7 @@ type EventTypeAST = Object; type TypeMap = { // $FlowFixMe[unclear-type] there's no flowtype for ASTs [string]: Object, - ..., + ... }; function getEvents( diff --git a/packages/react-native-codegen/src/parsers/flow/components/extends.js b/packages/react-native-codegen/src/parsers/flow/components/extends.js index 890329400a62..5cd021512f1d 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/extends.js +++ b/packages/react-native-codegen/src/parsers/flow/components/extends.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/components/index.js b/packages/react-native-codegen/src/parsers/flow/components/index.js index 34b8233c07e5..feb34a24a3c1 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/index.js +++ b/packages/react-native-codegen/src/parsers/flow/components/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,6 +9,8 @@ */ 'use strict'; +import type {CommandOptions} from './options'; +import type {TypeDeclarationMap} from '../utils'; import type {ComponentSchemaBuilderConfig} from './schema.js'; const {getCommands} = require('./commands'); @@ -119,7 +121,11 @@ function findComponentConfig(ast) { }; } -function getCommandProperties(commandTypeName, types, commandOptions) { +function getCommandProperties( + commandTypeName, + types: TypeDeclarationMap, + commandOptions: ?CommandOptions, +) { if (commandTypeName == null) { return []; } diff --git a/packages/react-native-codegen/src/parsers/flow/components/options.js b/packages/react-native-codegen/src/parsers/flow/components/options.js index 8a137c5cd7c9..beb032eae320 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/options.js +++ b/packages/react-native-codegen/src/parsers/flow/components/options.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/components/props.js b/packages/react-native-codegen/src/parsers/flow/components/props.js index 536606f1a1d9..24e08b4493e6 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/props.js +++ b/packages/react-native-codegen/src/parsers/flow/components/props.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,7 +29,12 @@ function getPropProperties( } } -function getTypeAnnotationForArray(name, typeAnnotation, defaultValue, types) { +function getTypeAnnotationForArray( + name: string, + typeAnnotation: $FlowFixMe, + defaultValue: $FlowFixMe | null, + types: TypeDeclarationMap, +) { const extractedTypeAnnotation = getValueFromTypes(typeAnnotation, types); if (extractedTypeAnnotation.type === 'NullableTypeAnnotation') { throw new Error( @@ -161,7 +166,7 @@ function getTypeAnnotationForArray(name, typeAnnotation, defaultValue, types) { ); } else { throw new Error( - `Unsupported union type for "${name}", recieved "${unionType}"`, + `Unsupported union type for "${name}", received "${unionType}"`, ); } default: @@ -171,11 +176,11 @@ function getTypeAnnotationForArray(name, typeAnnotation, defaultValue, types) { } function getTypeAnnotation( - name, + name: string, annotation, - defaultValue, - withNullDefault, - types, + defaultValue: $FlowFixMe | null, + withNullDefault: boolean, + types: TypeDeclarationMap, ) { const typeAnnotation = getValueFromTypes(annotation, types); @@ -325,7 +330,7 @@ function getTypeAnnotation( } function buildPropSchema( - property, + property: PropAST, types: TypeDeclarationMap, ): ?NamedShape { const name = property.key.name; diff --git a/packages/react-native-codegen/src/parsers/flow/components/schema.js b/packages/react-native-codegen/src/parsers/flow/components/schema.js index 21ce46d6856e..ed6223c3347b 100644 --- a/packages/react-native-codegen/src/parsers/flow/components/schema.js +++ b/packages/react-native-codegen/src/parsers/flow/components/schema.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/errors.js b/packages/react-native-codegen/src/parsers/flow/errors.js index b480f321f592..41fc7f8ca4ee 100644 --- a/packages/react-native-codegen/src/parsers/flow/errors.js +++ b/packages/react-native-codegen/src/parsers/flow/errors.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/index.js b/packages/react-native-codegen/src/parsers/flow/index.js index b7550b07a772..516025223e76 100644 --- a/packages/react-native-codegen/src/parsers/flow/index.js +++ b/packages/react-native-codegen/src/parsers/flow/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js index be76b9039dec..a226b9c0a36a 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js @@ -1,18 +1,19 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format + * @lint-ignore-every LICENSELINT */ 'use strict'; const NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +37,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -60,7 +61,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULES_WITH_READ_ONLY_OBJECT_NO_TYPE_FOR_CONTENT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -84,7 +85,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULES_WITH_NOT_ONLY_METHODS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -112,7 +113,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULES_WITH_UNNAMED_PARAMS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -137,7 +138,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULES_WITH_PROMISE_WITHOUT_TYPE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -162,7 +163,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -184,7 +185,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule2'); const TWO_NATIVE_EXTENDING_TURBO_MODULE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js index e05e185232ca..658ece57caf5 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/fixtures.js @@ -1,18 +1,19 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow strict-local * @format + * @lint-ignore-every LICENSELINT */ 'use strict'; const EMPTY_NATIVE_MODULE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -36,7 +37,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_COMPLEX_OBJECTS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -71,7 +72,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -101,13 +102,13 @@ export interface Spec extends TurboModule { |}; } -export default TurboModuleRegistry.getEnforcing('PlatformConstants'); +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); `; const NATIVE_MODULE_WITH_BASIC_PARAM_TYPES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -134,7 +135,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_ALIASES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -175,7 +176,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_NESTED_ALIASES = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -210,7 +211,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_FLOAT_AND_INT32 = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -235,7 +236,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_SIMPLE_OBJECT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -259,7 +260,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_UNSAFE_OBJECT = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -284,7 +285,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_ROOT_TAG = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -308,7 +309,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_NULLABLE_PARAM = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -333,7 +334,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_BASIC_ARRAY = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -358,7 +359,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -395,7 +396,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -419,7 +420,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -445,7 +446,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_COMPLEX_ARRAY = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -467,8 +468,9 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); `; -const NATIVE_MODULE_WITH_PROMISE = `/** - * Copyright (c) Facebook, Inc. and its affiliates. +const NATIVE_MODULE_WITH_PROMISE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -497,7 +499,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const NATIVE_MODULE_WITH_CALLBACK = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -524,7 +526,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); const ANDROID_ONLY_NATIVE_MODULE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -548,7 +550,7 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModuleAndroid' const IOS_ONLY_NATIVE_MODULE = ` /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap index b17885a171e6..e73dce43e09b 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-snapshot-test.js.snap @@ -884,7 +884,7 @@ exports[`RN Codegen Flow Parser can generate fixture NATIVE_MODULE_WITH_COMPLEX_ ] }, 'moduleNames': [ - 'PlatformConstants' + 'SampleTurboModule' ] } } diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js index ef3354df45f3..2601d945f748 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-e2e-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -155,10 +155,8 @@ describe('Flow Module Parser', () => { expect(param).not.toBe(null); expect(param.name).toBe(paramName); expect(param.optional).toBe(optional); - const [ - paramTypeAnnotation, - isParamTypeAnnotationNullable, - ] = unwrapNullable(param.typeAnnotation); + const [paramTypeAnnotation, isParamTypeAnnotationNullable] = + unwrapNullable(param.typeAnnotation); expect(isParamTypeAnnotationNullable).toBe(nullable); return [paramTypeAnnotation, module]; @@ -232,12 +230,10 @@ describe('Flow Module Parser', () => { expect(paramTypeAnnotation.elementType).not.toBe(null); invariant(paramTypeAnnotation.elementType != null, ''); - const [ - elementType, - isElementTypeNullable, - ] = unwrapNullable( - paramTypeAnnotation.elementType, - ); + const [elementType, isElementTypeNullable] = + unwrapNullable( + paramTypeAnnotation.elementType, + ); expect(isElementTypeNullable).toBe(false); return [elementType, module]; } @@ -371,10 +367,8 @@ describe('Flow Module Parser', () => { expect(param.optional).toBe(optional); // The TypeAliasAnnotation is called Animal, and is nullable - const [ - paramTypeAnnotation, - isParamTypeAnnotationNullable, - ] = unwrapNullable(param.typeAnnotation); + const [paramTypeAnnotation, isParamTypeAnnotationNullable] = + unwrapNullable(param.typeAnnotation); expect(paramTypeAnnotation.type).toBe('TypeAliasTypeAnnotation'); invariant( paramTypeAnnotation.type === 'TypeAliasTypeAnnotation', @@ -446,10 +440,8 @@ describe('Flow Module Parser', () => { expect(properties[0].name).toBe(propName); expect(properties[0].optional).toBe(isPropOptional); - const [ - propertyTypeAnnotation, - isPropertyTypeAnnotationNullable, - ] = unwrapNullable(properties[0].typeAnnotation); + const [propertyTypeAnnotation, isPropertyTypeAnnotationNullable] = + unwrapNullable(properties[0].typeAnnotation); expect(propertyTypeAnnotation).not.toBe(null); expect(isPropertyTypeAnnotationNullable).toBe(isPropNullable); @@ -537,18 +529,15 @@ describe('Flow Module Parser', () => { '', ); - const { - elementType: nullableElementType, - } = property.typeAnnotation; + const {elementType: nullableElementType} = + property.typeAnnotation; expect(nullableElementType).not.toBe(null); invariant(nullableElementType != null, ''); - const [ - elementType, - isElementTypeNullable, - ] = unwrapNullable( - nullableElementType, - ); + const [elementType, isElementTypeNullable] = + unwrapNullable( + nullableElementType, + ); expect(isElementTypeNullable).toBe(false); @@ -709,16 +698,12 @@ describe('Flow Module Parser', () => { expect(module.spec.properties[0]).not.toBe(null); - const [ - functionTypeAnnotation, - isFunctionTypeAnnotationNullable, - ] = unwrapNullable(module.spec.properties[0].typeAnnotation); + const [functionTypeAnnotation, isFunctionTypeAnnotationNullable] = + unwrapNullable(module.spec.properties[0].typeAnnotation); expect(isFunctionTypeAnnotationNullable).toBe(false); - const [ - returnTypeAnnotation, - isReturnTypeAnnotationNullable, - ] = unwrapNullable(functionTypeAnnotation.returnTypeAnnotation); + const [returnTypeAnnotation, isReturnTypeAnnotationNullable] = + unwrapNullable(functionTypeAnnotation.returnTypeAnnotation); expect(returnTypeAnnotation.type).toBe('VoidTypeAnnotation'); expect(isReturnTypeAnnotationNullable).toBe(false); }); @@ -746,16 +731,12 @@ describe('Flow Module Parser', () => { `); expect(module.spec.properties[0]).not.toBe(null); - const [ - functionTypeAnnotation, - isFunctionTypeAnnotationNullable, - ] = unwrapNullable(module.spec.properties[0].typeAnnotation); + const [functionTypeAnnotation, isFunctionTypeAnnotationNullable] = + unwrapNullable(module.spec.properties[0].typeAnnotation); expect(isFunctionTypeAnnotationNullable).toBe(false); - const [ - returnTypeAnnotation, - isReturnTypeAnnotationNullable, - ] = unwrapNullable(functionTypeAnnotation.returnTypeAnnotation); + const [returnTypeAnnotation, isReturnTypeAnnotationNullable] = + unwrapNullable(functionTypeAnnotation.returnTypeAnnotation); expect(isReturnTypeAnnotationNullable).toBe(IS_RETURN_TYPE_NULLABLE); return [returnTypeAnnotation, module]; @@ -823,10 +804,8 @@ describe('Flow Module Parser', () => { expect(elementType).not.toBe(null); invariant(elementType != null, ''); - const [ - elementTypeAnnotation, - isElementTypeAnnotation, - ] = unwrapNullable(elementType); + const [elementTypeAnnotation, isElementTypeAnnotation] = + unwrapNullable(elementType); expect(isElementTypeAnnotation).toBe(false); return [elementTypeAnnotation, module]; @@ -837,9 +816,8 @@ describe('Flow Module Parser', () => { describe('Primitive Element Types', () => { PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array<${FLOW_TYPE}>'`, () => { - const [elementType, module] = parseArrayElementReturnType( - FLOW_TYPE, - ); + const [elementType, module] = + parseArrayElementReturnType(FLOW_TYPE); expect(elementType.type).toBe(PARSED_TYPE_NAME); }); }); @@ -863,9 +841,8 @@ describe('Flow Module Parser', () => { }); it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of some array of an alias`, () => { - const [elementType, module] = parseArrayElementReturnType( - 'Animal', - ); + const [elementType, module] = + parseArrayElementReturnType('Animal'); expect(elementType.type).toBe('TypeAliasTypeAnnotation'); invariant(elementType.type === 'TypeAliasTypeAnnotation', ''); expect(elementType.name).toBe('Animal'); @@ -873,9 +850,8 @@ describe('Flow Module Parser', () => { }); it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array<{foo: ?string}>'`, () => { - const [elementType] = parseArrayElementReturnType( - '{foo: ?string}', - ); + const [elementType] = + parseArrayElementReturnType('{foo: ?string}'); expect(elementType.type).toBe('ObjectTypeAnnotation'); invariant(elementType.type === 'ObjectTypeAnnotation', ''); @@ -887,10 +863,8 @@ describe('Flow Module Parser', () => { expect(properties[0].name).toBe('foo'); expect(properties[0].typeAnnotation).not.toBe(null); - const [ - propertyTypeAnnotation, - isPropertyTypeAnnotationNullable, - ] = unwrapNullable(properties[0].typeAnnotation); + const [propertyTypeAnnotation, isPropertyTypeAnnotationNullable] = + unwrapNullable(properties[0].typeAnnotation); expect(propertyTypeAnnotation.type).toBe('StringTypeAnnotation'); expect(isPropertyTypeAnnotationNullable).toBe(true); @@ -1084,13 +1058,11 @@ describe('Flow Module Parser', () => { propName: string, arrayElementType: string, ): [NativeModuleBaseTypeAnnotation, NativeModuleSchema] { - const [ - property, - module, - ] = parseObjectLiteralReturnTypeProp( - propName, - `Array<${arrayElementType}>`, - ); + const [property, module] = + parseObjectLiteralReturnTypeProp( + propName, + `Array<${arrayElementType}>`, + ); expect(property.name).toBe(propName); expect(property.typeAnnotation.type).toBe( 'ArrayTypeAnnotation', @@ -1100,18 +1072,15 @@ describe('Flow Module Parser', () => { '', ); - const { - elementType: nullableElementType, - } = property.typeAnnotation; + const {elementType: nullableElementType} = + property.typeAnnotation; expect(nullableElementType).not.toBe(null); invariant(nullableElementType != null, ''); - const [ - elementType, - isElementTypeNullable, - ] = unwrapNullable( - nullableElementType, - ); + const [elementType, isElementTypeNullable] = + unwrapNullable( + nullableElementType, + ); expect(isElementTypeNullable).toBe(false); return [elementType, module]; diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js index cd32e108ef37..103c80e8c1e0 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/module-parser-snapshot-test.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/modules/errors.js b/packages/react-native-codegen/src/parsers/flow/modules/errors.js index 370262cfcb74..c8bb4253885e 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/errors.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/errors.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -41,7 +41,7 @@ class MoreThanOneModuleFlowInterfaceParserError extends ParserError { ) { const finalName = names[names.length - 1]; const allButLastName = names.slice(0, -1); - const quote = x => `'${x}'`; + const quote = (x: string) => `'${x}'`; const nameStr = allButLastName.map(quote).join(', ') + ', and ' + quote(finalName); diff --git a/packages/react-native-codegen/src/parsers/flow/modules/index.js b/packages/react-native-codegen/src/parsers/flow/modules/index.js index ffbb50af3987..3601cde043f8 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/index.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -71,11 +71,8 @@ function translateTypeAnnotation( aliasMap: {...NativeModuleAliasMap}, tryParse: ParserErrorCapturer, ): Nullable { - const { - nullable, - typeAnnotation, - typeAliasResolutionStatus, - } = resolveTypeAnnotation(flowTypeAnnotation, types); + const {nullable, typeAnnotation, typeAliasResolutionStatus} = + resolveTypeAnnotation(flowTypeAnnotation, types); switch (typeAnnotation.type) { case 'GenericTypeAnnotation': { @@ -234,18 +231,16 @@ function translateTypeAnnotation( const {optional, key} = property; - const [ - propertyTypeAnnotation, - isPropertyNullable, - ] = unwrapNullable( - translateTypeAnnotation( - hasteModuleName, - property.value, - types, - aliasMap, - tryParse, - ), - ); + const [propertyTypeAnnotation, isPropertyNullable] = + unwrapNullable( + translateTypeAnnotation( + hasteModuleName, + property.value, + types, + aliasMap, + tryParse, + ), + ); if (propertyTypeAnnotation.type === 'FunctionTypeAnnotation') { throw new UnsupportedObjectPropertyValueTypeAnnotationParserError( @@ -417,18 +412,16 @@ function translateFunctionTypeAnnotation( } const paramName = flowParam.name.name; - const [ - paramTypeAnnotation, - isParamTypeAnnotationNullable, - ] = unwrapNullable( - translateTypeAnnotation( - hasteModuleName, - flowParam.typeAnnotation, - types, - aliasMap, - tryParse, - ), - ); + const [paramTypeAnnotation, isParamTypeAnnotationNullable] = + unwrapNullable( + translateTypeAnnotation( + hasteModuleName, + flowParam.typeAnnotation, + types, + aliasMap, + tryParse, + ), + ); if (paramTypeAnnotation.type === 'VoidTypeAnnotation') { throw new UnsupportedFunctionParamTypeAnnotationParserError( diff --git a/packages/react-native-codegen/src/parsers/flow/modules/schema.js b/packages/react-native-codegen/src/parsers/flow/modules/schema.js index da3da6a49476..4e3fda6bea4a 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/schema.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/schema.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/modules/utils.js b/packages/react-native-codegen/src/parsers/flow/modules/utils.js index 8b8aa0b0648d..b013f76c8ce5 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/utils.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/utils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/flow/utils.js b/packages/react-native-codegen/src/parsers/flow/utils.js index 70d4536a12ef..86547dc9b855 100644 --- a/packages/react-native-codegen/src/parsers/flow/utils.js +++ b/packages/react-native-codegen/src/parsers/flow/utils.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -197,6 +197,11 @@ function isModuleRegistryCall(node: $FlowFixMe): boolean { ) { return false; } + + if (memberExpression.computed) { + return false; + } + return true; } diff --git a/packages/react-native-codegen/src/parsers/schema/index.js b/packages/react-native-codegen/src/parsers/schema/index.js index bf736a725fa0..646aa86fcee8 100644 --- a/packages/react-native-codegen/src/parsers/schema/index.js +++ b/packages/react-native-codegen/src/parsers/schema/index.js @@ -1,5 +1,5 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js new file mode 100644 index 000000000000..521117eacc00 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/failures.js @@ -0,0 +1,504 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @lint-ignore-every LICENSELINT + */ + +'use strict'; + +const COMMANDS_DEFINED_INLINE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + // No props +} + +export const Commands = codegenNativeCommands<{ + readonly hotspotUpdate: ( + ref: React.Ref<'RCTView'>, + x: Int32, + y: Int32, + ) => void; +}>({ + supportedCommands: ['hotspotUpdate'], +}); + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const COMMANDS_DEFINED_MULTIPLE_TIMES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +interface NativeCommands { + readonly hotspotUpdate: ( + viewRef: React.Ref<'RCTView'>, + x: Int32, + y: Int32, + ) => void; +} + +export interface ModuleProps extends ViewProps { + // No props or events +} + +export const Commands = codegenNativeCommands({ + supportedCommands: ['hotspotUpdate'], +}); +export const Commands2 = codegenNativeCommands({ + supportedCommands: ['hotspotUpdate'], +}); + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const COMMANDS_DEFINED_WITHOUT_REF = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +interface NativeCommands { + readonly hotspotUpdate: (x: Int32, y: Int32) => void; +} + +export interface ModuleProps extends ViewProps { + // No props or events +} + +export const Commands = codegenNativeCommands({ + supportedCommands: ['hotspotUpdate'], +}); + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const COMMANDS_DEFINED_WITH_NULLABLE_REF = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +interface NativeCommands { + readonly hotspotUpdate: (viewRef: React.Ref<'RCTView'> | null | void, x: Int32, y: Int32) => void; +} + +export interface ModuleProps extends ViewProps { + // No props or events +} + +export const Commands = codegenNativeCommands({ + supportedCommands: ['hotspotUpdate'], +}); + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +interface NativeCommands { + readonly hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; + readonly scrollTo: ( + viewRef: React.Ref<'RCTView'>, + y: Int32, + animated: boolean, + ) => void; +} + +export interface ModuleProps extends ViewProps { + // No props or events +} + +export const Commands = codegenNativeCommands({ + supportedCommands: ['scrollTo'], +}); +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const COMMANDS_DEFINED_WITHOUT_METHOD_NAMES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +interface NativeCommands { + readonly hotspotUpdate: (viewRef: React.Ref<'RCTView'>, x: Int32, y: Int32) => void; + readonly scrollTo: ( + viewRef: React.Ref<'RCTView'>, + y: Int32, + animated: boolean, + ) => void; +} + +export interface ModuleProps extends ViewProps { + // No props or events +} + +export const Commands = codegenNativeCommands(); + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const NULLABLE_WITH_DEFAULT = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {WithDefault, Float} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + nullable_with_default: WithDefault | null | void; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {WithDefault, Float} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + required_key_with_default: WithDefault; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROPS_CONFLICT_NAMES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + isEnabled: string, + + isEnabled: boolean, +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROPS_CONFLICT_WITH_SPREAD_PROPS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +type PropsInFile = Readonly<{ + isEnabled: boolean, +}>; + +export interface ModuleProps extends ViewProps, PropsInFile { + isEnabled: boolean, +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROP_NUMBER_TYPE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + someProp: number +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROP_MIXED_ENUM = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; +import type {WithDefault} from 'CodegenTypes'; + +export interface ModuleProps extends ViewProps { + someProp?: WithDefault<'foo' | 1, 1>; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROP_ENUM_BOOLEAN = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; +import type {WithDefault} from 'CodegenTypes'; + +export interface ModuleProps extends ViewProps { + someProp?: WithDefault +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROP_ARRAY_MIXED_ENUM = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; +import type {WithDefault} from 'CodegenTypes'; + +export interface ModuleProps extends ViewProps { + someProp?: WithDefault, 1>; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROP_ARRAY_ENUM_BOOLEAN = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; +import type {WithDefault} from 'CodegenTypes'; + +export interface ModuleProps extends ViewProps { + someProp?: WithDefault, false>; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROP_ARRAY_ENUM_INT = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; +import type {WithDefault} from 'CodegenTypes'; + +export interface ModuleProps extends ViewProps { + someProp?: WithDefault, 0>; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +module.exports = { + COMMANDS_DEFINED_INLINE, + COMMANDS_DEFINED_MULTIPLE_TIMES, + COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES, + COMMANDS_DEFINED_WITHOUT_METHOD_NAMES, + COMMANDS_DEFINED_WITHOUT_REF, + COMMANDS_DEFINED_WITH_NULLABLE_REF, + NULLABLE_WITH_DEFAULT, + NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE, + PROPS_CONFLICT_NAMES, + PROPS_CONFLICT_WITH_SPREAD_PROPS, + PROP_NUMBER_TYPE, + PROP_MIXED_ENUM, + PROP_ENUM_BOOLEAN, + PROP_ARRAY_MIXED_ENUM, + PROP_ARRAY_ENUM_BOOLEAN, + PROP_ARRAY_ENUM_INT, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js new file mode 100644 index 000000000000..da8e9ae8eb3e --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js @@ -0,0 +1,973 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @lint-ignore-every LICENSELINT + */ + +'use strict'; + +const EVENT_DEFINITION = ` + boolean_required: boolean; + boolean_optional_key?: boolean; + boolean_optional_value: boolean | null | void; + boolean_optional_both?: boolean | null | void; + + string_required: string; + string_optional_key?: string; + string_optional_value: string | null | void; + string_optional_both?: string | null | void; + + double_required: Double; + double_optional_key?: Double; + double_optional_value: Double | null | void; + double_optional_both?: Double | null | void; + + float_required: Float; + float_optional_key?: Float; + float_optional_value: Float | null | void; + float_optional_both?: Float | null | void; + + int32_required: Int32; + int32_optional_key?: Int32; + int32_optional_value: Int32 | null | void; + int32_optional_both?: Int32 | null | void; + + enum_required: 'small' | 'large'; + enum_optional_key?: 'small' | 'large'; + enum_optional_value: ('small' | 'large') | null | void; + enum_optional_both?: ('small' | 'large') | null | void; + + object_required: { + boolean_required: boolean; + }; + + object_optional_key?: { + string_optional_key?: string; + }; + + object_optional_value: { + float_optional_value: Float | null | void; + } | null | void; + + object_optional_both?: { + int32_optional_both?: Int32 | null | void; + } | null | void; + + object_required_nested_2_layers: { + object_optional_nested_1_layer?: { + boolean_required: Int32; + string_optional_key?: string; + double_optional_value: Double | null | void; + float_optional_value: Float | null | void; + int32_optional_both?: Int32 | null | void; + } | null | void; + }; + + object_readonly_required: Readonly<{ + boolean_required: boolean; + }>; + + object_readonly_optional_key?: Readonly<{ + string_optional_key?: string; + }>; + + object_readonly_optional_value: Readonly<{ + float_optional_value: Float | null | void; + }> | null | void; + + object_readonly_optional_both?: Readonly<{ + int32_optional_both?: Int32 | null | void; + }> | null | void; +`; + +const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +'use strict'; + +import type { + BubblingEventHandler, + DirectEventHandler, + WithDefault, +} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +export interface ModuleProps extends ViewProps { + // Props + boolean_default_true_optional_both?: WithDefault; + + // Events + onDirectEventDefinedInlineNull: DirectEventHandler; + onBubblingEventDefinedInlineNull: BubblingEventHandler; +} + +export default codegenNativeComponent('Module', { + interfaceOnly: true, + paperComponentName: 'RCTModule', +}) as HostComponent; +`; + +const ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type { + BubblingEventHandler, + DirectEventHandler, + WithDefault, +} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + // Props + boolean_default_true_optional_both?: WithDefault; + + // Events + onDirectEventDefinedInlineNull: DirectEventHandler; + onBubblingEventDefinedInlineNull: BubblingEventHandler; +} + +export default codegenNativeComponent('Module', { + interfaceOnly: true, + excludedPlatforms: ['android'], + paperComponentName: 'RCTModule', +}) as HostComponent; +`; + +const NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + +} + +export default codegenNativeComponent('Module', { + deprecatedViewConfigName: 'DeprecateModuleName', +}) as HostComponent; +`; + +const ALL_PROP_TYPES_NO_EVENTS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +'use strict'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; +import type {ImageSource} from 'ImageSource'; +import type { + ColorValue, + ColorArrayValue, + PointValue, + EdgeInsetsValue, +} from 'StyleSheetTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + // Props + // Boolean props + boolean_required: boolean; + boolean_optional_key?: WithDefault; + boolean_optional_both?: WithDefault; + + // Boolean props, null default + boolean_null_optional_key?: WithDefault; + boolean_null_optional_both?: WithDefault; + + // String props + string_required: string; + string_optional_key?: WithDefault; + string_optional_both?: WithDefault; + + // String props, null default + string_null_optional_key?: WithDefault; + string_null_optional_both?: WithDefault; + + // Stringish props + stringish_required: Stringish; + stringish_optional_key?: WithDefault; + stringish_optional_both?: WithDefault; + + // Stringish props, null default + stringish_null_optional_key?: WithDefault; + stringish_null_optional_both?: WithDefault; + + // Double props + double_required: Double; + double_optional_key?: WithDefault; + double_optional_both?: WithDefault; + + // Float props + float_required: Float; + float_optional_key?: WithDefault; + float_optional_both?: WithDefault; + + // Float props, null default + float_null_optional_key?: WithDefault; + float_null_optional_both?: WithDefault; + + // Int32 props + int32_required: Int32; + int32_optional_key?: WithDefault; + int32_optional_both?: WithDefault; + + // String enum props + enum_optional_key?: WithDefault<'small' | 'large', 'small'>; + enum_optional_both?: WithDefault<'small' | 'large', 'small'>; + + // Int enum props + int_enum_optional_key?: WithDefault<0 | 1, 0>; + + // Object props + object_optional_key?: Readonly<{prop: string}>; + object_optional_both?: Readonly<{prop: string} | null | void>; + object_optional_value: Readonly<{prop: string} | null | void>; + + // ImageSource props + image_required: ImageSource; + image_optional_value: ImageSource | null | void; + image_optional_both?: ImageSource | null | void; + + // ColorValue props + color_required: ColorValue; + color_optional_key?: ColorValue; + color_optional_value: ColorValue | null | void; + color_optional_both?: ColorValue | null | void; + + // ColorArrayValue props + color_array_required: ColorArrayValue; + color_array_optional_key?: ColorArrayValue; + color_array_optional_value: ColorArrayValue | null | void; + color_array_optional_both?: ColorArrayValue | null | void; + + // ProcessedColorValue props + processed_color_required: ProcessedColorValue; + processed_color_optional_key?: ProcessedColorValue; + processed_color_optional_value: ProcessedColorValue | null | void; + processed_color_optional_both?: ProcessedColorValue | null | void; + + // PointValue props + point_required: PointValue; + point_optional_key?: PointValue; + point_optional_value: PointValue | null | void; + point_optional_both?: PointValue | null | void; + + // EdgeInsets props + insets_required: EdgeInsetsValue; + insets_optional_key?: EdgeInsetsValue; + insets_optional_value: EdgeInsetsValue | null | void; + insets_optional_both?: EdgeInsetsValue | null | void; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const ARRAY_PROP_TYPES_NO_EVENTS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +'use strict'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; +import type {ImageSource} from 'ImageSource'; +import type { + ColorValue, + ColorArrayValue, + PointValue, + EdgeInsetsValue, +} from 'StyleSheetTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +type ObjectType = Readonly<{prop: string}>; +type ArrayObjectType = ReadonlyArray>; + +export interface ModuleProps extends ViewProps { + // Props + // Boolean props + array_boolean_required: ReadonlyArray; + array_boolean_optional_key?: ReadonlyArray; + array_boolean_optional_value: ReadonlyArray | null | void; + array_boolean_optional_both?: ReadonlyArray | null | void; + + // String props + array_string_required: ReadonlyArray; + array_string_optional_key?: ReadonlyArray; + array_string_optional_value: ReadonlyArray | null | void; + array_string_optional_both?: ReadonlyArray | null | void; + + // Double props + array_double_required: ReadonlyArray; + array_double_optional_key?: ReadonlyArray; + array_double_optional_value: ReadonlyArray | null | void; + array_double_optional_both?: ReadonlyArray | null | void; + + // Float props + array_float_required: ReadonlyArray; + array_float_optional_key?: ReadonlyArray; + array_float_optional_value: ReadonlyArray | null | void; + array_float_optional_both?: ReadonlyArray | null | void; + + // Int32 props + array_int32_required: ReadonlyArray; + array_int32_optional_key?: ReadonlyArray; + array_int32_optional_value: ReadonlyArray | null | void; + array_int32_optional_both?: ReadonlyArray | null | void; + + // String enum props + array_enum_optional_key?: WithDefault< + ReadonlyArray<'small' | 'large'>, + 'small' + >; + array_enum_optional_both?: WithDefault< + ReadonlyArray<'small' | 'large'>, + 'small' + >; + + // ImageSource props + array_image_required: ReadonlyArray; + array_image_optional_key?: ReadonlyArray; + array_image_optional_value: ReadonlyArray | null | void; + array_image_optional_both?: ReadonlyArray | null | void; + + // ColorValue props + array_color_required: ReadonlyArray; + array_color_optional_key?: ReadonlyArray; + array_color_optional_value: ReadonlyArray | null | void; + array_color_optional_both?: ReadonlyArray | null | void; + + // PointValue props + array_point_required: ReadonlyArray; + array_point_optional_key?: ReadonlyArray; + array_point_optional_value: ReadonlyArray | null | void; + array_point_optional_both?: ReadonlyArray | null | void; + + // EdgeInsetsValue props + array_insets_required: ReadonlyArray; + array_insets_optional_key?: ReadonlyArray; + array_insets_optional_value: ReadonlyArray | null | void; + array_insets_optional_both?: ReadonlyArray | null | void; + + // Object props + array_object_required: ReadonlyArray>; + array_object_optional_key?: ReadonlyArray>; + array_object_optional_value: ArrayObjectType | null | void; + array_object_optional_both?: ReadonlyArray | null | void; + + // Nested array object types + array_of_array_object_required: ReadonlyArray< + Readonly<{ + // This needs to be the same name as the top level array above + array_object_required: ReadonlyArray>; + }> + >; + array_of_array_object_optional_key?: ReadonlyArray< + Readonly<{ + // This needs to be the same name as the top level array above + array_object_optional_key: ReadonlyArray>; + }> + >; + array_of_array_object_optional_value: ReadonlyArray< + Readonly<{ + // This needs to be the same name as the top level array above + array_object_optional_value: ReadonlyArray< + Readonly<{prop: string | null | void}> + >; + }> + > | null | void; + array_of_array_object_optional_both?: ReadonlyArray< + Readonly<{ + // This needs to be the same name as the top level array above + array_object_optional_both: ReadonlyArray< + Readonly<{prop?: string | null | void}> + >; + }> + > | null | void; + + // Nested array of array of object types + array_of_array_of_object_required: ReadonlyArray< + ReadonlyArray< + Readonly<{ + prop: string; + }> + > + >; + + // Nested array of array of object types (in file) + array_of_array_of_object_required_in_file: ReadonlyArray< + ReadonlyArray + >; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const OBJECT_PROP_TYPES_NO_EVENTS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +'use strict'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32, Double, Float, WithDefault} from 'CodegenTypes'; +import type {ImageSource} from 'ImageSource'; +import type { + ColorValue, + ColorArrayValue, + PointValue, + EdgeInsetsValue, +} from 'StyleSheetTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + // Props + // Boolean props + boolean_required: Readonly<{prop: boolean}>; + boolean_optional: Readonly<{prop?: WithDefault}>; + + // String props + string_required: Readonly<{prop: string}>; + string_optional: Readonly<{prop?: WithDefault}>; + + // Double props + double_required: Readonly<{prop: Double}>; + double_optional: Readonly<{prop?: WithDefault}>; + + // Float props + float_required: Readonly<{prop: Float}>; + float_optional: Readonly<{prop?: WithDefault}>; + + // Int32 props + int_required: Readonly<{prop: Int32}>; + int_optional: Readonly<{prop?: WithDefault}>; + + // String enum props + enum_optional: Readonly<{ + prop?: WithDefault, 'small'>; + }>; + + // ImageSource props + image_required: Readonly<{prop: ImageSource}>; + image_optional_key: Readonly<{prop?: ImageSource}>; + image_optional_value: Readonly<{prop: ImageSource | null | void}>; + image_optional_both: Readonly<{prop?: ImageSource | null | void}>; + + // ColorValue props + color_required: Readonly<{prop: ColorValue}>; + color_optional_key: Readonly<{prop?: ColorValue}>; + color_optional_value: Readonly<{prop: ColorValue | null | void}>; + color_optional_both: Readonly<{prop?: ColorValue | null | void}>; + + // ProcessedColorValue props + processed_color_required: Readonly<{prop: ProcessedColorValue}>; + processed_color_optional_key: Readonly<{prop?: ProcessedColorValue}>; + processed_color_optional_value: Readonly<{ + prop: ProcessedColorValue | null | void; + }>; + processed_color_optional_both: Readonly<{ + prop?: ProcessedColorValue | null | void; + }>; + + // PointValue props + point_required: Readonly<{prop: PointValue}>; + point_optional_key: Readonly<{prop?: PointValue}>; + point_optional_value: Readonly<{prop: PointValue | null | void}>; + point_optional_both: Readonly<{prop?: PointValue | null | void}>; + + // EdgeInsetsValue props + insets_required: Readonly<{prop: EdgeInsetsValue}>; + insets_optional_key: Readonly<{prop?: EdgeInsetsValue}>; + insets_optional_value: Readonly<{prop: EdgeInsetsValue | null | void}>; + insets_optional_both: Readonly<{prop?: EdgeInsetsValue | null | void}>; + + // Nested object props + object_required: Readonly<{prop: Readonly<{nestedProp: string}>}>; + object_optional_key?: Readonly<{prop: Readonly<{nestedProp: string}>}>; + object_optional_value: Readonly<{ + prop: Readonly<{nestedProp: string}>; + }> | null | void; + object_optional_both?: Readonly<{ + prop: Readonly<{nestedProp: string}>; + }> | null | void; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROPS_ALIASED_LOCALLY = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +'use strict'; + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +type DeepSpread = Readonly<{ + otherStringProp: string; +}>; + +export interface PropsInFile extends DeepSpread { + isEnabled: boolean; + label: string; +} + +type ReadOnlyPropsInFile = Readonly; + +export interface ModuleProps extends ViewProps, ReadOnlyPropsInFile { + localType: ReadOnlyPropsInFile; + localArr: ReadonlyArray; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const EVENTS_DEFINED_INLINE_WITH_ALL_TYPES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {HostComponent} from 'react-native'; +const codegenNativeComponent = require('codegenNativeComponent'); + +import type { + Int32, + Double, + Float, + BubblingEventHandler, + DirectEventHandler, +} from 'CodegenTypes'; + +import type {ViewProps} from 'ViewPropTypes'; + +export interface ModuleProps extends ViewProps { + // No Props + + // Events + onDirectEventDefinedInline: DirectEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + >; + + onDirectEventDefinedInlineOptionalKey?: DirectEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + >; + + onDirectEventDefinedInlineOptionalValue: DirectEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + > | null | void; + + onDirectEventDefinedInlineOptionalBoth?: DirectEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + > | null | void; + + onDirectEventDefinedInlineWithPaperName?: DirectEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }>, + 'paperDirectEventDefinedInlineWithPaperName' + > | null | void; + + onBubblingEventDefinedInline: BubblingEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + >; + + onBubblingEventDefinedInlineOptionalKey?: BubblingEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + >; + + onBubblingEventDefinedInlineOptionalValue: BubblingEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + > | null | void; + + onBubblingEventDefinedInlineOptionalBoth?: BubblingEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }> + > | null | void; + + onBubblingEventDefinedInlineWithPaperName?: BubblingEventHandler< + Readonly<{ + ${EVENT_DEFINITION} + }>, + 'paperBubblingEventDefinedInlineWithPaperName' + > | null | void; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const EVENTS_DEFINED_AS_NULL_INLINE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +'use strict'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {BubblingEventHandler, DirectEventHandler} from 'CodegenTypese'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export interface ModuleProps extends ViewProps { + // No props + + // Events defined inline + onDirectEventDefinedInlineNull: DirectEventHandler; + onDirectEventDefinedInlineNullOptionalKey?: DirectEventHandler; + onDirectEventDefinedInlineNullOptionalValue: DirectEventHandler | null | void; + onDirectEventDefinedInlineNullOptionalBoth?: DirectEventHandler; + onDirectEventDefinedInlineNullWithPaperName?: DirectEventHandler< + null, + 'paperDirectEventDefinedInlineNullWithPaperName' + > | null | void; + + onBubblingEventDefinedInlineNull: BubblingEventHandler; + onBubblingEventDefinedInlineNullOptionalKey?: BubblingEventHandler; + onBubblingEventDefinedInlineNullOptionalValue: BubblingEventHandler | null | void; + onBubblingEventDefinedInlineNullOptionalBoth?: BubblingEventHandler | null | void; + onBubblingEventDefinedInlineNullWithPaperName?: BubblingEventHandler< + null, + 'paperBubblingEventDefinedInlineNullWithPaperName' + > | null | void; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROPS_AND_EVENTS_TYPES_EXPORTED = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; +import type { + BubblingEventHandler, + DirectEventHandler, +} from 'CodegenTypes'; + +export type EventInFile = Readonly<{ + ${EVENT_DEFINITION} +}>; + +export interface ModuleProps extends ViewProps { + // No props + + // Events defined inline + onBubblingEventDefinedInline: BubblingEventHandler; + onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler< + EventInFile, + 'paperBubblingEventDefinedInlineWithPaperName' + >; + onDirectEventDefinedInline: DirectEventHandler; + onDirectEventDefinedInlineWithPaperName: DirectEventHandler< + EventInFile, + 'paperDirectEventDefinedInlineWithPaperName' + >; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const PROPS_AS_EXTERNAL_TYPES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {HostComponent} from 'react-native'; + +export type String = string; +export type AnotherArray = ReadonlyArray; + +export interface ModuleProps { + disable: String; + array: AnotherArray; +} + +export default codegenNativeComponent( + 'Module', +) as HostComponent; +`; + +const COMMANDS_DEFINED_WITH_ALL_TYPES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + + const codegenNativeCommands = require('codegenNativeCommands'); + const codegenNativeComponent = require('codegenNativeComponent'); + + import type {Int32, Double, Float} from 'CodegenTypes'; + import type {RootTag} from 'RCTExport'; + import type {ViewProps} from 'ViewPropTypes'; + import type {HostComponent} from 'react-native'; + + +export interface ModuleProps extends ViewProps { + // No props or events +} + +type NativeType = HostComponent; + + interface NativeCommands { + readonly handleRootTag: (viewRef: React.ElementRef, rootTag: RootTag) => void; + readonly hotspotUpdate: (viewRef: React.ElementRef, x: Int32, y: Int32) => void; + readonly scrollTo: ( + viewRef: React.ElementRef, + x: Float, + y: Int32, + z: Double, + animated: boolean, + ) => void; + } + + export const Commands = codegenNativeCommands({ + supportedCommands: ['handleRootTag', 'hotspotUpdate', 'scrollTo'], + }); + +export default codegenNativeComponent( + 'Module', +) as NativeType; +`; + +const COMMANDS_WITH_EXTERNAL_TYPES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +const codegenNativeCommands = require('codegenNativeCommands'); +const codegenNativeComponent = require('codegenNativeComponent'); + +import type {Int32} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +export type Boolean = boolean; +export type Int = Int32; +export type Void = void; + +export interface ModuleProps extends ViewProps { + // No props or events +} + +type NativeType = HostComponent; + +export type ScrollTo = ( + viewRef: React.ElementRef, + y: Int, + animated: Boolean, +) => Void; + +interface NativeCommands { + readonly scrollTo: ScrollTo; +} + +export const Commands = codegenNativeCommands({ + supportedCommands: ['scrollTo'], +}); + +export default codegenNativeComponent('Module') as NativeType; + +`; + +const COMMANDS_AND_EVENTS_TYPES_EXPORTED = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type { + BubblingEventHandler, + DirectEventHandler, +} from 'CodegenTypes'; +import type {ViewProps} from 'ViewPropTypes'; +import type {HostComponent} from 'react-native'; + +const codegenNativeComponent = require('codegenNativeComponent'); + +export type EventInFile = Readonly<{ + ${EVENT_DEFINITION} +}>; + +export type Boolean = boolean; +export type Int = Int32; +export type Void = void; + +export interface ModuleProps extends ViewProps { + // No props + + // Events defined inline + onBubblingEventDefinedInline: BubblingEventHandler, + onBubblingEventDefinedInlineWithPaperName: BubblingEventHandler, + onDirectEventDefinedInline: DirectEventHandler, + onDirectEventDefinedInlineWithPaperName: DirectEventHandler, +} + +type NativeType = HostComponent; + +export type ScrollTo = (viewRef: React.ElementRef, y: Int, animated: Boolean) => Void; + +interface NativeCommands { + readonly scrollTo: ScrollTo; +} + +export const Commands = codegenNativeCommands({ + supportedCommands: ['scrollTo'] +}); + +export default codegenNativeComponent( + 'Module', +) as NativeType; +`; + +module.exports = { + ALL_PROP_TYPES_NO_EVENTS, + ARRAY_PROP_TYPES_NO_EVENTS, + OBJECT_PROP_TYPES_NO_EVENTS, + PROPS_ALIASED_LOCALLY, + ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS, + ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST, + NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION, + EVENTS_DEFINED_INLINE_WITH_ALL_TYPES, + EVENTS_DEFINED_AS_NULL_INLINE, + PROPS_AND_EVENTS_TYPES_EXPORTED, + COMMANDS_AND_EVENTS_TYPES_EXPORTED, + COMMANDS_DEFINED_WITH_ALL_TYPES, + PROPS_AS_EXTERNAL_TYPES, + COMMANDS_WITH_EXTERNAL_TYPES, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap new file mode 100644 index 000000000000..bfaa95fdbf98 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap @@ -0,0 +1,9397 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_INLINE 1`] = `"codegenNativeCommands doesn't support inline definitions. Specify a file local type alias"`; + +exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_MULTIPLE_TIMES 1`] = `"codegenNativeCommands may only be called once in a file"`; + +exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_WITH_MISMATCHED_METHOD_NAMES 1`] = `"codegenNativeCommands expected the same supportedCommands specified in the NativeCommands interface: hotspotUpdate, scrollTo"`; + +exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_WITH_NULLABLE_REF 1`] = `"The first argument of method hotspotUpdate must be of type React.ElementRef<>"`; + +exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_WITHOUT_METHOD_NAMES 1`] = `"codegenNativeCommands must be passed options including the supported commands"`; + +exports[`RN Codegen TypeScript Parser Fails with error message COMMANDS_DEFINED_WITHOUT_REF 1`] = `"The first argument of method hotspotUpdate must be of type React.ElementRef<>"`; + +exports[`RN Codegen TypeScript Parser Fails with error message NON_OPTIONAL_KEY_WITH_DEFAULT_VALUE 1`] = `"key required_key_with_default must be optional if used with WithDefault<> annotation"`; + +exports[`RN Codegen TypeScript Parser Fails with error message NULLABLE_WITH_DEFAULT 1`] = `"WithDefault<> is optional and does not need to be marked as optional. Please remove the union of void and/or null"`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROP_ARRAY_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteral\\""`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROP_ARRAY_ENUM_INT 1`] = `"Arrays of int enums are not supported (see: \\"someProp\\")"`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROP_ARRAY_MIXED_ENUM 1`] = `"Mixed types are not supported (see \\"someProp\\")"`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROP_ENUM_BOOLEAN 1`] = `"Unsupported union type for \\"someProp\\", received \\"BooleanLiteral\\""`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROP_MIXED_ENUM 1`] = `"Mixed types are not supported (see \\"someProp\\")"`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROP_NUMBER_TYPE 1`] = `"Cannot use \\"TSNumberKeyword\\" type annotation for \\"someProp\\": must use a specific numeric type like Int32, Double, or Float"`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROPS_CONFLICT_NAMES 1`] = `"A prop was already defined with the name isEnabled"`; + +exports[`RN Codegen TypeScript Parser Fails with error message PROPS_CONFLICT_WITH_SPREAD_PROPS 1`] = `"A prop was already defined with the name isEnabled"`; + +exports[`RN Codegen TypeScript Parser can generate fixture ALL_PROP_TYPES_NO_EVENTS 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': false + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': true + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': true + } + }, + { + 'name': 'boolean_null_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': null + } + }, + { + 'name': 'boolean_null_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': null + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': '' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': '' + } + }, + { + 'name': 'string_null_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'string_null_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'stringish_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'stringish_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': '' + } + }, + { + 'name': 'stringish_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': '' + } + }, + { + 'name': 'stringish_null_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'stringish_null_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation', + 'default': 0 + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation', + 'default': 1.1 + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation', + 'default': 1.1 + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': 0 + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': 1.1 + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': 1.1 + } + }, + { + 'name': 'float_null_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': null + } + }, + { + 'name': 'float_null_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': null + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation', + 'default': 0 + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation', + 'default': 1 + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation', + 'default': 1 + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'int_enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32EnumTypeAnnotation', + 'default': 0, + 'options': [ + 0, + 1 + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + }, + { + 'name': 'image_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + }, + { + 'name': 'image_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + }, + { + 'name': 'image_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + }, + { + 'name': 'color_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'color_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'color_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'color_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'color_array_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'color_array_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'color_array_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'color_array_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'processed_color_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'processed_color_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'processed_color_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'processed_color_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + }, + { + 'name': 'point_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + }, + { + 'name': 'point_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + }, + { + 'name': 'point_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + }, + { + 'name': 'point_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + }, + { + 'name': 'insets_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + }, + { + 'name': 'insets_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + }, + { + 'name': 'insets_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + }, + { + 'name': 'insets_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + ], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture ARRAY_PROP_TYPES_NO_EVENTS 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [ + { + 'name': 'array_boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } + } + }, + { + 'name': 'array_boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } + } + }, + { + 'name': 'array_boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } + } + }, + { + 'name': 'array_boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'BooleanTypeAnnotation' + } + } + }, + { + 'name': 'array_string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + }, + { + 'name': 'array_string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + }, + { + 'name': 'array_string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + }, + { + 'name': 'array_string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + }, + { + 'name': 'array_double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } + } + }, + { + 'name': 'array_double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } + } + }, + { + 'name': 'array_double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } + } + }, + { + 'name': 'array_double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'DoubleTypeAnnotation' + } + } + }, + { + 'name': 'array_float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } + } + }, + { + 'name': 'array_float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } + } + }, + { + 'name': 'array_float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } + } + }, + { + 'name': 'array_float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'FloatTypeAnnotation' + } + } + }, + { + 'name': 'array_int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } + } + }, + { + 'name': 'array_int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } + } + }, + { + 'name': 'array_int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } + } + }, + { + 'name': 'array_int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'Int32TypeAnnotation' + } + } + }, + { + 'name': 'array_enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } + } + }, + { + 'name': 'array_enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } + } + }, + { + 'name': 'array_image_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + }, + { + 'name': 'array_image_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + }, + { + 'name': 'array_image_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + }, + { + 'name': 'array_image_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + }, + { + 'name': 'array_color_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'array_color_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'array_color_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'array_color_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + }, + { + 'name': 'array_point_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + }, + { + 'name': 'array_point_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + }, + { + 'name': 'array_point_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + }, + { + 'name': 'array_point_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + }, + { + 'name': 'array_insets_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + }, + { + 'name': 'array_insets_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + }, + { + 'name': 'array_insets_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + }, + { + 'name': 'array_insets_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + }, + { + 'name': 'array_object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + }, + { + 'name': 'array_object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + }, + { + 'name': 'array_object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + }, + { + 'name': 'array_object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + }, + { + 'name': 'array_of_array_object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } + } + }, + { + 'name': 'array_of_array_object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } + } + }, + { + 'name': 'array_of_array_object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } + } + }, + { + 'name': 'array_of_array_object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'array_object_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ] + } + } + }, + { + 'name': 'array_of_array_of_object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + }, + { + 'name': 'array_of_array_of_object_required_in_file', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + } + ], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_AND_EVENTS_TYPES_EXPORTED 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onBubblingEventDefinedInline', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineWithPaperName', + 'optional': false, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInline', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineWithPaperName', + 'optional': false, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + } + ], + 'props': [], + 'commands': [ + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_DEFINED_WITH_ALL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [], + 'commands': [ + { + 'name': 'handleRootTag', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'rootTag', + 'typeAnnotation': { + 'type': 'ReservedTypeAnnotation', + 'name': 'RootTag' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + }, + { + 'name': 'hotspotUpdate', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'x', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + }, + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'x', + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'z', + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture COMMANDS_WITH_EXTERNAL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [], + 'commands': [ + { + 'name': 'scrollTo', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'params': [ + { + 'name': 'y', + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'animated', + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ], + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + } + } + } + ] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_AS_NULL_INLINE 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalKey', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalValue', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullOptionalBoth', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineNullWithPaperName', + 'optional': true, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineNullWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalKey', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalValue', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullOptionalBoth', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNullWithPaperName', + 'optional': true, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineNullWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + } + ], + 'props': [], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture EVENTS_DEFINED_INLINE_WITH_ALL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInline', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineOptionalKey', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineOptionalValue', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineOptionalBoth', + 'optional': true, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineWithPaperName', + 'optional': true, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInline', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineOptionalKey', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineOptionalValue', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineOptionalBoth', + 'optional': true, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineWithPaperName', + 'optional': true, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + } + ], + 'props': [], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NO_PROPS_EVENTS_ONLY_DEPRECATED_VIEW_CONFIG_NAME_OPTION 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'deprecatedViewConfigName': 'DeprecateModuleName', + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture OBJECT_PROP_TYPES_NO_EVENTS 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': false + } + } + ] + } + }, + { + 'name': 'boolean_optional', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': false + } + } + ] + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + }, + { + 'name': 'string_optional', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': '' + } + } + ] + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation', + 'default': 0 + } + } + ] + } + }, + { + 'name': 'double_optional', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation', + 'default': 0 + } + } + ] + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': 0 + } + } + ] + } + }, + { + 'name': 'float_optional', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation', + 'default': 0 + } + } + ] + } + }, + { + 'name': 'int_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation', + 'default': 0 + } + } + ] + } + }, + { + 'name': 'int_optional', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation', + 'default': 0 + } + } + ] + } + }, + { + 'name': 'enum_optional', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringEnumTypeAnnotation', + 'default': 'small', + 'options': [ + 'small', + 'large' + ] + } + } + } + ] + } + }, + { + 'name': 'image_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + ] + } + }, + { + 'name': 'image_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + ] + } + }, + { + 'name': 'image_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + ] + } + }, + { + 'name': 'image_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ImageSourcePrimitive' + } + } + ] + } + }, + { + 'name': 'color_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'color_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'color_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'color_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'processed_color_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'processed_color_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'processed_color_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'processed_color_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'ColorPrimitive' + } + } + ] + } + }, + { + 'name': 'point_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + ] + } + }, + { + 'name': 'point_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + ] + } + }, + { + 'name': 'point_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + ] + } + }, + { + 'name': 'point_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'PointPrimitive' + } + } + ] + } + }, + { + 'name': 'insets_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + ] + } + }, + { + 'name': 'insets_optional_key', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + ] + } + }, + { + 'name': 'insets_optional_value', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + ] + } + }, + { + 'name': 'insets_optional_both', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': true, + 'typeAnnotation': { + 'type': 'ReservedPropTypeAnnotation', + 'name': 'EdgeInsetsPrimitive' + } + } + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'nestedProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'nestedProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'nestedProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'prop', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'nestedProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + ] + } + } + ], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'interfaceOnly': true, + 'paperComponentName': 'RCTModule', + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + } + ], + 'props': [ + { + 'name': 'boolean_default_true_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': true + } + } + ], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture ONE_OF_EACH_PROP_EVENT_DEFAULT_AND_OPTIONS_NO_CAST 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'interfaceOnly': true, + 'excludedPlatforms': [ + 'android' + ], + 'paperComponentName': 'RCTModule', + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onDirectEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineNull', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [] + } + } + } + ], + 'props': [ + { + 'name': 'boolean_default_true_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': true + } + } + ], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture PROPS_ALIASED_LOCALLY 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [], + 'props': [ + { + 'name': 'otherStringProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'isEnabled', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': false + } + }, + { + 'name': 'label', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'localType', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'otherStringProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'isEnabled', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': false + } + }, + { + 'name': 'label', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + }, + { + 'name': 'localArr', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'otherStringProp', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'isEnabled', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation', + 'default': false + } + }, + { + 'name': 'label', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + } + ] + } + } + } + ], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture PROPS_AND_EVENTS_TYPES_EXPORTED 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [ + { + 'type': 'ReactNativeBuiltInType', + 'knownTypeName': 'ReactNativeCoreViewProps' + } + ], + 'events': [ + { + 'name': 'onBubblingEventDefinedInline', + 'optional': false, + 'bubblingType': 'bubble', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onBubblingEventDefinedInlineWithPaperName', + 'optional': false, + 'bubblingType': 'bubble', + 'paperTopLevelNameDeprecated': 'paperBubblingEventDefinedInlineWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInline', + 'optional': false, + 'bubblingType': 'direct', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + }, + { + 'name': 'onDirectEventDefinedInlineWithPaperName', + 'optional': false, + 'bubblingType': 'direct', + 'paperTopLevelNameDeprecated': 'paperDirectEventDefinedInlineWithPaperName', + 'typeAnnotation': { + 'type': 'EventTypeAnnotation', + 'argument': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'boolean_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'string_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'string_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'double_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'float_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'enum_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'enum_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringEnumTypeAnnotation', + 'options': [ + 'small', + 'large' + ] + } + }, + { + 'name': 'object_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_required_nested_2_layers', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'object_optional_nested_1_layer', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + }, + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'double_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'DoubleTypeAnnotation' + } + }, + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + }, + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'object_readonly_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'boolean_required', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'string_optional_key', + 'optional': true, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'float_optional_value', + 'optional': true, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'object_readonly_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'int32_optional_both', + 'optional': true, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + } + ] + } + } + } + ], + 'props': [], + 'commands': [] + } + } + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture PROPS_AS_EXTERNAL_TYPES 1`] = ` +"{ + 'modules': { + 'Module': { + 'type': 'Component', + 'components': { + 'Module': { + 'extendsProps': [], + 'events': [], + 'props': [ + { + 'name': 'disable', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation', + 'default': null + } + }, + { + 'name': 'array', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + ], + 'commands': [] + } + } + } + } +}" +`; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js new file mode 100644 index 000000000000..223c7d558efb --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/__tests__/typescript-component-parser-test.js @@ -0,0 +1,44 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const TypeScriptParser = require('../../index.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const failureFixtures = require('../__test_fixtures__/failures.js'); +jest.mock('fs', () => ({ + readFileSync: filename => fixtures[filename] || failureFixtures[filename], +})); + +describe('RN Codegen TypeScript Parser', () => { + Object.keys(fixtures) + .sort() + .forEach(fixtureName => { + it(`can generate fixture ${fixtureName}`, () => { + const schema = TypeScriptParser.parseFile(fixtureName); + const serializedSchema = JSON.stringify(schema, null, 2).replace( + /"/g, + "'", + ); + expect(serializedSchema).toMatchSnapshot(); + }); + }); + + Object.keys(failureFixtures) + .sort() + .forEach(fixtureName => { + it(`Fails with error message ${fixtureName}`, () => { + expect(() => { + TypeScriptParser.parseFile(fixtureName); + }).toThrowErrorMatchingSnapshot(); + }); + }); +}); diff --git a/packages/react-native-codegen/src/parsers/typescript/components/commands.js b/packages/react-native-codegen/src/parsers/typescript/components/commands.js new file mode 100644 index 000000000000..c8b56c205dd0 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/commands.js @@ -0,0 +1,129 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ + +'use strict'; + +import type { + NamedShape, + CommandTypeAnnotation, +} from '../../../CodegenSchema.js'; +import type {TypeDeclarationMap} from '../utils.js'; + +const {getValueFromTypes} = require('../utils.js'); + +type EventTypeAST = Object; + +function buildCommandSchema(property: EventTypeAST, types: TypeDeclarationMap) { + const name = property.key.name; + const optional = property.optional || false; + const value = getValueFromTypes( + property.typeAnnotation.typeAnnotation, + types, + ); + + const firstParam = value.parameters[0].typeAnnotation; + + if ( + !( + firstParam.typeAnnotation != null && + firstParam.typeAnnotation.type === 'TSTypeReference' && + firstParam.typeAnnotation.typeName.left?.name === 'React' && + firstParam.typeAnnotation.typeName.right?.name === 'ElementRef' + ) + ) { + throw new Error( + `The first argument of method ${name} must be of type React.ElementRef<>`, + ); + } + + const params = value.parameters.slice(1).map(param => { + const paramName = param.name; + const paramValue = getValueFromTypes( + param.typeAnnotation.typeAnnotation, + types, + ); + + const type = + paramValue.type === 'TSTypeReference' + ? paramValue.typeName.name + : paramValue.type; + let returnType; + + switch (type) { + case 'RootTag': + returnType = { + type: 'ReservedTypeAnnotation', + name: 'RootTag', + }; + break; + case 'TSBooleanKeyword': + returnType = { + type: 'BooleanTypeAnnotation', + }; + break; + case 'Int32': + returnType = { + type: 'Int32TypeAnnotation', + }; + break; + case 'Double': + returnType = { + type: 'DoubleTypeAnnotation', + }; + break; + case 'Float': + returnType = { + type: 'FloatTypeAnnotation', + }; + break; + case 'TSStringKeyword': + returnType = { + type: 'StringTypeAnnotation', + }; + break; + default: + (type: empty); + throw new Error( + `Unsupported param type for method "${name}", param "${paramName}". Found ${type}`, + ); + } + + return { + name: paramName, + typeAnnotation: returnType, + }; + }); + + return { + name, + optional, + typeAnnotation: { + type: 'FunctionTypeAnnotation', + params, + returnTypeAnnotation: { + type: 'VoidTypeAnnotation', + }, + }, + }; +} + +function getCommands( + commandTypeAST: $ReadOnlyArray, + types: TypeDeclarationMap, +): $ReadOnlyArray> { + return commandTypeAST + .filter(property => property.type === 'TSPropertySignature') + .map(property => buildCommandSchema(property, types)) + .filter(Boolean); +} + +module.exports = { + getCommands, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/events.js b/packages/react-native-codegen/src/parsers/typescript/components/events.js new file mode 100644 index 000000000000..e5c1fa687225 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/events.js @@ -0,0 +1,275 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type { + EventTypeShape, + NamedShape, + EventTypeAnnotation, +} from '../../../CodegenSchema.js'; + +function getPropertyType( + name, + optional, + typeAnnotation, +): NamedShape { + const type = + typeAnnotation.type === 'TSTypeReference' + ? typeAnnotation.typeName.name + : typeAnnotation.type; + + switch (type) { + case 'TSBooleanKeyword': + return { + name, + optional, + typeAnnotation: { + type: 'BooleanTypeAnnotation', + }, + }; + case 'TSStringKeyword': + return { + name, + optional, + typeAnnotation: { + type: 'StringTypeAnnotation', + }, + }; + case 'Int32': + return { + name, + optional, + typeAnnotation: { + type: 'Int32TypeAnnotation', + }, + }; + case 'Double': + return { + name, + optional, + typeAnnotation: { + type: 'DoubleTypeAnnotation', + }, + }; + case 'Float': + return { + name, + optional, + typeAnnotation: { + type: 'FloatTypeAnnotation', + }, + }; + case 'Readonly': + return getPropertyType( + name, + optional, + typeAnnotation.typeParameters.params[0], + ); + + case 'TSTypeLiteral': + return { + name, + optional, + typeAnnotation: { + type: 'ObjectTypeAnnotation', + properties: typeAnnotation.members.map(buildPropertiesForEvent), + }, + }; + + case 'TSUnionType': + // Check for + if ( + typeAnnotation.types.some( + t => t.type === 'TSNullKeyword' || t.type === 'TSVoidKeyword', + ) + ) { + const optionalType = typeAnnotation.types.filter( + t => t.type !== 'TSNullKeyword' && t.type !== 'TSVoidKeyword', + )[0]; + + // Check for <(T | T2) | null | void> + if (optionalType.type === 'TSParenthesizedType') { + return getPropertyType(name, true, optionalType.typeAnnotation); + } + + return getPropertyType(name, true, optionalType); + } + + return { + name, + optional, + typeAnnotation: { + type: 'StringEnumTypeAnnotation', + options: typeAnnotation.types.map(option => option.literal.value), + }, + }; + default: + (type: empty); + throw new Error(`Unable to determine event type for "${name}": ${type}`); + } +} + +function findEventArgumentsAndType( + typeAnnotation, + types, + bubblingType, + paperName, +) { + if (!typeAnnotation.typeName) { + throw new Error("typeAnnotation of event doesn't have a name"); + } + const name = typeAnnotation.typeName.name; + if (name === 'Readonly') { + return { + argumentProps: typeAnnotation.typeParameters.params[0].members, + paperTopLevelNameDeprecated: paperName, + bubblingType, + }; + } else if (name === 'BubblingEventHandler' || name === 'DirectEventHandler') { + const eventType = name === 'BubblingEventHandler' ? 'bubble' : 'direct'; + const paperTopLevelNameDeprecated = + typeAnnotation.typeParameters.params.length > 1 + ? typeAnnotation.typeParameters.params[1].literal.value + : null; + + if (typeAnnotation.typeParameters.params[0].type === 'TSNullKeyword') { + return { + argumentProps: [], + bubblingType: eventType, + paperTopLevelNameDeprecated, + }; + } + return findEventArgumentsAndType( + typeAnnotation.typeParameters.params[0], + types, + eventType, + paperTopLevelNameDeprecated, + ); + } else if (types[name]) { + return findEventArgumentsAndType( + types[name].typeAnnotation, + types, + bubblingType, + paperName, + ); + } else { + return { + argumentProps: null, + bubblingType: null, + paperTopLevelNameDeprecated: null, + }; + } +} + +function buildPropertiesForEvent(property): NamedShape { + const name = property.key.name; + const optional = property.optional || false; + let typeAnnotation = property.typeAnnotation.typeAnnotation; + + return getPropertyType(name, optional, typeAnnotation); +} + +function getEventArgument(argumentProps, name) { + return { + type: 'ObjectTypeAnnotation', + properties: argumentProps.map(buildPropertiesForEvent), + }; +} + +function buildEventSchema( + types: TypeMap, + property: EventTypeAST, +): ?EventTypeShape { + const name = property.key.name; + + let optional = property.optional || false; + let typeAnnotation = property.typeAnnotation.typeAnnotation; + + // Check for T | null | void + if ( + typeAnnotation.type === 'TSUnionType' && + typeAnnotation.types.some( + t => t.type === 'TSNullKeyword' || t.type === 'TSVoidKeyword', + ) + ) { + typeAnnotation = typeAnnotation.types.filter( + t => t.type !== 'TSNullKeyword' && t.type !== 'TSVoidKeyword', + )[0]; + optional = true; + } + + if ( + typeAnnotation.type !== 'TSTypeReference' || + (typeAnnotation.typeName.name !== 'BubblingEventHandler' && + typeAnnotation.typeName.name !== 'DirectEventHandler') + ) { + return null; + } + + const {argumentProps, bubblingType, paperTopLevelNameDeprecated} = + findEventArgumentsAndType(typeAnnotation, types); + + if (bubblingType && argumentProps) { + if (paperTopLevelNameDeprecated != null) { + return { + name, + optional, + bubblingType, + paperTopLevelNameDeprecated, + typeAnnotation: { + type: 'EventTypeAnnotation', + argument: getEventArgument(argumentProps, name), + }, + }; + } + + return { + name, + optional, + bubblingType, + typeAnnotation: { + type: 'EventTypeAnnotation', + argument: getEventArgument(argumentProps, name), + }, + }; + } + + if (argumentProps === null) { + throw new Error(`Unable to determine event arguments for "${name}"`); + } + + if (bubblingType === null) { + throw new Error(`Unable to determine event arguments for "${name}"`); + } +} + +// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser +type EventTypeAST = Object; + +type TypeMap = { + // $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser + [string]: Object, + ... +}; + +function getEvents( + eventTypeAST: $ReadOnlyArray, + types: TypeMap, +): $ReadOnlyArray { + return eventTypeAST + .filter(property => property.type === 'TSPropertySignature') + .map(property => buildEventSchema(types, property)) + .filter(Boolean); +} + +module.exports = { + getEvents, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/extends.js b/packages/react-native-codegen/src/parsers/typescript/components/extends.js new file mode 100644 index 000000000000..2b16a91a5d14 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/extends.js @@ -0,0 +1,66 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {ExtendsPropsShape} from '../../../CodegenSchema.js'; +import type {TypeDeclarationMap} from '../utils.js'; + +function extendsForProp(prop: PropsAST, types: TypeDeclarationMap) { + if (!prop.expression) { + console.log('null', prop); + } + const name = prop.expression.name; + + if (types[name] != null) { + // This type is locally defined in the file + return null; + } + + switch (name) { + case 'ViewProps': + return { + type: 'ReactNativeBuiltInType', + knownTypeName: 'ReactNativeCoreViewProps', + }; + default: { + throw new Error(`Unable to handle prop spread: ${name}`); + } + } +} + +function removeKnownExtends( + typeDefinition: $ReadOnlyArray, + types: TypeDeclarationMap, +): $ReadOnlyArray { + return typeDefinition.filter( + prop => + prop.type !== 'TSExpressionWithTypeArguments' || + extendsForProp(prop, types) === null, + ); +} + +// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser +type PropsAST = Object; + +function getExtendsProps( + typeDefinition: $ReadOnlyArray, + types: TypeDeclarationMap, +): $ReadOnlyArray { + return typeDefinition + .filter(prop => prop.type === 'TSExpressionWithTypeArguments') + .map(prop => extendsForProp(prop, types)) + .filter(Boolean); +} + +module.exports = { + getExtendsProps, + removeKnownExtends, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/index.js b/packages/react-native-codegen/src/parsers/typescript/components/index.js new file mode 100644 index 000000000000..b36394f84259 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/index.js @@ -0,0 +1,219 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; +import type {CommandOptions} from './options'; +import type {TypeDeclarationMap} from '../utils'; + +import type {ComponentSchemaBuilderConfig} from './schema.js'; +const {getCommands} = require('./commands'); +const {getEvents} = require('./events'); +const {getProps, getPropProperties} = require('./props'); +const {getCommandOptions, getOptions} = require('./options'); +const {getExtendsProps, removeKnownExtends} = require('./extends'); +const {getTypes} = require('../utils'); + +function findComponentConfig(ast) { + const foundConfigs = []; + + const defaultExports = ast.body.filter( + node => node.type === 'ExportDefaultDeclaration', + ); + + defaultExports.forEach(statement => { + let declaration = statement.declaration; + + // codegenNativeComponent can be nested inside a cast + // expression so we need to go one level deeper + if (declaration.type === 'TSAsExpression') { + declaration = declaration.expression; + } + + try { + if (declaration.callee.name === 'codegenNativeComponent') { + const typeArgumentParams = declaration.typeParameters.params; + const funcArgumentParams = declaration.arguments; + + const nativeComponentType = {}; + nativeComponentType.propsTypeName = typeArgumentParams[0].typeName.name; + nativeComponentType.componentName = funcArgumentParams[0].value; + if (funcArgumentParams.length > 1) { + nativeComponentType.optionsExpression = funcArgumentParams[1]; + } + foundConfigs.push(nativeComponentType); + } + } catch (e) { + // ignore + } + }); + + if (foundConfigs.length === 0) { + throw new Error('Could not find component config for native component'); + } + if (foundConfigs.length > 1) { + throw new Error('Only one component is supported per file'); + } + + const foundConfig = foundConfigs[0]; + + const namedExports = ast.body.filter( + node => node.type === 'ExportNamedDeclaration', + ); + + const commandsTypeNames = namedExports + .map(statement => { + let callExpression; + let calleeName; + try { + callExpression = statement.declaration.declarations[0].init; + calleeName = callExpression.callee.name; + } catch (e) { + return; + } + + if (calleeName !== 'codegenNativeCommands') { + return; + } + + // const statement.declaration.declarations[0].init + if (callExpression.arguments.length !== 1) { + throw new Error( + 'codegenNativeCommands must be passed options including the supported commands', + ); + } + + const typeArgumentParam = callExpression.typeParameters.params[0]; + + if (typeArgumentParam.type !== 'TSTypeReference') { + throw new Error( + "codegenNativeCommands doesn't support inline definitions. Specify a file local type alias", + ); + } + + return { + commandTypeName: typeArgumentParam.typeName.name, + commandOptionsExpression: callExpression.arguments[0], + }; + }) + .filter(Boolean); + + if (commandsTypeNames.length > 1) { + throw new Error('codegenNativeCommands may only be called once in a file'); + } + + return { + ...foundConfig, + commandTypeName: + commandsTypeNames[0] == null + ? null + : commandsTypeNames[0].commandTypeName, + commandOptionsExpression: + commandsTypeNames[0] == null + ? null + : commandsTypeNames[0].commandOptionsExpression, + }; +} + +function getCommandProperties( + commandTypeName, + types: TypeDeclarationMap, + commandOptions: ?CommandOptions, +) { + if (commandTypeName == null) { + return []; + } + + const typeAlias = types[commandTypeName]; + + if (typeAlias.type !== 'TSInterfaceDeclaration') { + throw new Error( + `The type argument for codegenNativeCommands must be an interface, received ${typeAlias.type}`, + ); + } + + let properties; + try { + properties = typeAlias.body.body; + } catch (e) { + throw new Error( + `Failed to find type definition for "${commandTypeName}", please check that you have a valid codegen typescript file`, + ); + } + + const typeScriptPropertyNames = properties + .map(property => property && property.key && property.key.name) + .filter(Boolean); + + if (commandOptions == null || commandOptions.supportedCommands == null) { + throw new Error( + 'codegenNativeCommands must be given an options object with supportedCommands array', + ); + } + + if ( + commandOptions.supportedCommands.length !== + typeScriptPropertyNames.length || + !commandOptions.supportedCommands.every(supportedCommand => + typeScriptPropertyNames.includes(supportedCommand), + ) + ) { + throw new Error( + `codegenNativeCommands expected the same supportedCommands specified in the ${commandTypeName} interface: ${typeScriptPropertyNames.join( + ', ', + )}`, + ); + } + + return properties; +} + +// $FlowFixMe[signature-verification-failure] TODO(T108222691): Use flow-types for @babel/parser +function buildComponentSchema(ast): ComponentSchemaBuilderConfig { + const { + componentName, + propsTypeName, + commandTypeName, + commandOptionsExpression, + optionsExpression, + } = findComponentConfig(ast); + + const types = getTypes(ast); + + const propProperties = getPropProperties(propsTypeName, types); + const commandOptions = getCommandOptions(commandOptionsExpression); + + const commandProperties = getCommandProperties( + commandTypeName, + types, + commandOptions, + ); + + const extendsProps = getExtendsProps(propProperties, types); + const options = getOptions(optionsExpression); + + const nonExtendsProps = removeKnownExtends(propProperties, types); + const props = getProps(nonExtendsProps, types); + const events = getEvents(propProperties, types); + const commands = getCommands(commandProperties, types); + + return { + filename: componentName, + componentName, + options, + extendsProps, + events, + props, + commands, + }; +} + +module.exports = { + buildComponentSchema, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/options.js b/packages/react-native-codegen/src/parsers/typescript/components/options.js new file mode 100644 index 000000000000..4b0f9711172f --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/options.js @@ -0,0 +1,87 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type {OptionsShape} from '../../../CodegenSchema.js'; + +// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser +type OptionsAST = Object; + +export type CommandOptions = $ReadOnly<{ + supportedCommands: $ReadOnlyArray, +}>; + +function getCommandOptions( + commandOptionsExpression: OptionsAST, +): ?CommandOptions { + if (commandOptionsExpression == null) { + return null; + } + + let foundOptions; + try { + foundOptions = commandOptionsExpression.properties.reduce( + (options, prop) => { + options[prop.key.name] = ( + (prop && prop.value && prop.value.elements) || + [] + ).map(element => element && element.value); + return options; + }, + {}, + ); + } catch (e) { + throw new Error( + 'Failed to parse command options, please check that they are defined correctly', + ); + } + + return foundOptions; +} + +function getOptions(optionsExpression: OptionsAST): ?OptionsShape { + if (!optionsExpression) { + return null; + } + let foundOptions; + try { + foundOptions = optionsExpression.properties.reduce((options, prop) => { + if (prop.value.type === 'ArrayExpression') { + options[prop.key.name] = prop.value.elements.map( + element => element.value, + ); + } else { + options[prop.key.name] = prop.value.value; + } + return options; + }, {}); + } catch (e) { + throw new Error( + 'Failed to parse codegen options, please check that they are defined correctly', + ); + } + + if ( + foundOptions.paperComponentName && + foundOptions.paperComponentNameDeprecated + ) { + throw new Error( + 'Failed to parse codegen options, cannot use both paperComponentName and paperComponentNameDeprecated', + ); + } + + return foundOptions; +} + +module.exports = { + getCommandOptions, + getOptions, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/props.js b/packages/react-native-codegen/src/parsers/typescript/components/props.js new file mode 100644 index 000000000000..68d1d85e0b38 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/props.js @@ -0,0 +1,632 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +const {getValueFromTypes} = require('../utils.js'); + +import type {NamedShape, PropTypeAnnotation} from '../../../CodegenSchema.js'; +import type {TypeDeclarationMap} from '../utils.js'; + +function getPropProperties( + propsTypeName: string, + types: TypeDeclarationMap, +): $FlowFixMe { + const alias = types[propsTypeName]; + const aliasKind = + alias.type === 'TSInterfaceDeclaration' ? 'interface' : 'type'; + + try { + if (aliasKind === 'interface') { + return [...(alias.extends ?? []), ...alias.body.body]; + } + + return ( + alias.typeAnnotation.members || + alias.typeAnnotation.typeParameters.params[0].members || + alias.typeAnnotation.typeParameters.params + ); + } catch (e) { + throw new Error( + `Failed to find ${aliasKind} definition for "${propsTypeName}", please check that you have a valid codegen typescript file`, + ); + } +} + +function getTypeAnnotationForArray( + name: string, + typeAnnotation: $FlowFixMe, + defaultValue: $FlowFixMe | null, + types: TypeDeclarationMap, +) { + const extractedTypeAnnotation = getValueFromTypes(typeAnnotation, types); + + if ( + extractedTypeAnnotation.type === 'TSUnionType' && + extractedTypeAnnotation.types.some( + t => t.type === 'TSNullKeyword' || t.type === 'TSVoidKeyword', + ) + ) { + throw new Error( + 'Nested optionals such as "ReadonlyArray" are not supported, please declare optionals at the top level of value definitions as in "ReadonlyArray | null | void"', + ); + } + + if ( + extractedTypeAnnotation.type === 'TSTypeReference' && + extractedTypeAnnotation.typeName.name === 'WithDefault' + ) { + throw new Error( + 'Nested defaults such as "ReadonlyArray>" are not supported, please declare defaults at the top level of value definitions as in "WithDefault, false>"', + ); + } + + if (extractedTypeAnnotation.type === 'TSTypeReference') { + // Resolve the type alias if it's not defined inline + const objectType = getValueFromTypes(extractedTypeAnnotation, types); + + if (objectType.typeName.name === 'Readonly') { + return { + type: 'ObjectTypeAnnotation', + properties: flattenProperties( + objectType.typeParameters.params[0].members || + objectType.typeParameters.params, + types, + ) + .map(prop => buildPropSchema(prop, types)) + .filter(Boolean), + }; + } + + if (objectType.typeName.name === 'ReadonlyArray') { + // We need to go yet another level deeper to resolve + // types that may be defined in a type alias + const nestedObjectType = getValueFromTypes( + objectType.typeParameters.params[0], + types, + ); + + return { + type: 'ArrayTypeAnnotation', + elementType: { + type: 'ObjectTypeAnnotation', + properties: flattenProperties( + nestedObjectType.typeParameters.params[0].members || + nestedObjectType.typeParameters.params, + types, + ) + .map(prop => buildPropSchema(prop, types)) + .filter(Boolean), + }, + }; + } + } + + const type = + extractedTypeAnnotation.elementType === 'TSTypeReference' + ? extractedTypeAnnotation.elementType.typeName.name + : extractedTypeAnnotation.elementType?.type || + extractedTypeAnnotation.typeName?.name || + extractedTypeAnnotation.type; + + switch (type) { + case 'TSNumberKeyword': + return { + type: 'FloatTypeAnnotation', + }; + case 'ImageSource': + return { + type: 'ReservedPropTypeAnnotation', + name: 'ImageSourcePrimitive', + }; + case 'ColorValue': + case 'ProcessedColorValue': + return { + type: 'ReservedPropTypeAnnotation', + name: 'ColorPrimitive', + }; + case 'PointValue': + return { + type: 'ReservedPropTypeAnnotation', + name: 'PointPrimitive', + }; + case 'EdgeInsetsValue': + return { + type: 'ReservedPropTypeAnnotation', + name: 'EdgeInsetsPrimitive', + }; + case 'Stringish': + return { + type: 'StringTypeAnnotation', + }; + case 'Int32': + return { + type: 'Int32TypeAnnotation', + }; + case 'Double': + return { + type: 'DoubleTypeAnnotation', + }; + case 'Float': + return { + type: 'FloatTypeAnnotation', + }; + case 'TSBooleanKeyword': + return { + type: 'BooleanTypeAnnotation', + }; + case 'TSStringKeyword': + return { + type: 'StringTypeAnnotation', + }; + case 'TSUnionType': + typeAnnotation.types.reduce((lastType, currType) => { + const lastFlattenedType = + lastType && lastType.type === 'TSLiteralType' + ? lastType.literal.type + : lastType.type; + const currFlattenedType = + currType.type === 'TSLiteralType' + ? currType.literal.type + : currType.type; + + if (lastFlattenedType && currFlattenedType !== lastFlattenedType) { + throw new Error(`Mixed types are not supported (see "${name}")`); + } + return currType; + }); + + if (defaultValue === null) { + throw new Error(`A default enum value is required for "${name}"`); + } + + const unionType = typeAnnotation.types[0].type; + if ( + unionType === 'TSLiteralType' && + typeAnnotation.types[0].literal?.type === 'StringLiteral' + ) { + return { + type: 'StringEnumTypeAnnotation', + default: (defaultValue: string), + options: typeAnnotation.types.map(option => option.literal.value), + }; + } else if ( + unionType === 'TSLiteralType' && + typeAnnotation.types[0].literal?.type === 'NumericLiteral' + ) { + throw new Error( + `Arrays of int enums are not supported (see: "${name}")`, + ); + } else { + throw new Error( + `Unsupported union type for "${name}", received "${ + unionType === 'TSLiteralType' + ? typeAnnotation.types[0].literal?.type + : unionType + }"`, + ); + } + default: + (type: empty); + throw new Error(`Unknown prop type for "${name}": ${type}`); + } +} + +function getTypeAnnotation( + name: string, + annotation, + defaultValue: $FlowFixMe | null, + withNullDefault: boolean, + types: TypeDeclarationMap, +) { + const typeAnnotation = getValueFromTypes(annotation, types); + + // Covers: readonly T[] + if ( + typeAnnotation.type === 'TSTypeOperator' && + typeAnnotation.operator === 'readonly' && + typeAnnotation.typeAnnotation.type === 'TSArrayType' + ) { + return { + type: 'ArrayTypeAnnotation', + elementType: getTypeAnnotationForArray( + name, + typeAnnotation.typeAnnotation, + defaultValue, + types, + ), + }; + } + + // Covers: ReadonlyArray + if ( + typeAnnotation.type === 'TSTypeReference' && + typeAnnotation.typeName.name === 'ReadonlyArray' + ) { + return { + type: 'ArrayTypeAnnotation', + elementType: getTypeAnnotationForArray( + name, + typeAnnotation.typeParameters.params[0], + defaultValue, + types, + ), + }; + } + + // Covers: Readonly + if ( + typeAnnotation.type === 'TSTypeReference' && + typeAnnotation.typeName?.name === 'Readonly' && + typeAnnotation.typeParameters.type === 'TSTypeParameterInstantiation' && + typeAnnotation.typeParameters.params[0].type === 'TSArrayType' + ) { + return { + type: 'ArrayTypeAnnotation', + elementType: getTypeAnnotationForArray( + name, + typeAnnotation.typeParameters.params[0], + defaultValue, + types, + ), + }; + } + + if ( + (typeAnnotation.type === 'TSTypeReference' || + typeAnnotation.type === 'TSTypeLiteral') && + typeAnnotation.typeName?.name === 'Readonly' + ) { + const rawProperties = + typeAnnotation.typeParameters.params[0].members || + (typeAnnotation.typeParameters.params[0].types && + typeAnnotation.typeParameters.params[0].types[0].members) || + typeAnnotation.typeParameters.params; + + const flattenedProperties = flattenProperties(rawProperties, types); + + const properties = flattenedProperties + .map(prop => buildPropSchema(prop, types)) + .filter(Boolean); + + return { + type: 'ObjectTypeAnnotation', + properties, + }; + } + + const type = + typeAnnotation.type === 'TSTypeReference' || + typeAnnotation.type === 'TSTypeAliasDeclaration' + ? typeAnnotation.typeName.name + : typeAnnotation.type; + + switch (type) { + case 'ImageSource': + return { + type: 'ReservedPropTypeAnnotation', + name: 'ImageSourcePrimitive', + }; + case 'ColorValue': + case 'ProcessedColorValue': + return { + type: 'ReservedPropTypeAnnotation', + name: 'ColorPrimitive', + }; + case 'ColorArrayValue': + return { + type: 'ArrayTypeAnnotation', + elementType: { + type: 'ReservedPropTypeAnnotation', + name: 'ColorPrimitive', + }, + }; + case 'PointValue': + return { + type: 'ReservedPropTypeAnnotation', + name: 'PointPrimitive', + }; + case 'EdgeInsetsValue': + return { + type: 'ReservedPropTypeAnnotation', + name: 'EdgeInsetsPrimitive', + }; + case 'Int32': + return { + type: 'Int32TypeAnnotation', + default: ((defaultValue ? defaultValue : 0): number), + }; + case 'Double': + return { + type: 'DoubleTypeAnnotation', + default: ((defaultValue ? defaultValue : 0): number), + }; + case 'Float': + return { + type: 'FloatTypeAnnotation', + default: withNullDefault + ? (defaultValue: number | null) + : ((defaultValue ? defaultValue : 0): number), + }; + case 'TSBooleanKeyword': + return { + type: 'BooleanTypeAnnotation', + default: withNullDefault + ? (defaultValue: boolean | null) + : ((defaultValue == null ? false : defaultValue): boolean), + }; + case 'TSStringKeyword': + if (typeof defaultValue !== 'undefined') { + return { + type: 'StringTypeAnnotation', + default: (defaultValue: string | null), + }; + } + throw new Error(`A default string (or null) is required for "${name}"`); + case 'Stringish': + if (typeof defaultValue !== 'undefined') { + return { + type: 'StringTypeAnnotation', + default: (defaultValue: string | null), + }; + } + throw new Error(`A default string (or null) is required for "${name}"`); + case 'TSUnionType': + typeAnnotation.types.reduce((lastType, currType) => { + const lastFlattenedType = + lastType && lastType.type === 'TSLiteralType' + ? lastType.literal.type + : lastType.type; + const currFlattenedType = + currType.type === 'TSLiteralType' + ? currType.literal.type + : currType.type; + + if (lastFlattenedType && currFlattenedType !== lastFlattenedType) { + throw new Error(`Mixed types are not supported (see "${name}")`); + } + return currType; + }); + + if (defaultValue === null) { + throw new Error(`A default enum value is required for "${name}"`); + } + + const unionType = typeAnnotation.types[0].type; + if ( + unionType === 'TSLiteralType' && + typeAnnotation.types[0].literal?.type === 'StringLiteral' + ) { + return { + type: 'StringEnumTypeAnnotation', + default: (defaultValue: string), + options: typeAnnotation.types.map(option => option.literal.value), + }; + } else if ( + unionType === 'TSLiteralType' && + typeAnnotation.types[0].literal?.type === 'NumericLiteral' + ) { + return { + type: 'Int32EnumTypeAnnotation', + default: (defaultValue: number), + options: typeAnnotation.types.map(option => option.literal.value), + }; + } else { + throw new Error( + `Unsupported union type for "${name}", received "${ + unionType === 'TSLiteralType' + ? typeAnnotation.types[0].literal?.type + : unionType + }"`, + ); + } + case 'TSNumberKeyword': + throw new Error( + `Cannot use "${type}" type annotation for "${name}": must use a specific numeric type like Int32, Double, or Float`, + ); + default: + (type: empty); + throw new Error(`Unknown prop type for "${name}": "${type}"`); + } +} + +function buildPropSchema( + property: PropAST, + types: TypeDeclarationMap, +): ?NamedShape { + const name = property.key.name; + + const value = getValueFromTypes( + property.typeAnnotation.typeAnnotation, + types, + ); + + let typeAnnotation = value; + let optional = property.optional || false; + + // Check for optional type in union e.g. T | null | void + if ( + typeAnnotation.type === 'TSUnionType' && + typeAnnotation.types.some( + t => t.type === 'TSNullKeyword' || t.type === 'TSVoidKeyword', + ) + ) { + typeAnnotation = typeAnnotation.types.filter( + t => t.type !== 'TSNullKeyword' && t.type !== 'TSVoidKeyword', + )[0]; + optional = true; + + // Check against optional type inside `WithDefault` + if ( + typeAnnotation.type === 'TSTypeReference' && + typeAnnotation.typeName.name === 'WithDefault' + ) { + throw new Error( + 'WithDefault<> is optional and does not need to be marked as optional. Please remove the union of void and/or null', + ); + } + } + + // example: WithDefault; + if ( + value.type === 'TSTypeReference' && + typeAnnotation.typeName.name === 'WithDefault' + ) { + optional = true; + } + + // example: Readonly<{prop: string} | null | void>; + if ( + value.type === 'TSTypeReference' && + typeAnnotation.typeParameters?.params[0].type === 'TSUnionType' && + typeAnnotation.typeParameters?.params[0].types.some( + element => + element.type === 'TSNullKeyword' || element.type === 'TSVoidKeyword', + ) + ) { + optional = true; + } + + if ( + !property.optional && + value.type === 'TSTypeReference' && + typeAnnotation.typeName.name === 'WithDefault' + ) { + throw new Error( + `key ${name} must be optional if used with WithDefault<> annotation`, + ); + } + + let type = typeAnnotation.type; + if ( + type === 'TSTypeReference' && + (typeAnnotation.typeName.name === 'DirectEventHandler' || + typeAnnotation.typeName.name === 'BubblingEventHandler') + ) { + return null; + } + + if ( + name === 'style' && + type === 'GenericTypeAnnotation' && + typeAnnotation.typeName.name === 'ViewStyleProp' + ) { + return null; + } + + let defaultValue = null; + let withNullDefault = false; + if ( + type === 'TSTypeReference' && + typeAnnotation.typeName.name === 'WithDefault' + ) { + if (typeAnnotation.typeParameters.params.length === 1) { + throw new Error( + `WithDefault requires two parameters, did you forget to provide a default value for "${name}"?`, + ); + } + + let defaultValueType = typeAnnotation.typeParameters.params[1].type; + defaultValue = typeAnnotation.typeParameters.params[1].value; + + if (defaultValueType === 'TSLiteralType') { + defaultValueType = typeAnnotation.typeParameters.params[1].literal.type; + defaultValue = typeAnnotation.typeParameters.params[1].literal.value; + } + + if (defaultValueType === 'TSNullKeyword') { + defaultValue = null; + withNullDefault = true; + } + + typeAnnotation = typeAnnotation.typeParameters.params[0]; + type = + typeAnnotation.type === 'TSTypeReference' + ? typeAnnotation.typeName.name + : typeAnnotation.type; + } + + return { + name, + optional, + typeAnnotation: getTypeAnnotation( + name, + typeAnnotation, + defaultValue, + withNullDefault, + types, + ), + }; +} + +// $FlowFixMe[unclear-type] TODO(T108222691): Use flow-types for @babel/parser +type PropAST = Object; + +function verifyPropNotAlreadyDefined( + props: $ReadOnlyArray, + needleProp: PropAST, +) { + const propName = needleProp.key.name; + const foundProp = props.some(prop => prop.key.name === propName); + if (foundProp) { + throw new Error(`A prop was already defined with the name ${propName}`); + } +} + +function flattenProperties( + typeDefinition: $ReadOnlyArray, + types: TypeDeclarationMap, +) { + return typeDefinition + .map(property => { + if (property.type === 'TSPropertySignature') { + return property; + } else if (property.type === 'TSTypeReference') { + return flattenProperties( + getPropProperties(property.typeName.name, types), + types, + ); + } else if (property.type === 'TSExpressionWithTypeArguments') { + return flattenProperties( + getPropProperties(property.expression.name, types), + types, + ); + } + }) + .reduce((acc, item) => { + if (Array.isArray(item)) { + item.forEach(prop => { + verifyPropNotAlreadyDefined(acc, prop); + }); + return acc.concat(item); + } else { + verifyPropNotAlreadyDefined(acc, item); + acc.push(item); + return acc; + } + }, []) + .filter(Boolean); +} + +function getProps( + typeDefinition: $ReadOnlyArray, + types: TypeDeclarationMap, +): $ReadOnlyArray> { + return flattenProperties(typeDefinition, types) + .map(property => { + return buildPropSchema(property, types); + }) + .filter(Boolean); +} + +module.exports = { + getProps, + getPropProperties, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/components/schema.js b/packages/react-native-codegen/src/parsers/typescript/components/schema.js new file mode 100644 index 000000000000..ed6223c3347b --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/components/schema.js @@ -0,0 +1,62 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow strict-local + */ + +'use strict'; + +import type { + EventTypeShape, + NamedShape, + CommandTypeAnnotation, + PropTypeAnnotation, + ExtendsPropsShape, + SchemaType, + OptionsShape, +} from '../../../CodegenSchema.js'; + +export type ComponentSchemaBuilderConfig = $ReadOnly<{ + filename: string, + componentName: string, + extendsProps: $ReadOnlyArray, + events: $ReadOnlyArray, + props: $ReadOnlyArray>, + commands: $ReadOnlyArray>, + options?: ?OptionsShape, +}>; + +function wrapComponentSchema({ + filename, + componentName, + extendsProps, + events, + props, + options, + commands, +}: ComponentSchemaBuilderConfig): SchemaType { + return { + modules: { + [filename]: { + type: 'Component', + components: { + [componentName]: { + ...(options || {}), + extendsProps, + events, + props, + commands, + }, + }, + }, + }, + }; +} + +module.exports = { + wrapComponentSchema, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/errors.js b/packages/react-native-codegen/src/parsers/typescript/errors.js new file mode 100644 index 000000000000..41fc7f8ca4ee --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/errors.js @@ -0,0 +1,36 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +class ParserError extends Error { + nodes: $ReadOnlyArray<$FlowFixMe>; + constructor( + hasteModuleName: string, + astNodeOrNodes: $FlowFixMe, + message: string, + ) { + super(`Module ${hasteModuleName}: ${message}`); + + this.nodes = Array.isArray(astNodeOrNodes) + ? astNodeOrNodes + : [astNodeOrNodes]; + + // assign the error class name in your custom error (as a shortcut) + this.name = this.constructor.name; + + // capturing the stack trace keeps the reference to your error class + Error.captureStackTrace(this, this.constructor); + } +} + +module.exports = { + ParserError, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/index.js b/packages/react-native-codegen/src/parsers/typescript/index.js new file mode 100644 index 000000000000..92f41635cc76 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/index.js @@ -0,0 +1,153 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + * @format + */ + +'use strict'; + +import type {SchemaType} from '../../CodegenSchema.js'; +const babelParser = require('@babel/parser'); +const fs = require('fs'); +const path = require('path'); +const {buildComponentSchema} = require('./components'); +const {wrapComponentSchema} = require('./components/schema'); +const {buildModuleSchema} = require('./modules'); +const {wrapModuleSchema} = require('./modules/schema'); + +const { + createParserErrorCapturer, + visit, + isModuleRegistryCall, +} = require('./utils'); +const invariant = require('invariant'); + +function getConfigType( + // TODO(T108222691): Use flow-types for @babel/parser + ast: $FlowFixMe, +): 'module' | 'component' | 'none' { + let isComponent = false; + let isModule = false; + + visit(ast, { + CallExpression(node) { + if ( + node.callee.type === 'Identifier' && + node.callee.name === 'codegenNativeComponent' + ) { + isComponent = true; + } + + if (isModuleRegistryCall(node)) { + isModule = true; + } + }, + + TSInterfaceDeclaration(node) { + if ( + Array.isArray(node.extends) && + node.extends.some( + extension => extension.expression.name === 'TurboModule', + ) + ) { + isModule = true; + } + }, + }); + + if (isModule && isComponent) { + throw new Error( + 'Found type extending "TurboModule" and exported "codegenNativeComponent" declaration in one file. Split them into separated files.', + ); + } + + if (isModule) { + return 'module'; + } else if (isComponent) { + return 'component'; + } else { + return 'none'; + } +} + +function buildSchema(contents: string, filename: ?string): SchemaType { + // Early return for non-Spec JavaScript files + if ( + !contents.includes('codegenNativeComponent') && + !contents.includes('TurboModule') + ) { + return {modules: {}}; + } + + const ast = babelParser.parse(contents, { + sourceType: 'module', + plugins: ['typescript'], + }).program; + + const configType = getConfigType(ast); + + switch (configType) { + case 'component': { + return wrapComponentSchema(buildComponentSchema(ast)); + } + case 'module': { + if (filename === undefined || filename === null) { + throw new Error('Filepath expected while parasing a module'); + } + const hasteModuleName = path.basename(filename).replace(/\.tsx?$/, ''); + + const [parsingErrors, tryParse] = createParserErrorCapturer(); + + const schema = tryParse(() => + buildModuleSchema(hasteModuleName, ast, tryParse), + ); + + if (parsingErrors.length > 0) { + /** + * TODO(T77968131): We have two options: + * - Throw the first error, but indicate there are more then one errors. + * - Display all errors, nicely formatted. + * + * For the time being, we're just throw the first error. + **/ + + throw parsingErrors[0]; + } + + invariant( + schema != null, + 'When there are no parsing errors, the schema should not be null', + ); + + return wrapModuleSchema(schema, hasteModuleName); + } + default: + return {modules: {}}; + } +} + +function parseFile(filename: string): SchemaType { + const contents = fs.readFileSync(filename, 'utf8'); + + return buildSchema(contents, filename); +} + +function parseModuleFixture(filename: string): SchemaType { + const contents = fs.readFileSync(filename, 'utf8'); + + return buildSchema(contents, 'path/NativeSampleTurboModule.ts'); +} + +function parseString(contents: string, filename: ?string): SchemaType { + return buildSchema(contents, filename); +} + +module.exports = { + parseFile, + parseModuleFixture, + parseString, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js new file mode 100644 index 000000000000..28f4dcd132a0 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/failures.js @@ -0,0 +1,166 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @lint-ignore-every LICENSELINT + */ + +const NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + getString: (arg: string) => Array; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + getString: (arg: Array) => string; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULES_WITH_NOT_ONLY_METHODS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getBool: (arg: boolean) => boolean; + readonly getNumber: (arg: number) => number; + readonly getString: (arg: string) => string; + sampleBool: boolean, + +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); + +`; + +const NATIVE_MODULES_WITH_UNNAMED_PARAMS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getBool: (boolean) => boolean; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULES_WITH_PROMISE_WITHOUT_TYPE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getBool: (arg: boolean) => Promise; + +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); + +`; + +const TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule1'); +export default TurboModuleRegistry.getEnforcing('SampleTurboModule2'); +`; + +const TWO_NATIVE_EXTENDING_TURBO_MODULE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getSth: (a: number | null | void) => void; +} + +export interface Spec2 extends TurboModule { + readonly getSth: (a: number | null | void) => void; +} +`; + +module.exports = { + NATIVE_MODULES_WITH_UNNAMED_PARAMS, + NATIVE_MODULES_WITH_PROMISE_WITHOUT_TYPE, + NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM, + NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT, + TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT, + NATIVE_MODULES_WITH_NOT_ONLY_METHODS, + TWO_NATIVE_EXTENDING_TURBO_MODULE, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js new file mode 100644 index 000000000000..273dec217195 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js @@ -0,0 +1,527 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + * @lint-ignore-every LICENSELINT + */ + +const EMPTY_NATIVE_MODULE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_COMPLEX_OBJECTS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export type String = string; + +export interface Spec extends TurboModule { + // Exported methods. + readonly getObject: (arg: {const1: {const1: boolean}}) => { + const1: {const1: boolean}, + }; + readonly getReadOnlyObject: (arg: Readonly<{const1: Readonly<{const1: boolean}>}>) => Readonly<{ + const1: {const1: boolean}, + }>; + readonly getObject2: (arg: { a: String }) => Object; + readonly getObjectInArray: (arg: {const1: {const1: boolean}}) => Array<{ + const1: {const1: boolean}, + }>; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export type String = string; + +export interface Spec extends TurboModule { + readonly getConstants: () => { + isTesting: boolean; + reactNativeVersion: { + major: number; + minor: number; + patch?: number; + prerelease: number | null | void; + }; + forceTouchAvailable: boolean; + osVersion: string; + systemName: string; + interfaceIdiom: string; + }; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_BASIC_PARAM_TYPES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly passBool?: (arg: boolean) => void; + readonly passNumber: (arg: number) => void; + readonly passString: (arg: string) => void; + readonly passStringish: (arg: Stringish) => void; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); + +`; + +const NATIVE_MODULE_WITH_ALIASES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +type NumNum = number; +export type Num = (arg: NumNum) => void; +type Num2 = Num; +export type Void = void; +export type A = number; +export type B = number; +export type ObjectAlias = { + x: number; + y: number; + label: string; + truthy: boolean; +}; + +export interface Spec extends TurboModule { + // Exported methods. + readonly getNumber: Num2; + readonly getVoid: () => Void; + readonly getArray: (a: Array) => {a: B}; + readonly getStringFromAlias: (a: ObjectAlias) => string; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_NESTED_ALIASES = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + + +import type {TurboModule} from '../RCTExport'; +import * as TurboModuleRegistry from '../TurboModuleRegistry'; + +type Bar = { + z: number +}; + +type Foo = { + bar1: Bar, + bar2: Bar, +}; + +export interface Spec extends TurboModule { + // Exported methods. + foo1: (x: Foo) => Foo; + foo2: (x: Foo) => void; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); + +`; + +const NATIVE_MODULE_WITH_FLOAT_AND_INT32 = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import type {Int32, Float} from 'react-native/Libraries/Types/CodegenTypes'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getInt: (arg: Int32) => Int32; + readonly getFloat: (arg: Float) => Float; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_SIMPLE_OBJECT = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getObject: (o: Object) => Object, +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_UNSAFE_OBJECT = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; +import type {UnsafeObject} from 'react-native/Libraries/Types/CodegenTypes'; + +export interface Spec extends TurboModule { + readonly getUnsafeObject: (o: UnsafeObject) => UnsafeObject; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_ROOT_TAG = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type { + TurboModule, + RootTag, +} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getRootTag: (rootTag: RootTag) => RootTag; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_NULLABLE_PARAM = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly voidFunc: (arg: string | null | void) => void; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_BASIC_ARRAY = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getArray: (arg: Array) => Array; + readonly getArray: (arg: ReadonlyArray) => ReadonlyArray; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +type DisplayMetricsAndroid = { + width: number; +}; + +export interface Spec extends TurboModule { + readonly getConstants: () => { + readonly Dimensions: { + windowPhysicalPixels: DisplayMetricsAndroid; + }; + }; + readonly getConstants2: () => Readonly<{ + readonly Dimensions: { + windowPhysicalPixels: DisplayMetricsAndroid; + }; + }>; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getArray: ( + arg: Array<[string, string]>, + ) => Array; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export type SomeString = string; + +export interface Spec extends TurboModule { + readonly getArray: (arg: Array) => Array; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_COMPLEX_ARRAY = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getArray: ( + arg: Array>>>>, + ) => Array>>; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_PROMISE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export type String = string; +export type SomeObj = { a: string }; + +export interface Spec extends TurboModule { + readonly getValueWithPromise: () => Promise; + readonly getValueWithPromiseDefinedSomewhereElse: () => Promise; + readonly getValueWithPromiseObjDefinedSomewhereElse: () => Promise; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const NATIVE_MODULE_WITH_CALLBACK = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule { + readonly getValueWithCallback: ( + callback: (value: string, arr: Array>) => void, + ) => void; +} + +export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); +`; + +const ANDROID_ONLY_NATIVE_MODULE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule {} + +export default TurboModuleRegistry.getEnforcing( + 'SampleTurboModuleAndroid', +); +`; + +const IOS_ONLY_NATIVE_MODULE = ` +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport'; +import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry'; + +export interface Spec extends TurboModule {} + +export default TurboModuleRegistry.getEnforcing( + 'SampleTurboModuleIOS', +); +`; + +module.exports = { + NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY, + NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE, + NATIVE_MODULE_WITH_FLOAT_AND_INT32, + NATIVE_MODULE_WITH_ALIASES, + NATIVE_MODULE_WITH_NESTED_ALIASES, + NATIVE_MODULE_WITH_PROMISE, + NATIVE_MODULE_WITH_COMPLEX_OBJECTS, + NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY, + NATIVE_MODULE_WITH_SIMPLE_OBJECT, + NATIVE_MODULE_WITH_UNSAFE_OBJECT, + NATIVE_MODULE_WITH_ROOT_TAG, + NATIVE_MODULE_WITH_NULLABLE_PARAM, + NATIVE_MODULE_WITH_BASIC_ARRAY, + NATIVE_MODULE_WITH_COMPLEX_ARRAY, + NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS, + NATIVE_MODULE_WITH_BASIC_PARAM_TYPES, + NATIVE_MODULE_WITH_CALLBACK, + EMPTY_NATIVE_MODULE, + ANDROID_ONLY_NATIVE_MODULE, + IOS_ONLY_NATIVE_MODULE, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap new file mode 100644 index 000000000000..922ee9269495 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap @@ -0,0 +1,1334 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`RN Codegen TypeScript Parser Fails with error message NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT 1`] = `"Module NativeSampleTurboModule: Generic 'Array' must have type parameters."`; + +exports[`RN Codegen TypeScript Parser Fails with error message NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM 1`] = `"Module NativeSampleTurboModule: Generic 'Array' must have type parameters."`; + +exports[`RN Codegen TypeScript Parser Fails with error message NATIVE_MODULES_WITH_NOT_ONLY_METHODS 1`] = `"Module NativeSampleTurboModule: TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's. Property 'sampleBool' refers to a 'TSBooleanKeyword'."`; + +exports[`RN Codegen TypeScript Parser Fails with error message NATIVE_MODULES_WITH_PROMISE_WITHOUT_TYPE 1`] = `"Module NativeSampleTurboModule: Generic 'Promise' must have type parameters."`; + +exports[`RN Codegen TypeScript Parser Fails with error message NATIVE_MODULES_WITH_UNNAMED_PARAMS 1`] = `"Module NativeSampleTurboModule: All function parameters must be named."`; + +exports[`RN Codegen TypeScript Parser Fails with error message TWO_NATIVE_EXTENDING_TURBO_MODULE 1`] = `"Module NativeSampleTurboModule: Every NativeModule spec file must declare exactly one NativeModule TypeScript interface. This file declares 2: 'Spec', and 'Spec2'. Please remove the extraneous TypeScript interface declarations."`; + +exports[`RN Codegen TypeScript Parser Fails with error message TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT 1`] = `"Module NativeSampleTurboModule: No TypeScript interfaces extending TurboModule were detected in this NativeModule spec."`; + +exports[`RN Codegen TypeScript Parser can generate fixture ANDROID_ONLY_NATIVE_MODULE 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [] + }, + 'moduleNames': [ + 'SampleTurboModuleAndroid' + ], + 'excludedPlatforms': [ + 'iOS' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture EMPTY_NATIVE_MODULE 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture IOS_ONLY_NATIVE_MODULE 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [] + }, + 'moduleNames': [ + 'SampleTurboModuleIOS' + ], + 'excludedPlatforms': [ + 'android' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_ALIASES 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': { + 'ObjectAlias': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'x', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + }, + { + 'name': 'y', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + }, + { + 'name': 'label', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'truthy', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + 'spec': { + 'properties': [ + { + 'name': 'getNumber', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'getVoid', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [] + } + }, + { + 'name': 'getArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'a', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + } + ] + }, + 'params': [ + { + 'name': 'a', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'NumberTypeAnnotation' + } + } + } + ] + } + }, + { + 'name': 'getStringFromAlias', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'StringTypeAnnotation' + }, + 'params': [ + { + 'name': 'a', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'ObjectAlias' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_ARRAY_WITH_ALIAS 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_ARRAY_WITH_UNION_AND_TOUPLE 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ArrayTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_BASIC_ARRAY 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + ] + } + }, + { + 'name': 'getArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_BASIC_PARAM_TYPES 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'passBool', + 'optional': true, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'passNumber', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'passString', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + }, + { + 'name': 'passStringish', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_CALLBACK 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getValueWithCallback', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'callback', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'value', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'arr', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + } + ] + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_COMPLEX_ARRAY 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'StringTypeAnnotation' + } + } + } + } + } + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_COMPLEX_OBJECTS 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getObject', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + } + ] + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + } + ] + } + } + ] + } + }, + { + 'name': 'getReadOnlyObject', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + } + ] + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + } + ] + } + } + ] + } + }, + { + 'name': 'getObject2', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'GenericObjectTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'a', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + } + } + ] + } + }, + { + 'name': 'getObjectInArray', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ArrayTypeAnnotation', + 'elementType': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + } + ] + } + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'const1', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_COMPLEX_OBJECTS_WITH_NULLABLE_KEY 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getConstants', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'isTesting', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'reactNativeVersion', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'major', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + }, + { + 'name': 'minor', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + }, + { + 'name': 'patch', + 'optional': true, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + }, + { + 'name': 'prerelease', + 'optional': false, + 'typeAnnotation': { + 'type': 'NullableTypeAnnotation', + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + } + } + ] + } + }, + { + 'name': 'forceTouchAvailable', + 'optional': false, + 'typeAnnotation': { + 'type': 'BooleanTypeAnnotation' + } + }, + { + 'name': 'osVersion', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'systemName', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + }, + { + 'name': 'interfaceIdiom', + 'optional': false, + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + ] + }, + 'params': [] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_FLOAT_AND_INT32 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getInt', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'Int32TypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'Int32TypeAnnotation' + } + } + ] + } + }, + { + 'name': 'getFloat', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'FloatTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'FloatTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_NESTED_ALIASES 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': { + 'Bar': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'z', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + } + ] + }, + 'Foo': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'bar1', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'Bar' + } + }, + { + 'name': 'bar2', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'Bar' + } + } + ] + } + }, + 'spec': { + 'properties': [ + { + 'name': 'foo1', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'Foo' + }, + 'params': [ + { + 'name': 'x', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'Foo' + } + } + ] + } + }, + { + 'name': 'foo2', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'x', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'Foo' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_NULLABLE_PARAM 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'voidFunc', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'VoidTypeAnnotation' + }, + 'params': [ + { + 'name': 'arg', + 'optional': false, + 'typeAnnotation': { + 'type': 'NullableTypeAnnotation', + 'typeAnnotation': { + 'type': 'StringTypeAnnotation' + } + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_OBJECT_WITH_OBJECT_DEFINED_IN_FILE_AS_PROPERTY 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': { + 'DisplayMetricsAndroid': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'width', + 'optional': false, + 'typeAnnotation': { + 'type': 'NumberTypeAnnotation' + } + } + ] + } + }, + 'spec': { + 'properties': [ + { + 'name': 'getConstants', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'Dimensions', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'windowPhysicalPixels', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'DisplayMetricsAndroid' + } + } + ] + } + } + ] + }, + 'params': [] + } + }, + { + 'name': 'getConstants2', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'Dimensions', + 'optional': false, + 'typeAnnotation': { + 'type': 'ObjectTypeAnnotation', + 'properties': [ + { + 'name': 'windowPhysicalPixels', + 'optional': false, + 'typeAnnotation': { + 'type': 'TypeAliasTypeAnnotation', + 'name': 'DisplayMetricsAndroid' + } + } + ] + } + } + ] + }, + 'params': [] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_PROMISE 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getValueWithPromise', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'PromiseTypeAnnotation' + }, + 'params': [] + } + }, + { + 'name': 'getValueWithPromiseDefinedSomewhereElse', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'PromiseTypeAnnotation' + }, + 'params': [] + } + }, + { + 'name': 'getValueWithPromiseObjDefinedSomewhereElse', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'PromiseTypeAnnotation' + }, + 'params': [] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_ROOT_TAG 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getRootTag', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'ReservedTypeAnnotation', + 'name': 'RootTag' + }, + 'params': [ + { + 'name': 'rootTag', + 'optional': false, + 'typeAnnotation': { + 'type': 'ReservedTypeAnnotation', + 'name': 'RootTag' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_SIMPLE_OBJECT 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getObject', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'GenericObjectTypeAnnotation' + }, + 'params': [ + { + 'name': 'o', + 'optional': false, + 'typeAnnotation': { + 'type': 'GenericObjectTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; + +exports[`RN Codegen TypeScript Parser can generate fixture NATIVE_MODULE_WITH_UNSAFE_OBJECT 1`] = ` +"{ + 'modules': { + 'NativeSampleTurboModule': { + 'type': 'NativeModule', + 'aliases': {}, + 'spec': { + 'properties': [ + { + 'name': 'getUnsafeObject', + 'optional': false, + 'typeAnnotation': { + 'type': 'FunctionTypeAnnotation', + 'returnTypeAnnotation': { + 'type': 'GenericObjectTypeAnnotation' + }, + 'params': [ + { + 'name': 'o', + 'optional': false, + 'typeAnnotation': { + 'type': 'GenericObjectTypeAnnotation' + } + } + ] + } + } + ] + }, + 'moduleNames': [ + 'SampleTurboModule' + ] + } + } +}" +`; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js new file mode 100644 index 000000000000..caa2043ca55c --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-e2e-test.js @@ -0,0 +1,1242 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import type { + NativeModuleReturnTypeAnnotation, + NativeModuleBaseTypeAnnotation, + NativeModuleSchema, + NativeModuleParamTypeAnnotation, +} from '../../../../CodegenSchema'; + +const {parseString} = require('../../index.js'); +const {unwrapNullable} = require('../utils'); +const { + UnsupportedTypeScriptGenericParserError, + UnsupportedTypeScriptTypeAnnotationParserError, + UnnamedFunctionParamParserError, + IncorrectlyParameterizedTypeScriptGenericParserError, +} = require('../errors'); +const invariant = require('invariant'); + +type PrimitiveTypeAnnotationType = + | 'StringTypeAnnotation' + | 'NumberTypeAnnotation' + | 'Int32TypeAnnotation' + | 'DoubleTypeAnnotation' + | 'FloatTypeAnnotation' + | 'BooleanTypeAnnotation'; + +const PRIMITIVES: $ReadOnlyArray<[string, PrimitiveTypeAnnotationType]> = [ + ['string', 'StringTypeAnnotation'], + ['number', 'NumberTypeAnnotation'], + ['Int32', 'Int32TypeAnnotation'], + ['Double', 'DoubleTypeAnnotation'], + ['Float', 'FloatTypeAnnotation'], + ['boolean', 'BooleanTypeAnnotation'], +]; + +const RESERVED_FUNCTION_VALUE_TYPE_NAME: $ReadOnlyArray<'RootTag'> = [ + 'RootTag', +]; + +const MODULE_NAME = 'NativeFoo'; + +const TYPE_ALIAS_DECLARATIONS = ` +type Animal = { + name: string; +}; + +type AnimalPointer = Animal; +`; + +function expectAnimalTypeAliasToExist(module: NativeModuleSchema) { + const animalAlias = module.aliases.Animal; + + expect(animalAlias).not.toBe(null); + invariant(animalAlias != null, ''); + expect(animalAlias.type).toBe('ObjectTypeAnnotation'); + expect(animalAlias.properties.length).toBe(1); + expect(animalAlias.properties[0].name).toBe('name'); + expect(animalAlias.properties[0].optional).toBe(false); + + const [typeAnnotation, nullable] = unwrapNullable( + animalAlias.properties[0].typeAnnotation, + ); + + expect(typeAnnotation.type).toBe('StringTypeAnnotation'); + expect(nullable).toBe(false); +} + +describe('TypeScript Module Parser', () => { + describe('Parameter Parsing', () => { + it("should fail parsing when a method has an parameter of type 'any'", () => { + const parser = () => + parseModule(` + import type {TurboModule} from 'RCTExport'; + import * as TurboModuleRegistry from 'TurboModuleRegistry'; + export interface Spec extends TurboModule { + useArg(arg: any): void; + } + export default TurboModuleRegistry.get('Foo'); + `); + + expect(parser).toThrow(UnsupportedTypeScriptTypeAnnotationParserError); + }); + + it('should fail parsing when a function param type is unamed', () => { + const parser = () => + parseModule(` + import type {TurboModule} from 'RCTExport'; + import * as TurboModuleRegistry from 'TurboModuleRegistry'; + export interface Spec extends TurboModule { + useArg(boolean): void; + } + export default TurboModuleRegistry.get('Foo'); + `); + + expect(parser).toThrow(UnnamedFunctionParamParserError); + }); + + [ + {nullable: false, optional: false}, + {nullable: false, optional: true}, + {nullable: true, optional: false}, + {nullable: true, optional: true}, + ].forEach(({nullable, optional}) => { + const PARAM_TYPE_DESCRIPTION = + nullable && optional + ? 'a nullable and optional' + : nullable + ? 'a nullable' + : optional + ? 'an optional' + : 'a required'; + + function annotateArg(paramName: string, paramType: string) { + if (nullable && optional) { + return `${paramName}?: ${paramType} | null | void`; + } + if (nullable) { + return `${paramName}: ${paramType} | null | void`; + } + if (optional) { + return `${paramName}?: ${paramType}`; + } + return `${paramName}: ${paramType}`; + } + + function parseParamType( + paramName: string, + paramType: string, + ): [NativeModuleParamTypeAnnotation, NativeModuleSchema] { + const module = parseModule(` + import type {TurboModule} from 'RCTExport'; + import * as TurboModuleRegistry from 'TurboModuleRegistry'; + + ${TYPE_ALIAS_DECLARATIONS} + + export interface Spec extends TurboModule { + useArg(${annotateArg(paramName, paramType)}): void; + } + export default TurboModuleRegistry.get('Foo'); + `); + + expect(module.spec.properties[0]).not.toBe(null); + const param = unwrapNullable( + module.spec.properties[0].typeAnnotation, + )[0].params[0]; + expect(param).not.toBe(null); + expect(param.name).toBe(paramName); + expect(param.optional).toBe(optional); + const [paramTypeAnnotation, isParamTypeAnnotationNullable] = + unwrapNullable(param.typeAnnotation); + expect(isParamTypeAnnotationNullable).toBe(nullable); + + return [paramTypeAnnotation, module]; + } + + describe( + (nullable && optional + ? 'Nullable and Optional' + : nullable + ? 'Nullable' + : optional + ? 'Optional' + : 'Required') + ' Parameter', + () => { + it(`should not parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Function'`, () => { + expect(() => parseParamType('arg', 'Function')).toThrow( + UnsupportedTypeScriptGenericParserError, + ); + }); + + describe('Primitive types', () => { + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} primitive parameter of type '${FLOW_TYPE}'`, () => { + const [paramTypeAnnotation] = parseParamType('arg', FLOW_TYPE); + expect(paramTypeAnnotation.type).toBe(PARSED_TYPE_NAME); + }); + }); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Object'`, () => { + const [paramTypeAnnotation] = parseParamType('arg', 'Object'); + expect(paramTypeAnnotation.type).toBe( + 'GenericObjectTypeAnnotation', + ); + }); + + describe('Reserved Types', () => { + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of reserved type '${FLOW_TYPE}'`, () => { + const [paramTypeAnnotation] = parseParamType('arg', FLOW_TYPE); + + expect(paramTypeAnnotation.type).toBe('ReservedTypeAnnotation'); + invariant( + paramTypeAnnotation.type === 'ReservedTypeAnnotation', + 'Param must be a Reserved type', + ); + + expect(paramTypeAnnotation.name).toBe(FLOW_TYPE); + }); + }); + }); + + describe('Array Types', () => { + it(`should not parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Array'`, () => { + expect(() => parseParamType('arg', 'Array')).toThrow( + IncorrectlyParameterizedTypeScriptGenericParserError, + ); + }); + + function parseParamArrayElementType( + paramName: string, + paramType: string, + ): [NativeModuleBaseTypeAnnotation, NativeModuleSchema] { + const [paramTypeAnnotation, module] = parseParamType( + paramName, + `Array<${paramType}>`, + ); + + expect(paramTypeAnnotation.type).toBe('ArrayTypeAnnotation'); + invariant(paramTypeAnnotation.type === 'ArrayTypeAnnotation', ''); + + expect(paramTypeAnnotation.elementType).not.toBe(null); + invariant(paramTypeAnnotation.elementType != null, ''); + const [elementType, isElementTypeNullable] = + unwrapNullable( + paramTypeAnnotation.elementType, + ); + expect(isElementTypeNullable).toBe(false); + return [elementType, module]; + } + + // TODO: Do we support nullable element types? + + describe('Primitive Element Types', () => { + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseParamArrayElementType( + 'arg', + FLOW_TYPE, + ); + expect(elementType.type).toBe(PARSED_TYPE_NAME); + }); + }); + }); + + describe('Reserved Element Types', () => { + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseParamArrayElementType( + 'arg', + FLOW_TYPE, + ); + expect(elementType.type).toBe('ReservedTypeAnnotation'); + invariant(elementType.type === 'ReservedTypeAnnotation', ''); + + expect(elementType.name).toBe(FLOW_TYPE); + }); + }); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Array'`, () => { + const [elementType] = parseParamArrayElementType('arg', 'Object'); + expect(elementType.type).toBe('GenericObjectTypeAnnotation'); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of some array of an alias`, () => { + const [elementType, module] = parseParamArrayElementType( + 'arg', + 'Animal', + ); + expect(elementType.type).toBe('TypeAliasTypeAnnotation'); + invariant(elementType.type === 'TypeAliasTypeAnnotation', ''); + + expect(elementType.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Array<{foo: string | null | void}>'`, () => { + const [elementType] = parseParamArrayElementType( + 'arg', + '{foo: string | null | void}', + ); + expect(elementType).not.toBe(null); + + expect(elementType.type).toBe('ObjectTypeAnnotation'); + invariant(elementType.type === 'ObjectTypeAnnotation', ''); + + const {properties} = elementType; + invariant(properties != null, ''); + + expect(properties).not.toBe(null); + expect(properties[0]).not.toBe(null); + expect(properties[0].name).toBe('foo'); + expect(properties[0].typeAnnotation).not.toBe(null); + + const [typeAnnotation, isPropertyNullable] = unwrapNullable( + properties[0].typeAnnotation, + ); + + expect(typeAnnotation.type).toBe('StringTypeAnnotation'); + expect(isPropertyNullable).toBe(true); + expect(properties[0].optional).toBe(false); + }); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of some type alias`, () => { + const [paramTypeAnnotation, module] = parseParamType( + 'arg', + 'Animal', + ); + expect(paramTypeAnnotation.type).toBe('TypeAliasTypeAnnotation'); + invariant( + paramTypeAnnotation.type === 'TypeAliasTypeAnnotation', + '', + ); + + expect(paramTypeAnnotation.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of some type alias that points to another type alias`, () => { + const [paramTypeAnnotation, module] = parseParamType( + 'arg', + 'AnimalPointer', + ); + expect(paramTypeAnnotation.type).toBe('TypeAliasTypeAnnotation'); + invariant( + paramTypeAnnotation.type === 'TypeAliasTypeAnnotation', + '', + ); + + expect(paramTypeAnnotation.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of some type alias that points to another nullable type alias`, () => { + const module = parseModule(` + import type {TurboModule} from 'RCTExport'; + import * as TurboModuleRegistry from 'TurboModuleRegistry'; + + type Animal = { + name: string, + } | null | void; + + type AnimalPointer = Animal; + + export interface Spec extends TurboModule { + useArg(${annotateArg('arg', 'AnimalPointer')}): void; + } + export default TurboModuleRegistry.get('Foo'); + `); + + expect(module.spec.properties[0]).not.toBe(null); + const param = unwrapNullable( + module.spec.properties[0].typeAnnotation, + )[0].params[0]; + expect(param.name).toBe('arg'); + expect(param.optional).toBe(optional); + + // The TypeAliasAnnotation is called Animal, and is nullable + const [paramTypeAnnotation, isParamTypeAnnotationNullable] = + unwrapNullable(param.typeAnnotation); + expect(paramTypeAnnotation.type).toBe('TypeAliasTypeAnnotation'); + invariant( + paramTypeAnnotation.type === 'TypeAliasTypeAnnotation', + '', + ); + expect(paramTypeAnnotation.name).toBe('Animal'); + expect(isParamTypeAnnotationNullable).toBe(true); + + // The Animal type alias RHS is valid, and non-null + expectAnimalTypeAliasToExist(module); + }); + + [ + {nullable: false, optional: false}, + {nullable: false, optional: true}, + {nullable: true, optional: false}, + {nullable: true, optional: true}, + ].forEach(({nullable: isPropNullable, optional: isPropOptional}) => { + const PROP_TYPE_DESCRIPTION = + isPropNullable && isPropOptional + ? 'a nullable and optional' + : isPropNullable + ? 'a nullable' + : isPropOptional + ? 'an optional' + : 'a required'; + + function annotateProp(propName: string, propType: string) { + if (isPropNullable && isPropOptional) { + return `${propName}?: ${propType} | null | void`; + } + if (isPropNullable) { + return `${propName}: ${propType} | null | void`; + } + if (isPropOptional) { + return `${propName}?: ${propType}`; + } + return `${propName}: ${propType}`; + } + + function parseParamTypeObjectLiteralProp( + propName: string, + propType: string, + ): [ + $ReadOnly<{ + name: string, + optional: boolean, + typeAnnotation: NativeModuleBaseTypeAnnotation, + }>, + NativeModuleSchema, + ] { + const [paramTypeAnnotation, module] = parseParamType( + 'arg', + `{${annotateProp(propName, propType)}}`, + ); + + expect(paramTypeAnnotation.type).toBe('ObjectTypeAnnotation'); + invariant( + paramTypeAnnotation.type === 'ObjectTypeAnnotation', + '', + ); + + const {properties} = paramTypeAnnotation; + + expect(properties).not.toBe(null); + invariant(properties != null, ''); + + expect(properties.length).toBe(1); + expect(properties[0].name).toBe(propName); + expect(properties[0].optional).toBe(isPropOptional); + + const [propertyTypeAnnotation, isPropertyTypeAnnotationNullable] = + unwrapNullable(properties[0].typeAnnotation); + + expect(propertyTypeAnnotation).not.toBe(null); + expect(isPropertyTypeAnnotationNullable).toBe(isPropNullable); + + return [ + { + ...properties[0], + typeAnnotation: propertyTypeAnnotation, + }, + module, + ]; + } + + describe( + (isPropNullable && isPropOptional + ? 'Nullable and Optional' + : isPropNullable + ? 'Nullable' + : isPropOptional + ? 'Optional' + : 'Required') + ' Property', + () => { + describe('Props with Primitive Types', () => { + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of primitive type '${FLOW_TYPE}'`, () => { + const [prop] = parseParamTypeObjectLiteralProp( + 'prop', + FLOW_TYPE, + ); + expect(prop.typeAnnotation.type).toBe(PARSED_TYPE_NAME); + }); + }); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Object'`, () => { + const [prop] = parseParamTypeObjectLiteralProp( + 'prop', + 'Object', + ); + expect(prop.typeAnnotation.type).toBe( + 'GenericObjectTypeAnnotation', + ); + }); + + describe('Props with Reserved Types', () => { + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of reserved type '${FLOW_TYPE}'`, () => { + const [prop] = parseParamTypeObjectLiteralProp( + 'prop', + FLOW_TYPE, + ); + expect(prop.typeAnnotation.type).toBe( + 'ReservedTypeAnnotation', + ); + invariant( + prop.typeAnnotation.type === 'ReservedTypeAnnotation', + '', + ); + + expect(prop.typeAnnotation.name).toBe(FLOW_TYPE); + }); + }); + }); + + describe('Props with Array Types', () => { + it(`should not parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array`, () => { + expect(() => + parseParamTypeObjectLiteralProp('prop', 'Array'), + ).toThrow( + IncorrectlyParameterizedTypeScriptGenericParserError, + ); + }); + + function parseArrayElementType( + propName: string, + arrayElementType: string, + ): [NativeModuleBaseTypeAnnotation, NativeModuleSchema] { + const [property, module] = parseParamTypeObjectLiteralProp( + 'propName', + `Array<${arrayElementType}>`, + ); + expect(property.typeAnnotation.type).toBe( + 'ArrayTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === 'ArrayTypeAnnotation', + '', + ); + + const {elementType: nullableElementType} = + property.typeAnnotation; + expect(nullableElementType).not.toBe(null); + invariant(nullableElementType != null, ''); + + const [elementType, isElementTypeNullable] = + unwrapNullable( + nullableElementType, + ); + + expect(isElementTypeNullable).toBe(false); + + return [elementType, module]; + } + + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + FLOW_TYPE, + ); + + expect(elementType.type).toBe(PARSED_TYPE_NAME); + }); + }); + + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + FLOW_TYPE, + ); + + expect(elementType.type).toBe('ReservedTypeAnnotation'); + invariant( + elementType.type === 'ReservedTypeAnnotation', + '', + ); + expect(elementType.name).toBe(FLOW_TYPE); + }); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + 'Object', + ); + expect(elementType.type).toBe( + 'GenericObjectTypeAnnotation', + ); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type of some array of an alias`, () => { + const [elementType, module] = parseArrayElementType( + 'prop', + 'Animal', + ); + + expect(elementType.type).toBe('TypeAliasTypeAnnotation'); + invariant( + elementType.type === 'TypeAliasTypeAnnotation', + '', + ); + + expect(elementType.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of 'Array<{foo: string | null | void}>'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + '{foo: string | null | void}', + ); + + expect(elementType.type).toBe('ObjectTypeAnnotation'); + invariant(elementType.type === 'ObjectTypeAnnotation', ''); + + const {properties} = elementType; + expect(properties).not.toBe(null); + invariant(properties != null, ''); + + expect(properties[0]).not.toBe(null); + expect(properties[0].name).toBe('foo'); + expect(properties[0].typeAnnotation).not.toBe(null); + + const [ + propertyTypeAnnotation, + isPropertyTypeAnnotationNullable, + ] = unwrapNullable(properties[0].typeAnnotation); + + expect(propertyTypeAnnotation.type).toBe( + 'StringTypeAnnotation', + ); + expect(isPropertyTypeAnnotationNullable).toBe(true); + expect(properties[0].optional).toBe(false); + }); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type '{foo: string | null | void}'`, () => { + const [property] = parseParamTypeObjectLiteralProp( + 'prop', + '{foo: string | null | void}', + ); + + expect(property.typeAnnotation.type).toBe( + 'ObjectTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === 'ObjectTypeAnnotation', + '', + ); + + const {properties} = property.typeAnnotation; + expect(properties).not.toBe(null); + invariant(properties != null, ''); + + expect(properties[0]).not.toBe(null); + expect(properties[0].name).toBe('foo'); + + const [ + propertyTypeAnnotation, + isPropertyTypeAnnotationNullable, + ] = unwrapNullable(properties[0].typeAnnotation); + + expect(propertyTypeAnnotation.type).toBe( + 'StringTypeAnnotation', + ); + expect(isPropertyTypeAnnotationNullable).toBe(true); + expect(properties[0].optional).toBe(false); + }); + + it(`should parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of some type alias`, () => { + const [property, module] = parseParamTypeObjectLiteralProp( + 'prop', + 'Animal', + ); + + expect(property.typeAnnotation.type).toBe( + 'TypeAliasTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === 'TypeAliasTypeAnnotation', + '', + ); + + expect(property.typeAnnotation.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + }, + ); + }); + }, + ); + }); + }); + + describe('Return Parsing', () => { + it('should parse methods that have a return type of void', () => { + const module = parseModule(` + import type {TurboModule} from 'RCTExport'; + import * as TurboModuleRegistry from 'TurboModuleRegistry'; + export interface Spec extends TurboModule { + useArg(): void; + } + export default TurboModuleRegistry.get('Foo'); + `); + + expect(module.spec.properties[0]).not.toBe(null); + + const [functionTypeAnnotation, isFunctionTypeAnnotationNullable] = + unwrapNullable(module.spec.properties[0].typeAnnotation); + expect(isFunctionTypeAnnotationNullable).toBe(false); + + const [returnTypeAnnotation, isReturnTypeAnnotationNullable] = + unwrapNullable(functionTypeAnnotation.returnTypeAnnotation); + expect(returnTypeAnnotation.type).toBe('VoidTypeAnnotation'); + expect(isReturnTypeAnnotationNullable).toBe(false); + }); + + [true, false].forEach(IS_RETURN_TYPE_NULLABLE => { + const RETURN_TYPE_DESCRIPTION = IS_RETURN_TYPE_NULLABLE + ? 'a nullable' + : 'a non-nullable'; + const annotateRet = retType => + IS_RETURN_TYPE_NULLABLE ? `${retType} | null | void` : retType; + + function parseReturnType( + flowType: string, + ): [NativeModuleReturnTypeAnnotation, NativeModuleSchema] { + const module = parseModule(` + import type {TurboModule} from 'RCTExport'; + import * as TurboModuleRegistry from 'TurboModuleRegistry'; + + ${TYPE_ALIAS_DECLARATIONS} + + export interface Spec extends TurboModule { + useArg(): ${annotateRet(flowType)}; + } + export default TurboModuleRegistry.get('Foo'); + `); + + expect(module.spec.properties[0]).not.toBe(null); + const [functionTypeAnnotation, isFunctionTypeAnnotationNullable] = + unwrapNullable(module.spec.properties[0].typeAnnotation); + expect(isFunctionTypeAnnotationNullable).toBe(false); + + const [returnTypeAnnotation, isReturnTypeAnnotationNullable] = + unwrapNullable(functionTypeAnnotation.returnTypeAnnotation); + expect(isReturnTypeAnnotationNullable).toBe(IS_RETURN_TYPE_NULLABLE); + + return [returnTypeAnnotation, module]; + } + + describe( + IS_RETURN_TYPE_NULLABLE ? 'Nullable Returns' : 'Non-Nullable Returns', + () => { + ['Promise', 'Promise<{}>'].forEach(promiseFlowType => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type '${promiseFlowType}'`, () => { + const [returnTypeAnnotation] = parseReturnType(promiseFlowType); + expect(returnTypeAnnotation.type).toBe('PromiseTypeAnnotation'); + }); + }); + + describe('Primitive Types', () => { + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} primitive return of type '${FLOW_TYPE}'`, () => { + const [returnTypeAnnotation] = parseReturnType(FLOW_TYPE); + expect(returnTypeAnnotation.type).toBe(PARSED_TYPE_NAME); + }); + }); + }); + + describe('Reserved Types', () => { + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} reserved return of type '${FLOW_TYPE}'`, () => { + const [returnTypeAnnotation] = parseReturnType(FLOW_TYPE); + expect(returnTypeAnnotation.type).toBe( + 'ReservedTypeAnnotation', + ); + invariant( + returnTypeAnnotation.type === 'ReservedTypeAnnotation', + '', + ); + expect(returnTypeAnnotation.name).toBe(FLOW_TYPE); + }); + }); + }); + + describe('Array Types', () => { + it(`should not parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array'`, () => { + expect(() => parseReturnType('Array')).toThrow( + IncorrectlyParameterizedTypeScriptGenericParserError, + ); + }); + + function parseArrayElementReturnType( + flowType: string, + ): [NativeModuleBaseTypeAnnotation, NativeModuleSchema] { + const [returnTypeAnnotation, module] = parseReturnType( + 'Array' + (flowType != null ? `<${flowType}>` : ''), + ); + expect(returnTypeAnnotation.type).toBe('ArrayTypeAnnotation'); + invariant( + returnTypeAnnotation.type === 'ArrayTypeAnnotation', + '', + ); + + const arrayTypeAnnotation = returnTypeAnnotation; + + const {elementType} = arrayTypeAnnotation; + expect(elementType).not.toBe(null); + invariant(elementType != null, ''); + + const [elementTypeAnnotation, isElementTypeAnnotation] = + unwrapNullable(elementType); + expect(isElementTypeAnnotation).toBe(false); + + return [elementTypeAnnotation, module]; + } + + // TODO: Do we support nullable element types? + + describe('Primitive Element Types', () => { + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseArrayElementReturnType(FLOW_TYPE); + expect(elementType.type).toBe(PARSED_TYPE_NAME); + }); + }); + }); + + describe('Reserved Element Types', () => { + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseArrayElementReturnType(FLOW_TYPE); + expect(elementType.type).toBe('ReservedTypeAnnotation'); + invariant(elementType.type === 'ReservedTypeAnnotation', ''); + + expect(elementType.name).toBe(FLOW_TYPE); + }); + }); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array'`, () => { + const [elementType] = parseArrayElementReturnType('Object'); + expect(elementType.type).toBe('GenericObjectTypeAnnotation'); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of some array of an alias`, () => { + const [elementType, module] = + parseArrayElementReturnType('Animal'); + expect(elementType.type).toBe('TypeAliasTypeAnnotation'); + invariant(elementType.type === 'TypeAliasTypeAnnotation', ''); + expect(elementType.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Array<{foo: string | null | void}>'`, () => { + const [elementType] = parseArrayElementReturnType( + '{foo: string | null | void}', + ); + expect(elementType.type).toBe('ObjectTypeAnnotation'); + invariant(elementType.type === 'ObjectTypeAnnotation', ''); + + const {properties} = elementType; + expect(properties).not.toBe(null); + invariant(properties != null, ''); + + expect(properties[0]).not.toBe(null); + expect(properties[0].name).toBe('foo'); + expect(properties[0].typeAnnotation).not.toBe(null); + + const [propertyTypeAnnotation, isPropertyTypeAnnotationNullable] = + unwrapNullable(properties[0].typeAnnotation); + + expect(propertyTypeAnnotation.type).toBe('StringTypeAnnotation'); + expect(isPropertyTypeAnnotationNullable).toBe(true); + expect(properties[0].optional).toBe(false); + }); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of some type alias`, () => { + const [returnTypeAnnotation, module] = parseReturnType('Animal'); + expect(returnTypeAnnotation.type).toBe('TypeAliasTypeAnnotation'); + invariant( + returnTypeAnnotation.type === 'TypeAliasTypeAnnotation', + '', + ); + expect(returnTypeAnnotation.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should not parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Function'`, () => { + expect(() => parseReturnType('Function')).toThrow( + UnsupportedTypeScriptGenericParserError, + ); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return of type 'Object'`, () => { + const [returnTypeAnnotation] = parseReturnType('Object'); + expect(returnTypeAnnotation.type).toBe( + 'GenericObjectTypeAnnotation', + ); + }); + + describe('Object Literals Types', () => { + // TODO: Inexact vs exact object literals? + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an empty object literal`, () => { + const [returnTypeAnnotation] = parseReturnType('{}'); + expect(returnTypeAnnotation.type).toBe('ObjectTypeAnnotation'); + invariant( + returnTypeAnnotation.type === 'ObjectTypeAnnotation', + '', + ); + + // Validate properties of object literal + expect(returnTypeAnnotation.properties).not.toBe(null); + expect(returnTypeAnnotation.properties?.length).toBe(0); + }); + + [ + {nullable: false, optional: false}, + {nullable: false, optional: true}, + {nullable: true, optional: false}, + {nullable: true, optional: true}, + ].forEach(({nullable, optional}) => { + const PROP_TYPE_DESCRIPTION = + nullable && optional + ? 'a nullable and optional' + : nullable + ? 'a nullable' + : optional + ? 'an optional' + : 'a required'; + + function annotateProp(propName, propType) { + if (nullable && optional) { + return `${propName}?: ${propType} | null | void`; + } + if (nullable) { + return `${propName}: ${propType} | null | void`; + } + if (optional) { + return `${propName}?: ${propType}`; + } + return `${propName}: ${propType}`; + } + + function parseObjectLiteralReturnTypeProp( + propName: string, + propType: string, + ): [ + $ReadOnly<{ + name: string, + optional: boolean, + typeAnnotation: NativeModuleBaseTypeAnnotation, + }>, + NativeModuleSchema, + ] { + const [returnTypeAnnotation, module] = parseReturnType( + `{${annotateProp(propName, propType)}}`, + ); + expect(returnTypeAnnotation.type).toBe('ObjectTypeAnnotation'); + invariant( + returnTypeAnnotation.type === 'ObjectTypeAnnotation', + '', + ); + + const properties = returnTypeAnnotation.properties; + expect(properties).not.toBe(null); + invariant(properties != null, ''); + + expect(properties.length).toBe(1); + + // Validate property + const property = properties[0]; + expect(property.name).toBe(propName); + expect(property.optional).toBe(optional); + + const [ + propertyTypeAnnotation, + isPropertyTypeAnnotationNullable, + ] = unwrapNullable(property.typeAnnotation); + + expect(propertyTypeAnnotation).not.toBe(null); + expect(isPropertyTypeAnnotationNullable).toBe(nullable); + return [ + { + ...property, + typeAnnotation: propertyTypeAnnotation, + }, + module, + ]; + } + + describe( + (nullable && optional + ? 'Nullable and Optional' + : nullable + ? 'Nullable' + : optional + ? 'Optional' + : 'Required') + ' Property', + () => { + /** + * TODO: Fill out props in promise + */ + + describe('Props with Primitive Types', () => { + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of primitive type '${FLOW_TYPE}'`, () => { + const [property] = parseObjectLiteralReturnTypeProp( + 'prop', + FLOW_TYPE, + ); + expect(property.typeAnnotation.type).toBe( + PARSED_TYPE_NAME, + ); + }); + }); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Object'`, () => { + const [property] = parseObjectLiteralReturnTypeProp( + 'prop', + 'Object', + ); + + expect(property.typeAnnotation.type).toBe( + 'GenericObjectTypeAnnotation', + ); + }); + + describe('Props with Reserved Types', () => { + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of reserved type '${FLOW_TYPE}'`, () => { + const [property] = parseObjectLiteralReturnTypeProp( + 'prop', + FLOW_TYPE, + ); + + expect(property.typeAnnotation.type).toBe( + 'ReservedTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === + 'ReservedTypeAnnotation', + '', + ); + + expect(property.typeAnnotation.name).toBe(FLOW_TYPE); + }); + }); + }); + + describe('Props with Array Types', () => { + it(`should not parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array`, () => { + expect(() => + parseObjectLiteralReturnTypeProp('prop', 'Array'), + ).toThrow( + IncorrectlyParameterizedTypeScriptGenericParserError, + ); + }); + + function parseArrayElementType( + propName: string, + arrayElementType: string, + ): [NativeModuleBaseTypeAnnotation, NativeModuleSchema] { + const [property, module] = + parseObjectLiteralReturnTypeProp( + propName, + `Array<${arrayElementType}>`, + ); + expect(property.name).toBe(propName); + expect(property.typeAnnotation.type).toBe( + 'ArrayTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === 'ArrayTypeAnnotation', + '', + ); + + const {elementType: nullableElementType} = + property.typeAnnotation; + expect(nullableElementType).not.toBe(null); + invariant(nullableElementType != null, ''); + + const [elementType, isElementTypeNullable] = + unwrapNullable( + nullableElementType, + ); + expect(isElementTypeNullable).toBe(false); + + return [elementType, module]; + } + + PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + FLOW_TYPE, + ); + expect(elementType.type).toBe(PARSED_TYPE_NAME); + }); + }); + + RESERVED_FUNCTION_VALUE_TYPE_NAME.forEach(FLOW_TYPE => { + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array<${FLOW_TYPE}>'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + FLOW_TYPE, + ); + expect(elementType.type).toBe('ReservedTypeAnnotation'); + invariant( + elementType.type === 'ReservedTypeAnnotation', + '', + ); + + expect(elementType.name).toBe(FLOW_TYPE); + }); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + 'Object', + ); + expect(elementType).not.toBe(null); + expect(elementType.type).toBe( + 'GenericObjectTypeAnnotation', + ); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type of some array of an aliase`, () => { + const [elementType, module] = parseArrayElementType( + 'prop', + 'Animal', + ); + expect(elementType.type).toBe('TypeAliasTypeAnnotation'); + invariant( + elementType.type === 'TypeAliasTypeAnnotation', + '', + ); + expect(elementType.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of type 'Array<{foo: string | null | void}>'`, () => { + const [elementType] = parseArrayElementType( + 'prop', + '{foo: string | null | void}', + ); + expect(elementType.type).toBe('ObjectTypeAnnotation'); + invariant( + elementType.type === 'ObjectTypeAnnotation', + '', + ); + + const {properties} = elementType; + invariant(properties != null, ''); + expect(properties).not.toBe(null); + expect(properties[0]).not.toBe(null); + expect(properties[0].name).toBe('foo'); + expect(properties[0].optional).toBe(false); + + const [ + propertyTypeAnnotation, + isPropertyTypeAnnotationNullable, + ] = unwrapNullable(properties[0].typeAnnotation); + + expect(propertyTypeAnnotation.type).toBe( + 'StringTypeAnnotation', + ); + expect(isPropertyTypeAnnotationNullable).toBe(true); + }); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of '{foo: string | null | void}'`, () => { + const [property] = parseObjectLiteralReturnTypeProp( + 'prop', + '{foo: string | null | void}', + ); + + expect(property.typeAnnotation.type).toBe( + 'ObjectTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === 'ObjectTypeAnnotation', + '', + ); + + const {properties} = property.typeAnnotation; + + expect(properties).not.toBe(null); + invariant(properties != null, ''); + + expect(properties[0]).not.toBe(null); + expect(properties[0].name).toBe('foo'); + expect(properties[0].optional).toBe(false); + + const [ + propertyTypeAnnotation, + isPropertyTypeAnnotationNullable, + ] = unwrapNullable(properties[0].typeAnnotation); + + expect(propertyTypeAnnotation.type).toBe( + 'StringTypeAnnotation', + ); + expect(isPropertyTypeAnnotationNullable).toBe(true); + }); + + it(`should parse methods that have ${RETURN_TYPE_DESCRIPTION} return type of an object literal with ${PROP_TYPE_DESCRIPTION} prop of some type alias`, () => { + const [property, module] = parseObjectLiteralReturnTypeProp( + 'prop', + 'Animal', + ); + + expect(property.typeAnnotation.type).toBe( + 'TypeAliasTypeAnnotation', + ); + invariant( + property.typeAnnotation.type === + 'TypeAliasTypeAnnotation', + '', + ); + + expect(property.typeAnnotation.name).toBe('Animal'); + expectAnimalTypeAliasToExist(module); + }); + }, + ); + }); + }); + }, + ); + }); + }); +}); + +function parseModule(source) { + const schema = parseString(source, `${MODULE_NAME}.ts`); + const module = schema.modules.NativeFoo; + invariant( + module.type === 'NativeModule', + "'nativeModules' in Spec NativeFoo shouldn't be null", + ); + return module; +} diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js new file mode 100644 index 000000000000..371e6f7d9c6b --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/__tests__/typescript-module-parser-snapshot-test.js @@ -0,0 +1,45 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @emails oncall+react_native + * @flow strict-local + * @format + */ + +'use strict'; + +const TypeScriptParser = require('../../index.js'); +const fixtures = require('../__test_fixtures__/fixtures.js'); +const failureFixtures = require('../__test_fixtures__/failures.js'); +jest.mock('fs', () => ({ + readFileSync: filename => fixtures[filename] || failureFixtures[filename], +})); + +describe('RN Codegen TypeScript Parser', () => { + Object.keys(fixtures) + .sort() + .forEach(fixtureName => { + it(`can generate fixture ${fixtureName}`, () => { + const schema = TypeScriptParser.parseModuleFixture(fixtureName); + const serializedSchema = JSON.stringify(schema, null, 2).replace( + /"/g, + "'", + ); + + expect(serializedSchema).toMatchSnapshot(); + }); + }); + + Object.keys(failureFixtures) + .sort() + .forEach(fixtureName => { + it(`Fails with error message ${fixtureName}`, () => { + expect(() => { + TypeScriptParser.parseModuleFixture(fixtureName); + }).toThrowErrorMatchingSnapshot(); + }); + }); +}); diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/errors.js b/packages/react-native-codegen/src/parsers/typescript/modules/errors.js new file mode 100644 index 000000000000..357135d78757 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/errors.js @@ -0,0 +1,331 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +const invariant = require('invariant'); +const {ParserError} = require('../errors'); + +class MisnamedModuleTypeScriptInterfaceParserError extends ParserError { + constructor(hasteModuleName: string, id: $FlowFixMe) { + super( + hasteModuleName, + id, + `All TypeScript interfaces extending TurboModule must be called 'Spec'. Please rename TypeScript interface '${id.name}' to 'Spec'.`, + ); + } +} + +class ModuleTypeScriptInterfaceNotFoundParserError extends ParserError { + constructor(hasteModuleName: string, ast: $FlowFixMe) { + super( + hasteModuleName, + ast, + 'No TypeScript interfaces extending TurboModule were detected in this NativeModule spec.', + ); + } +} + +class MoreThanOneModuleTypeScriptInterfaceParserError extends ParserError { + constructor( + hasteModuleName: string, + flowModuleInterfaces: $ReadOnlyArray<$FlowFixMe>, + names: $ReadOnlyArray, + ) { + const finalName = names[names.length - 1]; + const allButLastName = names.slice(0, -1); + const quote = (x: string) => `'${x}'`; + + const nameStr = + allButLastName.map(quote).join(', ') + ', and ' + quote(finalName); + + super( + hasteModuleName, + flowModuleInterfaces, + `Every NativeModule spec file must declare exactly one NativeModule TypeScript interface. This file declares ${names.length}: ${nameStr}. Please remove the extraneous TypeScript interface declarations.`, + ); + } +} + +class UnsupportedModulePropertyParserError extends ParserError { + constructor( + hasteModuleName: string, + propertyValue: $FlowFixMe, + propertyName: string, + invalidPropertyValueType: string, + ) { + super( + hasteModuleName, + propertyValue, + `TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's. Property '${propertyName}' refers to a '${invalidPropertyValueType}'.`, + ); + } +} + +class UnsupportedTypeScriptTypeAnnotationParserError extends ParserError { + +typeAnnotationType: string; + constructor(hasteModuleName: string, typeAnnotation: $FlowFixMe) { + super( + hasteModuleName, + typeAnnotation, + `TypeScript type annotation '${typeAnnotation.type}' is unsupported in NativeModule specs.`, + ); + + this.typeAnnotationType = typeAnnotation.type; + } +} + +class UnsupportedTypeScriptGenericParserError extends ParserError { + +genericName: string; + constructor(hasteModuleName: string, genericTypeAnnotation: $FlowFixMe) { + const genericName = genericTypeAnnotation.typeName.name; + super( + hasteModuleName, + genericTypeAnnotation, + `Unrecognized generic type '${genericName}' in NativeModule spec.`, + ); + + this.genericName = genericName; + } +} + +class IncorrectlyParameterizedTypeScriptGenericParserError extends ParserError { + +genericName: string; + +numTypeParameters: number; + + constructor(hasteModuleName: string, genericTypeAnnotation: $FlowFixMe) { + if (genericTypeAnnotation.typeParameters == null) { + super( + hasteModuleName, + genericTypeAnnotation, + `Generic '${genericTypeAnnotation.typeName.name}' must have type parameters.`, + ); + return; + } + + if ( + genericTypeAnnotation.typeParameters.type === + 'TypeParameterInstantiation' && + genericTypeAnnotation.typeParameters.params.length !== 1 + ) { + super( + hasteModuleName, + genericTypeAnnotation.typeParameters, + `Generic '${genericTypeAnnotation.typeName.name}' must have exactly one type parameter.`, + ); + return; + } + + invariant( + false, + "Couldn't create IncorrectlyParameterizedFlowGenericParserError", + ); + } +} + +/** + * Array parsing errors + */ + +class UnsupportedArrayElementTypeAnnotationParserError extends ParserError { + constructor( + hasteModuleName: string, + arrayElementTypeAST: $FlowFixMe, + arrayType: 'Array' | 'ReadonlyArray', + invalidArrayElementType: string, + ) { + super( + hasteModuleName, + arrayElementTypeAST, + `${arrayType} element types cannot be '${invalidArrayElementType}'.`, + ); + } +} + +/** + * Object parsing errors + */ + +class UnsupportedObjectPropertyTypeAnnotationParserError extends ParserError { + constructor( + hasteModuleName: string, + propertyAST: $FlowFixMe, + invalidPropertyType: string, + ) { + let message = `'ObjectTypeAnnotation' cannot contain '${invalidPropertyType}'.`; + + super(hasteModuleName, propertyAST, message); + } +} + +class UnsupportedObjectPropertyValueTypeAnnotationParserError extends ParserError { + constructor( + hasteModuleName: string, + propertyValueAST: $FlowFixMe, + propertyName: string, + invalidPropertyValueType: string, + ) { + super( + hasteModuleName, + propertyValueAST, + `Object property '${propertyName}' cannot have type '${invalidPropertyValueType}'.`, + ); + } +} + +/** + * Function parsing errors + */ + +class UnnamedFunctionParamParserError extends ParserError { + constructor(functionParam: $FlowFixMe, hasteModuleName: string) { + super( + hasteModuleName, + functionParam, + 'All function parameters must be named.', + ); + } +} + +class UnsupportedFunctionParamTypeAnnotationParserError extends ParserError { + constructor( + hasteModuleName: string, + flowParamTypeAnnotation: $FlowFixMe, + paramName: string, + invalidParamType: string, + ) { + super( + hasteModuleName, + flowParamTypeAnnotation, + `Function parameter '${paramName}' cannot have type '${invalidParamType}'.`, + ); + } +} + +class UnsupportedFunctionReturnTypeAnnotationParserError extends ParserError { + constructor( + hasteModuleName: string, + flowReturnTypeAnnotation: $FlowFixMe, + invalidReturnType: string, + ) { + super( + hasteModuleName, + flowReturnTypeAnnotation, + `Function return cannot have type '${invalidReturnType}'.`, + ); + } +} + +class UnusedModuleTypeScriptInterfaceParserError extends ParserError { + constructor(hasteModuleName: string, flowInterface: $FlowFixMe) { + super( + hasteModuleName, + flowInterface, + "Unused NativeModule spec. Please load the NativeModule by calling TurboModuleRegistry.get('').", + ); + } +} + +class MoreThanOneModuleRegistryCallsParserError extends ParserError { + constructor( + hasteModuleName: string, + flowCallExpressions: $FlowFixMe, + numCalls: number, + ) { + super( + hasteModuleName, + flowCallExpressions, + `Every NativeModule spec file must contain exactly one NativeModule load. This file contains ${numCalls}. Please simplify this spec file, splitting it as necessary, to remove the extraneous loads.`, + ); + } +} + +class UntypedModuleRegistryCallParserError extends ParserError { + constructor( + hasteModuleName: string, + flowCallExpression: $FlowFixMe, + methodName: string, + moduleName: string, + ) { + super( + hasteModuleName, + flowCallExpression, + `Please type this NativeModule load: TurboModuleRegistry.${methodName}('${moduleName}').`, + ); + } +} + +class IncorrectModuleRegistryCallTypeParameterParserError extends ParserError { + constructor( + hasteModuleName: string, + flowTypeArguments: $FlowFixMe, + methodName: string, + moduleName: string, + ) { + super( + hasteModuleName, + flowTypeArguments, + `Please change these type arguments to reflect TurboModuleRegistry.${methodName}('${moduleName}').`, + ); + } +} + +class IncorrectModuleRegistryCallArityParserError extends ParserError { + constructor( + hasteModuleName: string, + flowCallExpression: $FlowFixMe, + methodName: string, + incorrectArity: number, + ) { + super( + hasteModuleName, + flowCallExpression, + `Please call TurboModuleRegistry.${methodName}() with exactly one argument. Detected ${incorrectArity}.`, + ); + } +} + +class IncorrectModuleRegistryCallArgumentTypeParserError extends ParserError { + constructor( + hasteModuleName: string, + flowArgument: $FlowFixMe, + methodName: string, + type: string, + ) { + const a = /[aeiouy]/.test(type.toLowerCase()) ? 'an' : 'a'; + super( + hasteModuleName, + flowArgument, + `Please call TurboModuleRegistry.${methodName}() with a string literal. Detected ${a} '${type}'`, + ); + } +} + +module.exports = { + IncorrectlyParameterizedTypeScriptGenericParserError, + MisnamedModuleTypeScriptInterfaceParserError, + ModuleTypeScriptInterfaceNotFoundParserError, + MoreThanOneModuleTypeScriptInterfaceParserError, + UnnamedFunctionParamParserError, + UnsupportedArrayElementTypeAnnotationParserError, + UnsupportedTypeScriptGenericParserError, + UnsupportedTypeScriptTypeAnnotationParserError, + UnsupportedFunctionParamTypeAnnotationParserError, + UnsupportedFunctionReturnTypeAnnotationParserError, + UnsupportedModulePropertyParserError, + UnsupportedObjectPropertyTypeAnnotationParserError, + UnsupportedObjectPropertyValueTypeAnnotationParserError, + UnusedModuleTypeScriptInterfaceParserError, + MoreThanOneModuleRegistryCallsParserError, + UntypedModuleRegistryCallParserError, + IncorrectModuleRegistryCallTypeParameterParserError, + IncorrectModuleRegistryCallArityParserError, + IncorrectModuleRegistryCallArgumentTypeParserError, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/index.js b/packages/react-native-codegen/src/parsers/typescript/modules/index.js new file mode 100644 index 000000000000..97a4dbc8767f --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/index.js @@ -0,0 +1,721 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +import type { + NamedShape, + NativeModuleAliasMap, + NativeModuleArrayTypeAnnotation, + NativeModuleBaseTypeAnnotation, + NativeModuleFunctionTypeAnnotation, + NativeModuleParamTypeAnnotation, + NativeModulePropertyShape, + NativeModuleSchema, + Nullable, +} from '../../../CodegenSchema.js'; + +import type {TypeDeclarationMap} from '../utils.js'; +import type {ParserErrorCapturer} from '../utils'; +import type {NativeModuleTypeAnnotation} from '../../../CodegenSchema.js'; + +const { + resolveTypeAnnotation, + getTypes, + visit, + isModuleRegistryCall, +} = require('../utils.js'); +const {unwrapNullable, wrapNullable} = require('./utils'); +const { + IncorrectlyParameterizedTypeScriptGenericParserError, + MisnamedModuleTypeScriptInterfaceParserError, + ModuleTypeScriptInterfaceNotFoundParserError, + MoreThanOneModuleTypeScriptInterfaceParserError, + UnnamedFunctionParamParserError, + UnsupportedArrayElementTypeAnnotationParserError, + UnsupportedTypeScriptGenericParserError, + UnsupportedTypeScriptTypeAnnotationParserError, + UnsupportedFunctionParamTypeAnnotationParserError, + UnsupportedFunctionReturnTypeAnnotationParserError, + UnsupportedModulePropertyParserError, + UnsupportedObjectPropertyTypeAnnotationParserError, + UnsupportedObjectPropertyValueTypeAnnotationParserError, + UnusedModuleTypeScriptInterfaceParserError, + MoreThanOneModuleRegistryCallsParserError, + UntypedModuleRegistryCallParserError, + IncorrectModuleRegistryCallTypeParameterParserError, + IncorrectModuleRegistryCallArityParserError, + IncorrectModuleRegistryCallArgumentTypeParserError, +} = require('./errors.js'); + +const invariant = require('invariant'); + +function nullGuard(fn: () => T): ?T { + return fn(); +} + +function translateTypeAnnotation( + hasteModuleName: string, + /** + * TODO(T108222691): Use flow-types for @babel/parser + */ + typeScriptTypeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, + aliasMap: {...NativeModuleAliasMap}, + tryParse: ParserErrorCapturer, +): Nullable { + const {nullable, typeAnnotation, typeAliasResolutionStatus} = + resolveTypeAnnotation(typeScriptTypeAnnotation, types); + + switch (typeAnnotation.type) { + case 'TSTypeReference': { + switch (typeAnnotation.typeName.name) { + case 'RootTag': { + return wrapNullable(nullable, { + type: 'ReservedTypeAnnotation', + name: 'RootTag', + }); + } + case 'Promise': { + assertGenericTypeAnnotationHasExactlyOneTypeParameter( + hasteModuleName, + typeAnnotation, + ); + + return wrapNullable(nullable, { + type: 'PromiseTypeAnnotation', + }); + } + case 'Array': + case 'ReadonlyArray': { + assertGenericTypeAnnotationHasExactlyOneTypeParameter( + hasteModuleName, + typeAnnotation, + ); + + try { + /** + * TODO(T72031674): Migrate all our NativeModule specs to not use + * invalid Array ElementTypes. Then, make the elementType a required + * parameter. + */ + const [elementType, isElementTypeNullable] = unwrapNullable( + translateTypeAnnotation( + hasteModuleName, + typeAnnotation.typeParameters.params[0], + types, + aliasMap, + /** + * TODO(T72031674): Ensure that all ParsingErrors that are thrown + * while parsing the array element don't get captured and collected. + * Why? If we detect any parsing error while parsing the element, + * we should default it to null down the line, here. This is + * the correct behaviour until we migrate all our NativeModule specs + * to be parseable. + */ + nullGuard, + ), + ); + + if (elementType.type === 'VoidTypeAnnotation') { + throw new UnsupportedArrayElementTypeAnnotationParserError( + hasteModuleName, + typeAnnotation.typeParameters.params[0], + typeAnnotation.type, + 'void', + ); + } + + if (elementType.type === 'PromiseTypeAnnotation') { + throw new UnsupportedArrayElementTypeAnnotationParserError( + hasteModuleName, + typeAnnotation.typeParameters.params[0], + typeAnnotation.type, + 'Promise', + ); + } + + if (elementType.type === 'FunctionTypeAnnotation') { + throw new UnsupportedArrayElementTypeAnnotationParserError( + hasteModuleName, + typeAnnotation.typeParameters.params[0], + typeAnnotation.type, + 'FunctionTypeAnnotation', + ); + } + + const finalTypeAnnotation: NativeModuleArrayTypeAnnotation< + Nullable, + > = { + type: 'ArrayTypeAnnotation', + elementType: wrapNullable(isElementTypeNullable, elementType), + }; + + return wrapNullable(nullable, finalTypeAnnotation); + } catch (ex) { + return wrapNullable(nullable, { + type: 'ArrayTypeAnnotation', + }); + } + } + case 'Readonly': { + assertGenericTypeAnnotationHasExactlyOneTypeParameter( + hasteModuleName, + typeAnnotation, + ); + + return translateTypeAnnotation( + hasteModuleName, + typeAnnotation.typeParameters.params[0], + types, + aliasMap, + tryParse, + ); + } + case 'Stringish': { + return wrapNullable(nullable, { + type: 'StringTypeAnnotation', + }); + } + case 'Int32': { + return wrapNullable(nullable, { + type: 'Int32TypeAnnotation', + }); + } + case 'Double': { + return wrapNullable(nullable, { + type: 'DoubleTypeAnnotation', + }); + } + case 'Float': { + return wrapNullable(nullable, { + type: 'FloatTypeAnnotation', + }); + } + case 'UnsafeObject': + case 'Object': { + return wrapNullable(nullable, { + type: 'GenericObjectTypeAnnotation', + }); + } + default: { + throw new UnsupportedTypeScriptGenericParserError( + hasteModuleName, + typeAnnotation, + ); + } + } + } + case 'TSTypeLiteral': { + const objectTypeAnnotation = { + type: 'ObjectTypeAnnotation', + // $FlowFixMe[missing-type-arg] + properties: (typeAnnotation.members: Array<$FlowFixMe>) + .map>>( + property => { + return tryParse(() => { + if (property.type !== 'TSPropertySignature') { + throw new UnsupportedObjectPropertyTypeAnnotationParserError( + hasteModuleName, + property, + property.type, + ); + } + + const {optional = false, key} = property; + + const [propertyTypeAnnotation, isPropertyNullable] = + unwrapNullable( + translateTypeAnnotation( + hasteModuleName, + property.typeAnnotation.typeAnnotation, + types, + aliasMap, + tryParse, + ), + ); + + if (propertyTypeAnnotation.type === 'FunctionTypeAnnotation') { + throw new UnsupportedObjectPropertyValueTypeAnnotationParserError( + hasteModuleName, + property.typeAnnotation.typeAnnotation, + property.key, + propertyTypeAnnotation.type, + ); + } + + if (propertyTypeAnnotation.type === 'VoidTypeAnnotation') { + throw new UnsupportedObjectPropertyValueTypeAnnotationParserError( + hasteModuleName, + property.typeAnnotation.typeAnnotation, + property.key, + 'void', + ); + } + + if (propertyTypeAnnotation.type === 'PromiseTypeAnnotation') { + throw new UnsupportedObjectPropertyValueTypeAnnotationParserError( + hasteModuleName, + property.typeAnnotation.typeAnnotation, + property.key, + 'Promise', + ); + } + + return { + name: key.name, + optional, + typeAnnotation: wrapNullable( + isPropertyNullable, + propertyTypeAnnotation, + ), + }; + }); + }, + ) + .filter(Boolean), + }; + + if (!typeAliasResolutionStatus.successful) { + return wrapNullable(nullable, objectTypeAnnotation); + } + + /** + * All aliases RHS are required. + */ + aliasMap[typeAliasResolutionStatus.aliasName] = objectTypeAnnotation; + + /** + * Nullability of type aliases is transitive. + * + * Consider this case: + * + * type Animal = ?{ + * name: string, + * }; + * + * type B = Animal + * + * export interface Spec extends TurboModule { + * +greet: (animal: B) => void; + * } + * + * In this case, we follow B to Animal, and then Animal to ?{name: string}. + * + * We: + * 1. Replace `+greet: (animal: B) => void;` with `+greet: (animal: ?Animal) => void;`, + * 2. Pretend that Animal = {name: string}. + * + * Why do we do this? + * 1. In ObjC, we need to generate a struct called Animal, not B. + * 2. This design is simpler than managing nullability within both the type alias usage, and the type alias RHS. + * 3. What does it mean for a C++ struct, which is what this type alias RHS will generate, to be nullable? ¯\_(ツ)_/¯ + * Nullability is a concept that only makes sense when talking about instances (i.e: usages) of the C++ structs. + * Hence, it's better to manage nullability within the actual TypeAliasTypeAnnotation nodes, and not the + * associated ObjectTypeAnnotations. + */ + return wrapNullable(nullable, { + type: 'TypeAliasTypeAnnotation', + name: typeAliasResolutionStatus.aliasName, + }); + } + case 'TSBooleanKeyword': { + return wrapNullable(nullable, { + type: 'BooleanTypeAnnotation', + }); + } + case 'TSNumberKeyword': { + return wrapNullable(nullable, { + type: 'NumberTypeAnnotation', + }); + } + case 'TSVoidKeyword': { + return wrapNullable(nullable, { + type: 'VoidTypeAnnotation', + }); + } + case 'TSStringKeyword': { + return wrapNullable(nullable, { + type: 'StringTypeAnnotation', + }); + } + case 'TSFunctionType': { + return wrapNullable( + nullable, + translateFunctionTypeAnnotation( + hasteModuleName, + typeAnnotation, + types, + aliasMap, + tryParse, + ), + ); + } + default: { + throw new UnsupportedTypeScriptTypeAnnotationParserError( + hasteModuleName, + typeAnnotation, + ); + } + } +} + +function assertGenericTypeAnnotationHasExactlyOneTypeParameter( + moduleName: string, + /** + * TODO(T108222691): Use flow-types for @babel/parser + */ + typeAnnotation: $FlowFixMe, +) { + if (typeAnnotation.typeParameters == null) { + throw new IncorrectlyParameterizedTypeScriptGenericParserError( + moduleName, + typeAnnotation, + ); + } + + invariant( + typeAnnotation.typeParameters.type === 'TSTypeParameterInstantiation', + "assertGenericTypeAnnotationHasExactlyOneTypeParameter: Type parameters must be an AST node of type 'TSTypeParameterInstantiation'", + ); + + if (typeAnnotation.typeParameters.params.length !== 1) { + throw new IncorrectlyParameterizedTypeScriptGenericParserError( + moduleName, + typeAnnotation, + ); + } +} + +function translateFunctionTypeAnnotation( + hasteModuleName: string, + // TODO(T108222691): Use flow-types for @babel/parser + typescriptFunctionTypeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, + aliasMap: {...NativeModuleAliasMap}, + tryParse: ParserErrorCapturer, +): NativeModuleFunctionTypeAnnotation { + type Param = NamedShape>; + const params: Array = []; + + for (const typeScriptParam of (typescriptFunctionTypeAnnotation.parameters: $ReadOnlyArray<$FlowFixMe>)) { + const parsedParam = tryParse(() => { + if (typeScriptParam.typeAnnotation == null) { + throw new UnnamedFunctionParamParserError( + typeScriptParam, + hasteModuleName, + ); + } + + const paramName = typeScriptParam.name; + const [paramTypeAnnotation, isParamTypeAnnotationNullable] = + unwrapNullable( + translateTypeAnnotation( + hasteModuleName, + typeScriptParam.typeAnnotation.typeAnnotation, + types, + aliasMap, + tryParse, + ), + ); + + if (paramTypeAnnotation.type === 'VoidTypeAnnotation') { + throw new UnsupportedFunctionParamTypeAnnotationParserError( + hasteModuleName, + typeScriptParam.typeAnnotation, + paramName, + 'void', + ); + } + + if (paramTypeAnnotation.type === 'PromiseTypeAnnotation') { + throw new UnsupportedFunctionParamTypeAnnotationParserError( + hasteModuleName, + typeScriptParam.typeAnnotation, + paramName, + 'Promise', + ); + } + + return { + name: typeScriptParam.name, + optional: Boolean(typeScriptParam.optional), + typeAnnotation: wrapNullable( + isParamTypeAnnotationNullable, + paramTypeAnnotation, + ), + }; + }); + + if (parsedParam != null) { + params.push(parsedParam); + } + } + + const [returnTypeAnnotation, isReturnTypeAnnotationNullable] = unwrapNullable( + translateTypeAnnotation( + hasteModuleName, + typescriptFunctionTypeAnnotation.typeAnnotation.typeAnnotation, + types, + aliasMap, + tryParse, + ), + ); + + if (returnTypeAnnotation.type === 'FunctionTypeAnnotation') { + throw new UnsupportedFunctionReturnTypeAnnotationParserError( + hasteModuleName, + typescriptFunctionTypeAnnotation.returnType, + 'FunctionTypeAnnotation', + ); + } + + return { + type: 'FunctionTypeAnnotation', + returnTypeAnnotation: wrapNullable( + isReturnTypeAnnotationNullable, + returnTypeAnnotation, + ), + params, + }; +} + +function buildPropertySchema( + hasteModuleName: string, + // TODO(T108222691): Use flow-types for @babel/parser + property: $FlowFixMe, + types: TypeDeclarationMap, + aliasMap: {...NativeModuleAliasMap}, + tryParse: ParserErrorCapturer, +): NativeModulePropertyShape { + let nullable = false; + let {key} = property; + let value = + property.type === 'TSMethodSignature' ? property : property.typeAnnotation; + + const methodName: string = key.name; + + ({nullable, typeAnnotation: value} = resolveTypeAnnotation(value, types)); + + if (value.type !== 'TSFunctionType' && value.type !== 'TSMethodSignature') { + throw new UnsupportedModulePropertyParserError( + hasteModuleName, + property.value, + property.key.name, + value.type, + ); + } + + return { + name: methodName, + optional: Boolean(property.optional), + typeAnnotation: wrapNullable( + nullable, + translateFunctionTypeAnnotation( + hasteModuleName, + value, + types, + aliasMap, + tryParse, + ), + ), + }; +} + +function isModuleInterface(node) { + return ( + node.type === 'TSInterfaceDeclaration' && + node.extends.length === 1 && + node.extends[0].type === 'TSExpressionWithTypeArguments' && + node.extends[0].expression.name === 'TurboModule' + ); +} + +function buildModuleSchema( + hasteModuleName: string, + /** + * TODO(T108222691): Use flow-types for @babel/parser + */ + ast: $FlowFixMe, + tryParse: ParserErrorCapturer, +): NativeModuleSchema { + const types = getTypes(ast); + const moduleSpecs = (Object.values(types): $ReadOnlyArray<$FlowFixMe>).filter( + isModuleInterface, + ); + + if (moduleSpecs.length === 0) { + throw new ModuleTypeScriptInterfaceNotFoundParserError( + hasteModuleName, + ast, + ); + } + + if (moduleSpecs.length > 1) { + throw new MoreThanOneModuleTypeScriptInterfaceParserError( + hasteModuleName, + moduleSpecs, + moduleSpecs.map(node => node.id.name), + ); + } + + const [moduleSpec] = moduleSpecs; + + if (moduleSpec.id.name !== 'Spec') { + throw new MisnamedModuleTypeScriptInterfaceParserError( + hasteModuleName, + moduleSpec.id, + ); + } + + // Parse Module Names + const moduleName = tryParse((): string => { + const callExpressions = []; + visit(ast, { + CallExpression(node) { + if (isModuleRegistryCall(node)) { + callExpressions.push(node); + } + }, + }); + + if (callExpressions.length === 0) { + throw new UnusedModuleTypeScriptInterfaceParserError( + hasteModuleName, + moduleSpec, + ); + } + + if (callExpressions.length > 1) { + throw new MoreThanOneModuleRegistryCallsParserError( + hasteModuleName, + callExpressions, + callExpressions.length, + ); + } + + const [callExpression] = callExpressions; + const {typeParameters} = callExpression; + const methodName = callExpression.callee.property.name; + + if (callExpression.arguments.length !== 1) { + throw new IncorrectModuleRegistryCallArityParserError( + hasteModuleName, + callExpression, + methodName, + callExpression.arguments.length, + ); + } + + if (callExpression.arguments[0].type !== 'StringLiteral') { + const {type} = callExpression.arguments[0]; + throw new IncorrectModuleRegistryCallArgumentTypeParserError( + hasteModuleName, + callExpression.arguments[0], + methodName, + type, + ); + } + + const $moduleName = callExpression.arguments[0].value; + + if (typeParameters == null) { + throw new UntypedModuleRegistryCallParserError( + hasteModuleName, + callExpression, + methodName, + $moduleName, + ); + } + + if ( + typeParameters.type !== 'TSTypeParameterInstantiation' || + typeParameters.params.length !== 1 || + typeParameters.params[0].type !== 'TSTypeReference' || + typeParameters.params[0].typeName.name !== 'Spec' + ) { + throw new IncorrectModuleRegistryCallTypeParameterParserError( + hasteModuleName, + typeParameters, + methodName, + $moduleName, + ); + } + + return $moduleName; + }); + + const moduleNames = moduleName == null ? [] : [moduleName]; + + // Some module names use platform suffix to indicate platform-exclusive modules. + // Eventually this should be made explicit in the Flow type itself. + // Also check the hasteModuleName for platform suffix. + // Note: this shape is consistent with ComponentSchema. + const excludedPlatforms = []; + const namesToValidate = [...moduleNames, hasteModuleName]; + namesToValidate.forEach(name => { + if (name.endsWith('Android')) { + excludedPlatforms.push('iOS'); + } else if (name.endsWith('IOS')) { + excludedPlatforms.push('android'); + } + }); + + // $FlowFixMe[missing-type-arg] + return (moduleSpec.body.body: $ReadOnlyArray<$FlowFixMe>) + .filter( + property => + property.type === 'TSMethodSignature' || + property.type === 'TSPropertySignature', + ) + .map(property => { + const aliasMap: {...NativeModuleAliasMap} = {}; + + return tryParse(() => ({ + aliasMap: aliasMap, + propertyShape: buildPropertySchema( + hasteModuleName, + property, + types, + aliasMap, + tryParse, + ), + })); + }) + .filter(Boolean) + .reduce( + (moduleSchema: NativeModuleSchema, {aliasMap, propertyShape}) => { + return { + type: 'NativeModule', + aliases: {...moduleSchema.aliases, ...aliasMap}, + spec: { + properties: [...moduleSchema.spec.properties, propertyShape], + }, + moduleNames: moduleSchema.moduleNames, + excludedPlatforms: moduleSchema.excludedPlatforms, + }; + }, + { + type: 'NativeModule', + aliases: {}, + spec: {properties: []}, + moduleNames: moduleNames, + excludedPlatforms: + excludedPlatforms.length !== 0 ? [...excludedPlatforms] : undefined, + }, + ); +} + +module.exports = { + buildModuleSchema, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/schema.js b/packages/react-native-codegen/src/parsers/typescript/modules/schema.js new file mode 100644 index 000000000000..4e3fda6bea4a --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/schema.js @@ -0,0 +1,28 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow strict + */ + +'use strict'; + +import type {SchemaType, NativeModuleSchema} from '../../../CodegenSchema.js'; + +function wrapModuleSchema( + nativeModuleSchema: NativeModuleSchema, + hasteModuleName: string, +): SchemaType { + return { + modules: { + [hasteModuleName]: nativeModuleSchema, + }, + }; +} + +module.exports = { + wrapModuleSchema, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/modules/utils.js b/packages/react-native-codegen/src/parsers/typescript/modules/utils.js new file mode 100644 index 000000000000..b013f76c8ce5 --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/modules/utils.js @@ -0,0 +1,45 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict + * @format + */ + +'use strict'; + +import type { + NativeModuleTypeAnnotation, + Nullable, +} from '../../../CodegenSchema.js'; + +function unwrapNullable<+T: NativeModuleTypeAnnotation>( + x: Nullable, +): [T, boolean] { + if (x.type === 'NullableTypeAnnotation') { + return [x.typeAnnotation, true]; + } + + return [x, false]; +} + +function wrapNullable<+T: NativeModuleTypeAnnotation>( + nullable: boolean, + typeAnnotation: T, +): Nullable { + if (!nullable) { + return typeAnnotation; + } + + return { + type: 'NullableTypeAnnotation', + typeAnnotation, + }; +} + +module.exports = { + unwrapNullable, + wrapNullable, +}; diff --git a/packages/react-native-codegen/src/parsers/typescript/utils.js b/packages/react-native-codegen/src/parsers/typescript/utils.js new file mode 100644 index 000000000000..fc435d259fff --- /dev/null +++ b/packages/react-native-codegen/src/parsers/typescript/utils.js @@ -0,0 +1,227 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +'use strict'; + +const {ParserError} = require('./errors'); + +/** + * TODO(T108222691): Use flow-types for @babel/parser + */ +export type TypeDeclarationMap = {[declarationName: string]: $FlowFixMe}; + +function getTypes(ast: $FlowFixMe): TypeDeclarationMap { + return ast.body.reduce((types, node) => { + if (node.type === 'ExportNamedDeclaration' && node.exportKind === 'type') { + if ( + node.declaration.type === 'TSTypeAliasDeclaration' || + node.declaration.type === 'TSInterfaceDeclaration' + ) { + types[node.declaration.id.name] = node.declaration; + } + } else if ( + node.type === 'TSTypeAliasDeclaration' || + node.type === 'TSInterfaceDeclaration' + ) { + types[node.id.name] = node; + } + + return types; + }, {}); +} + +// $FlowFixMe[unclear-type] Use flow-types for @babel/parser +export type ASTNode = Object; + +const invariant = require('invariant'); + +type TypeAliasResolutionStatus = + | $ReadOnly<{ + successful: true, + aliasName: string, + }> + | $ReadOnly<{ + successful: false, + }>; + +function resolveTypeAnnotation( + // TODO(T108222691): Use flow-types for @babel/parser + typeAnnotation: $FlowFixMe, + types: TypeDeclarationMap, +): { + nullable: boolean, + typeAnnotation: $FlowFixMe, + typeAliasResolutionStatus: TypeAliasResolutionStatus, +} { + invariant( + typeAnnotation != null, + 'resolveTypeAnnotation(): typeAnnotation cannot be null', + ); + + let node = + typeAnnotation.type === 'TSTypeAnnotation' + ? typeAnnotation.typeAnnotation + : typeAnnotation; + let nullable = false; + let typeAliasResolutionStatus: TypeAliasResolutionStatus = { + successful: false, + }; + + for (;;) { + // Check for optional type in union e.g. T | null | void + if ( + node.type === 'TSUnionType' && + node.types.some( + t => t.type === 'TSNullKeyword' || t.type === 'TSVoidKeyword', + ) + ) { + node = node.types.filter( + t => t.type !== 'TSNullKeyword' && t.type !== 'TSVoidKeyword', + )[0]; + nullable = true; + } else if (node.type === 'TSTypeReference') { + typeAliasResolutionStatus = { + successful: true, + aliasName: node.typeName.name, + }; + const resolvedTypeAnnotation = types[node.typeName.name]; + if (resolvedTypeAnnotation == null) { + break; + } + + invariant( + resolvedTypeAnnotation.type === 'TSTypeAliasDeclaration', + `GenericTypeAnnotation '${node.typeName.name}' must resolve to a TSTypeAliasDeclaration. Instead, it resolved to a '${resolvedTypeAnnotation.type}'`, + ); + + node = resolvedTypeAnnotation.typeAnnotation; + } else { + break; + } + } + + return { + nullable: nullable, + typeAnnotation: node, + typeAliasResolutionStatus, + }; +} + +function getValueFromTypes(value: ASTNode, types: TypeDeclarationMap): ASTNode { + if (value.type === 'TSTypeReference' && types[value.typeName.name]) { + return getValueFromTypes(types[value.typeName.name], types); + } + + if (value.type === 'TSTypeAliasDeclaration') { + return value.typeAnnotation; + } + + return value; +} + +export type ParserErrorCapturer = (fn: () => T) => ?T; + +function createParserErrorCapturer(): [ + Array, + ParserErrorCapturer, +] { + const errors = []; + function guard(fn: () => T): ?T { + try { + return fn(); + } catch (error) { + if (!(error instanceof ParserError)) { + throw error; + } + errors.push(error); + + return null; + } + } + + return [errors, guard]; +} + +// TODO(T108222691): Use flow-types for @babel/parser +function visit( + astNode: $FlowFixMe, + visitor: { + [type: string]: (node: $FlowFixMe) => void, + }, +) { + const queue = [astNode]; + while (queue.length !== 0) { + let item = queue.shift(); + + if (!(typeof item === 'object' && item != null)) { + continue; + } + + if ( + typeof item.type === 'string' && + typeof visitor[item.type] === 'function' + ) { + // Don't visit any children + visitor[item.type](item); + } else if (Array.isArray(item)) { + queue.push(...item); + } else { + queue.push(...Object.values(item)); + } + } +} + +// TODO(T108222691): Use flow-types for @babel/parser +function isModuleRegistryCall(node: $FlowFixMe): boolean { + if (node.type !== 'CallExpression') { + return false; + } + + const callExpression = node; + + if (callExpression.callee.type !== 'MemberExpression') { + return false; + } + + const memberExpression = callExpression.callee; + if ( + !( + memberExpression.object.type === 'Identifier' && + memberExpression.object.name === 'TurboModuleRegistry' + ) + ) { + return false; + } + + if ( + !( + memberExpression.property.type === 'Identifier' && + (memberExpression.property.name === 'get' || + memberExpression.property.name === 'getEnforcing') + ) + ) { + return false; + } + + if (memberExpression.computed) { + return false; + } + + return true; +} + +module.exports = { + getValueFromTypes, + resolveTypeAnnotation, + createParserErrorCapturer, + getTypes, + visit, + isModuleRegistryCall, +}; diff --git a/packages/react-native-gradle-plugin/BUCK b/packages/react-native-gradle-plugin/BUCK new file mode 100644 index 000000000000..8fd38289431b --- /dev/null +++ b/packages/react-native-gradle-plugin/BUCK @@ -0,0 +1,23 @@ +load("@fbsource//tools/build_defs/third_party:yarn_defs.bzl", "yarn_workspace") + +yarn_workspace( + name = "yarn-workspace", + srcs = glob( + ["**/*.js"], + exclude = [ + "**/__fixtures__/**", + "**/__flowtests__/**", + "**/__mocks__/**", + "**/__server_snapshot_tests__/**", + "**/__tests__/**", + "**/node_modules/**", + "**/node_modules/.bin/**", + "**/.*", + "**/.*/**", + "**/.*/.*", + "**/*.xcodeproj/**", + "**/*.xcworkspace/**", + ], + ), + visibility = ["PUBLIC"], +) diff --git a/packages/react-native-gradle-plugin/build.gradle.kts b/packages/react-native-gradle-plugin/build.gradle.kts index 6320a994ad40..c457a5791e3f 100644 --- a/packages/react-native-gradle-plugin/build.gradle.kts +++ b/packages/react-native-gradle-plugin/build.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -9,7 +9,7 @@ import org.gradle.api.internal.classpath.ModuleRegistry import org.gradle.configurationcache.extensions.serviceOf plugins { - kotlin("jvm") version "1.5.31" + kotlin("jvm") version "1.6.10" id("java-gradle-plugin") } @@ -27,9 +27,14 @@ gradlePlugin { } } +group = "com.facebook.react" + dependencies { implementation(gradleApi()) - implementation("com.android.tools.build:gradle:4.2.2") + implementation("com.android.tools.build:gradle:7.0.4") + implementation("com.google.code.gson:gson:2.8.9") + implementation("com.google.guava:guava:31.0.1-jre") + implementation("com.squareup:javapoet:1.13.0") testImplementation("junit:junit:4.13.2") @@ -39,3 +44,14 @@ dependencies { ) ) } + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 +} + +tasks.withType { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.majorVersion + } +} diff --git a/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties index a0f7639f7d36..669386b870a6 100644 --- a/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/packages/react-native-gradle-plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/packages/react-native-gradle-plugin/gradlew b/packages/react-native-gradle-plugin/gradlew index 744e882ed572..1b6c787337ff 100755 --- a/packages/react-native-gradle-plugin/gradlew +++ b/packages/react-native-gradle-plugin/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # 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" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MSYS* | MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# 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 +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/packages/react-native-gradle-plugin/package.json b/packages/react-native-gradle-plugin/package.json index 25cdbff2b962..b9d86d770299 100644 --- a/packages/react-native-gradle-plugin/package.json +++ b/packages/react-native-gradle-plugin/package.json @@ -1,6 +1,6 @@ { "name": "react-native-gradle-plugin", - "version": "0.0.1", + "version": "0.0.6", "description": "⚛️ Gradle Plugin for React Native", "homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin", "repository": { @@ -20,11 +20,9 @@ "gradle", "gradlew", "gradlew.bat", - "src", + "src/main", "README.md" ], - "dependencies": { - "react-native-codegen": "*" - }, + "dependencies": {}, "devDependencies": {} } diff --git a/packages/react-native-gradle-plugin/settings.gradle.kts b/packages/react-native-gradle-plugin/settings.gradle.kts index 7e74af1ef970..c50bb5808dcc 100644 --- a/packages/react-native-gradle-plugin/settings.gradle.kts +++ b/packages/react-native-gradle-plugin/settings.gradle.kts @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,10 @@ pluginManagement { repositories { - gradlePluginPortal() + mavenCentral() google() + gradlePluginPortal() } } + +rootProject.name = "react-native-gradle-plugin" diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/JavaGenerator.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/JavaGenerator.java index feed3fc21e0c..08c7319c7fec 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/JavaGenerator.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/JavaGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -32,7 +32,7 @@ public final class JavaGenerator { public static final String LICENSE_HEADER = "/*\n" - + " * Copyright (c) Facebook, Inc. and its affiliates.\n" + + " * Copyright (c) Meta Platforms, Inc. and affiliates.\n" + " *\n" + " * This source code is licensed under the MIT license found in the\n" + " * LICENSE file in the root directory of this source tree.\n" diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java index 422317a78734..d4848d1405fd 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/SchemaJsonParser.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AliasType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AliasType.java index 4114dc52c834..60b20731ba51 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AliasType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AliasType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AnyType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AnyType.java index ce22b2044752..3ae53126b6fc 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AnyType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/AnyType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ArrayType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ArrayType.java index 536a082e5a83..cefb88eecd63 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ArrayType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ArrayType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/BooleanType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/BooleanType.java index c5f8b9be17b5..29ad1164c022 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/BooleanType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/BooleanType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/CodegenException.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/CodegenException.java index 0b0ff3c8680e..715e3ba58e8c 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/CodegenException.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/CodegenException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/DoubleType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/DoubleType.java index ddfa0616334b..1687f7aa6fd2 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/DoubleType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/DoubleType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FloatType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FloatType.java index 6698735501c5..45f62482662b 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FloatType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FloatType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FunctionType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FunctionType.java index d664d7475346..5e078318fd13 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FunctionType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/FunctionType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/GenericObjectType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/GenericObjectType.java index ce4a2b05eef8..dc78c8efe615 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/GenericObjectType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/GenericObjectType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Int32Type.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Int32Type.java index 4639d392397a..5ec6f0d70b43 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Int32Type.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Int32Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NativeModuleType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NativeModuleType.java index 2f3a41034ff5..78ef5281458e 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NativeModuleType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NativeModuleType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NullableType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NullableType.java index 51809250d204..9ae00b719d20 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NullableType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NullableType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NumberType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NumberType.java index 382e06846d6a..6ad5869346f8 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NumberType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/NumberType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ObjectType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ObjectType.java index 3c1fcabd512a..86b47033b6ce 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ObjectType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ObjectType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/PromiseType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/PromiseType.java index c243cae7d73a..9ba551f12a6c 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/PromiseType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/PromiseType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ReservedFunctionValueType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ReservedFunctionValueType.java index c1f755ed118f..6586d82770e7 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ReservedFunctionValueType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/ReservedFunctionValueType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/StringType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/StringType.java index 39ba374a0fc8..0a1f328306a1 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/StringType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/StringType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Type.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Type.java index b6151d20ed9b..20fe5605ac98 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Type.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeData.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeData.java index 91a58f51062f..73992f210c0c 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeData.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeData.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeId.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeId.java index ef9831c52562..279dffcf4a5b 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeId.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/TypeId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/VoidType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/VoidType.java index 29ea494d7f2f..1e4b83c79102 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/VoidType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/model/VoidType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AliasResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AliasResolvedType.java index 6720ef76e38e..5c5efce0327a 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AliasResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AliasResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/Annotations.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/Annotations.java index 4025b545ef75..3e245f211e16 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/Annotations.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/Annotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AnyResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AnyResolvedType.java index e9fc8dc335b5..4b08596af610 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AnyResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/AnyResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ArrayResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ArrayResolvedType.java index b6a7d3b7854c..bd60d7b776d3 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ArrayResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ArrayResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/BooleanResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/BooleanResolvedType.java index 75ac0a77ce5f..aeef69229e5e 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/BooleanResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/BooleanResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ClassNames.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ClassNames.java index 5a76753ed2bf..7b003e0be623 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ClassNames.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ClassNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/FunctionResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/FunctionResolvedType.java index 7896494eebb2..29715cf27adc 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/FunctionResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/FunctionResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/GenericObjectResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/GenericObjectResolvedType.java index 84b98eb9698e..0d79f639c024 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/GenericObjectResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/GenericObjectResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NativeModuleResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NativeModuleResolvedType.java index 0022209dbf20..112038cac159 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NativeModuleResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NativeModuleResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NullableResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NullableResolvedType.java index b5dd2fee1ea7..474dee1598f3 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NullableResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NullableResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NumberResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NumberResolvedType.java index 6a9576efe7ca..4c767081d8f8 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NumberResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/NumberResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ObjectResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ObjectResolvedType.java index 54a9cb09eeec..9ce477716f06 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ObjectResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ObjectResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/PromiseResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/PromiseResolvedType.java index 0c575ff08a26..e79102f78958 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/PromiseResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/PromiseResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReactClassNames.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReactClassNames.java index 2fca4df5dfde..fa81d5a5e98a 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReactClassNames.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReactClassNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReservedFunctionValueResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReservedFunctionValueResolvedType.java index 3cd677cc70e5..b9f82fa165a6 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReservedFunctionValueResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ReservedFunctionValueResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ResolvedType.java index e9373ed5f56c..8e56069015f4 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/ResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/StringResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/StringResolvedType.java index c24711171028..1517e7e04c51 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/StringResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/StringResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeResolver.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeResolver.java index 6b9b533876e3..b90d0bb5f08c 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeResolver.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeUtils.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeUtils.java index b8742b6f89e9..5cc6384eb50d 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeUtils.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/TypeUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/VoidResolvedType.java b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/VoidResolvedType.java index 0665ddf548a0..db0bf7a1576b 100644 --- a/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/VoidResolvedType.java +++ b/packages/react-native-gradle-plugin/src/main/java/com/facebook/react/codegen/generator/resolver/VoidResolvedType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/AndroidConfiguration.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/AndroidConfiguration.kt index 5babb8d50aa6..48fe2cccea4e 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/AndroidConfiguration.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/AndroidConfiguration.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt index f898c9d37fe4..7f1d914de461 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -29,13 +29,13 @@ abstract class ReactExtension @Inject constructor(project: Project) { val applyAppPlugin: Property = objects.property(Boolean::class.java).convention(false) /** - * The path to the react root folder. This is the path to the root folder where the `node_modules` - * folder is present. All the CLI commands will be invoked from this folder as working directory. + * The path to the root of your project. This is the path to where the `package.json` lives. All + * the CLI commands will be invoked from this folder as working directory. * - * Default: $projectDir/../../ + * Default: ${rootProject.dir}/../ */ - val reactRoot: DirectoryProperty = - objects.directoryProperty().convention(project.layout.projectDirectory.dir("../../")) + val root: DirectoryProperty = + objects.directoryProperty().convention(project.rootProject.layout.projectDirectory.dir("../")) /** * The path to the JS entry file. If not specified, the plugin will try to resolve it using a list @@ -45,7 +45,7 @@ abstract class ReactExtension @Inject constructor(project: Project) { /** * The path to the React Native CLI. If not specified, the plugin will try to resolve it looking - * for `react-native` CLI inside `node_modules` in [reactRoot]. + * for `react-native` CLI inside `node_modules` in [root]. */ val cliPath: Property = objects.property(String::class.java) @@ -56,9 +56,7 @@ abstract class ReactExtension @Inject constructor(project: Project) { val nodeExecutableAndArgs: ListProperty = objects.listProperty(String::class.java).convention(listOf("node")) - /** - * The command to use to invoke bundle. Default is `bundle` and will be invoked on [reactRoot]. - */ + /** The command to use to invoke bundle. Default is `bundle` and will be invoked on [root]. */ val bundleCommand: Property = objects.property(String::class.java).convention("bundle") /** @@ -114,6 +112,14 @@ abstract class ReactExtension @Inject constructor(project: Project) { val devDisabledInVariants: ListProperty = objects.listProperty(String::class.java).convention(emptyList()) + /** + * Functional interface to disable dev mode only on specific [BaseVariant] Default: will check + * [devDisabledInVariants] or return True for Release variants and False for Debug variants. + */ + var disableDevForVariant: (BaseVariant) -> Boolean = { variant -> + variant.name in devDisabledInVariants.get() || variant.isRelease + } + /** * Variant Name to Boolean map that allows to toggle the bundle command for a specific variant. * Default: {} @@ -122,6 +128,17 @@ abstract class ReactExtension @Inject constructor(project: Project) { val bundleIn: MapProperty = objects.mapProperty(String::class.java, Boolean::class.java).convention(emptyMap()) + /** + * Functional interface to toggle the bundle command only on specific [BaseVariant] Default: will + * check [bundleIn] or return True for Release variants and False for Debug variants. + */ + var bundleForVariant: (BaseVariant) -> Boolean = { variant -> + if (bundleIn.getting(variant.name).isPresent) bundleIn.getting(variant.name).get() + else if (bundleIn.getting(variant.buildType.name).isPresent) + bundleIn.getting(variant.buildType.name).get() + else variant.isRelease + } + /** Hermes Config */ /** The command to use to invoke hermes. Default is `hermesc` for the correct OS. */ @@ -171,19 +188,27 @@ abstract class ReactExtension @Inject constructor(project: Project) { /** Codegen Config */ /** - * The path to the react-native-codegen folder. + * The path to the react-native-codegen NPM package folder. * - * Default: $projectDir/../../packages/react-native-codegen + * Default: ${rootProject.dir}/../node_modules/react-native-codegen */ val codegenDir: DirectoryProperty = - objects.directoryProperty().convention(reactRoot.dir("packages/react-native-codegen")) + objects.directoryProperty().convention(root.dir("node_modules/react-native-codegen")) + + /** + * The path to the react-native NPM package folder. + * + * Default: ${rootProject.dir}/../node_modules/react-native-codegen + */ + val reactNativeDir: DirectoryProperty = + objects.directoryProperty().convention(root.dir("node_modules/react-native")) /** * The root directory for all JS files for the app. * - * Default: $projectDir/../../ + * Default: [root] (i.e. ${rootProject.dir}/../) */ - val jsRootDir: DirectoryProperty = objects.directoryProperty().convention(reactRoot.get()) + val jsRootDir: DirectoryProperty = objects.directoryProperty().convention(root.get()) /** * The library name that will be used for the codegen artifacts. @@ -203,4 +228,29 @@ abstract class ReactExtension @Inject constructor(project: Project) { /** Whether the Java Generator (based on Javapoet) should be used or not. Default: false */ val useJavaGenerator: Property = objects.property(Boolean::class.java).convention(false) + + /** + * The `reactRoot` property was confusing and should not be used. + * + * You should instead use either: + * - [root] to point to your root project (where the package.json lives) + * - [reactNativeDir] to point to the NPM package of react native. + * + * A valid configuration would look like: + * + * ``` + * react { + * root = rootProject.file("..") + * reactNativeDir = rootProject.file("../node_modules/react-native") + * } + * ``` + * + * Please also note that those are the default value and you most likely don't need those at all. + */ + @Deprecated( + "reactRoot was confusing and has been replace with root" + + "to point to your root project and reactNativeDir to point to " + + "the folder of the react-native NPM package", + replaceWith = ReplaceWith("reactNativeRoot")) + val reactRoot: DirectoryProperty = objects.directoryProperty() } diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt index ebad04dab807..42490044ba89 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactPlugin.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -15,20 +15,41 @@ import com.facebook.react.tasks.BuildCodegenCLITask import com.facebook.react.tasks.GenerateCodegenArtifactsTask import com.facebook.react.tasks.GenerateCodegenSchemaTask import java.io.File +import kotlin.system.exitProcess import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.Task +import org.gradle.internal.jvm.Jvm class ReactPlugin : Plugin { override fun apply(project: Project) { + checkJvmVersion(project) val extension = project.extensions.create("react", ReactExtension::class.java, project) applyAppPlugin(project, extension) applyCodegenPlugin(project, extension) } + private fun checkJvmVersion(project: Project) { + val jvmVersion = Jvm.current()?.javaVersion?.majorVersion + if ((jvmVersion?.toIntOrNull() ?: 0) <= 8) { + project.logger.error( + """ + + ******************************************************************************** + + ERROR: requires JDK11 or higher. + Incompatible major version detected: '$jvmVersion' + + ******************************************************************************** + + """.trimIndent()) + exitProcess(1) + } + } + private fun applyAppPlugin(project: Project, config: ReactExtension) { - if (config.applyAppPlugin.getOrElse(false)) { - project.afterEvaluate { + project.afterEvaluate { + if (config.applyAppPlugin.getOrElse(false)) { val androidConfiguration = project.extensions.getByType(BaseExtension::class.java) project.configureDevPorts(androidConfiguration) @@ -75,7 +96,8 @@ class ReactPlugin : Plugin { project.tasks.register( "generateCodegenArtifactsFromSchema", GenerateCodegenArtifactsTask::class.java) { it.dependsOn(generateCodegenSchemaTask) - it.reactRoot.set(extension.reactRoot) + it.reactNativeDir.set(extension.reactNativeDir) + it.deprecatedReactRoot.set(extension.reactRoot) it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs) it.codegenDir.set(extension.codegenDir) it.useJavaGenerator.set(extension.useJavaGenerator) diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt index eefaef68a873..4165d8584588 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -17,7 +17,6 @@ import com.facebook.react.utils.detectedCliPath import com.facebook.react.utils.detectedEntryFile import com.facebook.react.utils.detectedHermesCommand import java.io.File -import java.util.* import org.gradle.api.Project import org.gradle.api.Task import org.gradle.api.tasks.Copy @@ -27,8 +26,7 @@ private const val REACT_GROUP = "react" @Suppress("SpreadOperator") internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExtension) { - val targetName = variant.name.capitalize(Locale.ROOT) - val isRelease = variant.isRelease + val targetName = variant.name.replaceFirstChar { it.uppercase() } val targetPath = variant.dirName // React js bundle directories @@ -50,21 +48,19 @@ internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExte val execCommand = nodeExecutableAndArgs + cliPath val enableHermes = config.enableHermesForVariant(variant) val cleanup = config.deleteDebugFilesForVariant(variant) - val bundleEnabled = variant.checkBundleEnabled(config) + val bundleEnabled = config.bundleForVariant(variant) val bundleTask = tasks.register("createBundle${targetName}JsAndAssets", BundleJsAndAssetsTask::class.java) { it.group = REACT_GROUP it.description = "create JS bundle and assets for $targetName." - it.reactRoot = config.reactRoot.get().asFile + it.reactRoot = config.root.get().asFile it.sources = - fileTree(config.reactRoot) { fileTree -> - fileTree.setExcludes(config.inputExcludes.get()) - } + fileTree(config.root) { fileTree -> fileTree.setExcludes(config.inputExcludes.get()) } it.execCommand = execCommand it.bundleCommand = config.bundleCommand.get() - it.devEnabled = !(variant.name in config.devDisabledInVariants.get() || isRelease) + it.devEnabled = !config.disableDevForVariant(variant) it.entryFile = detectedEntryFile(config) val extraArgs = mutableListOf() @@ -99,7 +95,7 @@ internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExte it.group = REACT_GROUP it.description = "bundle hermes resources for $targetName" - it.reactRoot = config.reactRoot.get().asFile + it.reactRoot = config.root.get().asFile it.hermesCommand = detectedHermesCommand(config) it.hermesFlags = config.hermesFlagsForVariant(variant) it.jsBundleFile = jsBundleFile @@ -165,23 +161,23 @@ internal fun Project.configureReactTasks(variant: BaseVariant, config: ReactExte packageTask.configure { if (config.enableVmCleanup.get()) { val libDir = "$buildDir/intermediates/transforms/" - val targetVariant = ".*/transforms/[^/]*/$targetPath/.*".toRegex() + val targetVariant = ".*/transforms/[^/]*/${variant.name}/.*".toRegex() it.doFirst { cleanupVMFiles(libDir, targetVariant, enableHermes, cleanup) } } } stripDebugSymbolsTask?.configure { if (config.enableVmCleanup.get()) { - val libDir = "$buildDir/intermediates/stripped_native_libs/${targetPath}/out/lib/" - val targetVariant = ".*/stripped_native_libs/$targetPath/out/lib/.*".toRegex() + val libDir = "$buildDir/intermediates/stripped_native_libs/${variant.name}/out/lib/" + val targetVariant = ".*/stripped_native_libs/${variant.name}/out/lib/.*".toRegex() it.doLast { cleanupVMFiles(libDir, targetVariant, enableHermes, cleanup) } } } mergeNativeLibsTask?.configure { if (config.enableVmCleanup.get()) { - val libDir = "$buildDir/intermediates/merged_native_libs/${targetPath}/out/lib/" - val targetVariant = ".*/merged_native_libs/$targetPath/out/lib/.*".toRegex() + val libDir = "$buildDir/intermediates/merged_native_libs/${variant.name}/out/lib/" + val targetVariant = ".*/merged_native_libs/${variant.name}/out/lib/.*".toRegex() it.doLast { cleanupVMFiles(libDir, targetVariant, enableHermes, cleanup) } } } @@ -232,22 +228,15 @@ private fun Project.cleanupVMFiles( if (cleanup) { // Reduce size by deleting the debugger/inspector - it.include("**/libhermes-inspector.so") it.include("**/libhermes-executor-debug.so") - it.include("**/libhermes-executor-common-debug.so") } else { // Release libs take precedence and must be removed // to allow debugging it.include("**/libhermes-executor-release.so") - it.include("**/libhermes-executor-common-release.so") } } else { // For JSC, delete all the libhermes* files it.include("**/libhermes*.so") - // Delete the libjscexecutor from release build - if (cleanup) { - it.include("**/libjscexecutor.so") - } } } .visit { visit -> @@ -258,17 +247,5 @@ private fun Project.cleanupVMFiles( } } -private fun BaseVariant.checkBundleEnabled(config: ReactExtension): Boolean { - if (config.bundleIn.getting(name).isPresent) { - return config.bundleIn.getting(name).get() - } - - if (config.bundleIn.getting(buildType.name).isPresent) { - return config.bundleIn.getting(buildType.name).get() - } - - return isRelease -} - internal val BaseVariant.isRelease: Boolean - get() = name.toLowerCase(Locale.ROOT).contains("release") + get() = name.lowercase().contains("release") diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BuildCodegenCLITask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BuildCodegenCLITask.kt index 1b295cdec510..9bc1ddba1734 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BuildCodegenCLITask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BuildCodegenCLITask.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt index a00d3a6e28ae..2e1a0b8be819 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/BundleJsAndAssetsTask.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt index d6890c310edf..3818e4085ab8 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTask.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -8,7 +8,7 @@ package com.facebook.react.tasks import com.facebook.react.codegen.generator.JavaGenerator -import com.facebook.react.utils.windowsAwareYarn +import com.facebook.react.utils.windowsAwareCommandLine import org.gradle.api.GradleException import org.gradle.api.file.Directory import org.gradle.api.file.DirectoryProperty @@ -20,7 +20,7 @@ import org.gradle.api.tasks.* abstract class GenerateCodegenArtifactsTask : Exec() { - @get:Internal abstract val reactRoot: DirectoryProperty + @get:Internal abstract val reactNativeDir: DirectoryProperty @get:Internal abstract val codegenDir: DirectoryProperty @@ -34,6 +34,9 @@ abstract class GenerateCodegenArtifactsTask : Exec() { @get:Input abstract val libraryName: Property + // We're keeping this just to fire a warning at the user should they use the `reactRoot` property. + @get:Internal abstract val deprecatedReactRoot: DirectoryProperty + @get:InputFile val combineJsToSchemaCli: Provider = codegenDir.file("lib/cli/combine/combine-js-to-schema-cli.js") @@ -46,14 +49,12 @@ abstract class GenerateCodegenArtifactsTask : Exec() { @get:OutputDirectory val generatedJniFiles: Provider = generatedSrcDir.dir("jni") override fun exec() { + checkForDeprecatedProperty() setupCommandLine() super.exec() - } - - internal fun setupCommandLine() { if (useJavaGenerator.getOrElse(false)) { // Use Java-based generator implementation to produce the source files, - // instead of using the JS-based generator. + // this will override the JS-based generator output (for the Java files only). try { JavaGenerator( generatedSchemaFile.get().asFile, @@ -63,17 +64,47 @@ abstract class GenerateCodegenArtifactsTask : Exec() { } catch (e: Exception) { throw GradleException("Failed to generate Java from schema.", e) } - commandLine("echo", "Used JavaGenerator to generate files instead of generate-specs-cli.js") - } else { - commandLine( - windowsAwareYarn( - *nodeExecutableAndArgs.get().toTypedArray(), - reactRoot.file("scripts/generate-specs-cli.js").get().asFile.absolutePath, - "android", - generatedSchemaFile.get().asFile.absolutePath, - generatedSrcDir.get().asFile.absolutePath, - libraryName.get(), - codegenJavaPackageName.get())) } } + + private fun checkForDeprecatedProperty() { + if (deprecatedReactRoot.isPresent) { + project.logger.error( + """ + ******************************************************************************** + The `reactRoot` property is deprecated and will be removed in + future versions of React Native. The property is currently ignored. + + You should instead use either: + - [root] to point to your root project (where the package.json lives) + - [reactNativeDir] to point to the NPM package of react native. + + You should be fine by just removing the `reactRoot` line entirely from + your build.gradle file. Otherwise a valid configuration would look like: + + react { + root = rootProject.file('..') + reactNativeDir = rootProject.file('../node_modules/react-native') + } + ******************************************************************************** + """.trimIndent()) + } + } + + internal fun setupCommandLine() { + commandLine( + windowsAwareCommandLine( + *nodeExecutableAndArgs.get().toTypedArray(), + reactNativeDir.file("scripts/generate-specs-cli.js").get().asFile.absolutePath, + "--platform", + "android", + "--schemaPath", + generatedSchemaFile.get().asFile.absolutePath, + "--outputDir", + generatedSrcDir.get().asFile.absolutePath, + "--libraryName", + libraryName.get(), + "--javaPackageName", + codegenJavaPackageName.get())) + } } diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt index 59855d63e041..dea2d8e7dfc0 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTask.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,7 +7,7 @@ package com.facebook.react.tasks -import com.facebook.react.utils.windowsAwareYarn +import com.facebook.react.utils.windowsAwareCommandLine import org.gradle.api.file.DirectoryProperty import org.gradle.api.file.RegularFile import org.gradle.api.provider.ListProperty @@ -49,7 +49,7 @@ abstract class GenerateCodegenSchemaTask : Exec() { internal fun setupCommandLine() { commandLine( - windowsAwareYarn( + windowsAwareCommandLine( *nodeExecutableAndArgs.get().toTypedArray(), codegenDir .file("lib/cli/combine/combine-js-to-schema-cli.js") diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt index d7866591c8ee..ab056981bb2e 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/HermesBinaryTask.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt new file mode 100644 index 000000000000..fd0769b90238 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTask.kt @@ -0,0 +1,49 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import org.gradle.api.DefaultTask +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.tasks.* + +/** + * A task that takes care of extracting JNIs and Headers from a custom Gradle configuration into an + * output folder. Users are most likely not going to use this task but it will be used when building + * the React Native project. + */ +abstract class ExtractJniAndHeadersTask : DefaultTask() { + + @get:InputFiles abstract val extractHeadersConfiguration: ConfigurableFileCollection + + @get:InputFiles abstract val extractJniConfiguration: ConfigurableFileCollection + + @get:OutputDirectory abstract val baseOutputDir: DirectoryProperty + + @TaskAction + fun taskAction() { + extractJniConfiguration.files.forEach { + val file = it.absoluteFile + val packageName = file.name.split("-", ".").first() + project.copy { copySpec -> + copySpec.from(project.zipTree(file)) + copySpec.into(baseOutputDir.dir(packageName)) + copySpec.include("jni/**/*") + } + } + extractHeadersConfiguration.files.forEach { + val file = it.absoluteFile + val packageName = file.name.split("-", ".").first() + project.copy { copySpec -> + copySpec.from(project.zipTree(file)) + copySpec.into(baseOutputDir.get().dir("$packageName/headers")) + copySpec.include("**/*.h") + } + } + } +} diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt new file mode 100644 index 000000000000..2f4b684b68d5 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareBoostTask.kt @@ -0,0 +1,46 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import java.io.File +import org.gradle.api.DefaultTask +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.* + +/** + * A task that takes care of extracting Boost from a source folder/zip and preparing it to be + * consumed by the NDK + */ +abstract class PrepareBoostTask : DefaultTask() { + + @get:InputFiles abstract val boostPath: ConfigurableFileCollection + + @get:Input abstract val boostVersion: Property + + @get:OutputDirectory abstract val outputDir: DirectoryProperty + + @TaskAction + fun taskAction() { + project.copy { it -> + it.from(boostPath) + it.from(project.file("src/main/jni/third-party/boost")) + it.include( + "Android.mk", + "boost_${boostVersion.get()}/boost/**/*.hpp", + "boost/boost/**/*.hpp", + "asm/**/*.S") + it.includeEmptyDirs = false + it.into(outputDir) + } + File(outputDir.asFile.get(), "boost").apply { + renameTo(File(this.parentFile, "boost_${boostVersion.get()}")) + } + } +} diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt new file mode 100644 index 000000000000..57b656b564c2 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareGlogTask.kt @@ -0,0 +1,79 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import java.io.File +import org.apache.tools.ant.filters.ReplaceTokens +import org.gradle.api.DefaultTask +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.file.DuplicatesStrategy +import org.gradle.api.provider.Property +import org.gradle.api.tasks.* + +/** + * A task that takes care of extracting Glog from a source folder/zip and preparing it to be + * consumed by the NDK. This task will also take care of applying the mapping for Glog parameters. + */ +abstract class PrepareGlogTask : DefaultTask() { + + @get:InputFiles abstract val glogPath: ConfigurableFileCollection + + @get:Input abstract val glogVersion: Property + + @get:OutputDirectory abstract val outputDir: DirectoryProperty + + @TaskAction + fun taskAction() { + project.copy { + it.from(glogPath) + it.from(project.file("src/main/jni/third-party/glog/")) + it.include("glog-${glogVersion.get()}/src/**/*", "Android.mk", "config.h") + it.duplicatesStrategy = DuplicatesStrategy.WARN + it.includeEmptyDirs = false + it.filesMatching("**/*.h.in") { matchedFile -> + matchedFile.filter( + mapOf( + "tokens" to + mapOf( + "ac_cv_have_unistd_h" to "1", + "ac_cv_have_stdint_h" to "1", + "ac_cv_have_systypes_h" to "1", + "ac_cv_have_inttypes_h" to "1", + "ac_cv_have_libgflags" to "0", + "ac_google_start_namespace" to "namespace google {", + "ac_cv_have_uint16_t" to "1", + "ac_cv_have_u_int16_t" to "1", + "ac_cv_have___uint16" to "0", + "ac_google_end_namespace" to "}", + "ac_cv_have___builtin_expect" to "1", + "ac_google_namespace" to "google", + "ac_cv___attribute___noinline" to "__attribute__ ((noinline))", + "ac_cv___attribute___noreturn" to "__attribute__ ((noreturn))", + "ac_cv___attribute___printf_4_5" to + "__attribute__((__format__ (__printf__, 4, 5)))")), + ReplaceTokens::class.java) + matchedFile.path = (matchedFile.name.removeSuffix(".in")) + } + it.into(outputDir) + } + val exportedDir = File(outputDir.asFile.get(), "exported/glog/").apply { mkdirs() } + project.copy { + it.from(outputDir) + it.include( + "stl_logging.h", + "logging.h", + "raw_logging.h", + "vlog_is_on.h", + "**/src/glog/log_severity.h") + it.eachFile { file -> file.path = file.name } + it.includeEmptyDirs = false + it.into(exportedDir) + } + } +} diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt new file mode 100644 index 000000000000..18a1db7826db --- /dev/null +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareJSCTask.kt @@ -0,0 +1,50 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import java.io.File +import org.gradle.api.DefaultTask +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.* + +/** + * A task that takes care of unbundling JSC and preparing it for be consumed by the Android NDK. + * Specifically it will unbundle shared libs, headers and will copy over the Makefile from + * `src/main/jni/third-party/jsc/` + */ +abstract class PrepareJSCTask : DefaultTask() { + + @get:Input abstract val jscPackagePath: Property + + @get:OutputDirectory abstract val outputDir: DirectoryProperty + + @TaskAction + fun taskAction() { + if (!jscPackagePath.isPresent || jscPackagePath.orNull == null) { + error("Could not find the jsc-android npm package") + } + val jscDist = File(jscPackagePath.get(), "dist") + if (!jscDist.exists()) { + error("The jsc-android npm package is missing its \"dist\" directory") + } + val jscAAR = + project.fileTree(jscDist).matching { it.include("**/android-jsc/**/*.aar") }.singleFile + val soFiles = project.zipTree(jscAAR).matching { it.include("**/*.so") } + val headerFiles = project.fileTree(jscDist).matching { it.include("**/include/*.h") } + + project.copy { it -> + it.from(soFiles) + it.from(headerFiles) + it.from(project.file("src/main/jni/third-party/jsc/Android.mk")) + it.filesMatching("**/*.h") { it.path = "JavaScriptCore/${it.name}" } + it.includeEmptyDirs = false + it.into(outputDir) + } + } +} diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt new file mode 100644 index 000000000000..4f709fed88d1 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTask.kt @@ -0,0 +1,53 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import java.io.File +import org.gradle.api.DefaultTask +import org.gradle.api.file.ConfigurableFileCollection +import org.gradle.api.file.DirectoryProperty +import org.gradle.api.provider.Property +import org.gradle.api.tasks.* + +/** + * A task that takes care of extracting Libevent from a source folder/zip and preparing it to be + * consumed by the NDK. + */ +abstract class PrepareLibeventTask : DefaultTask() { + + @get:InputFiles abstract val libeventPath: ConfigurableFileCollection + + @get:Input abstract val libeventVersion: Property + + @get:OutputDirectory abstract val outputDir: DirectoryProperty + + @TaskAction + fun taskAction() { + project.copy { it -> + it.from(libeventPath) + it.from(project.file("src/main/jni/third-party/libevent/Android.mk")) + it.from(project.file("src/main/jni/third-party/libevent/event-config.h")) + it.from(project.file("src/main/jni/third-party/libevent/evconfig-private.h")) + it.include( + "libevent-${libeventVersion.get()}-stable/*.c", + "libevent-${libeventVersion.get()}-stable/*.h", + "libevent-${libeventVersion.get()}-stable/include/**/*", + "evconfig-private.h", + "event-config.h", + "Android.mk") + it.eachFile { it.path = it.path.removePrefix("libevent-${libeventVersion.get()}-stable/") } + it.includeEmptyDirs = false + it.into(outputDir) + } + File(outputDir.asFile.get(), "event-config.h").apply { + val destination = + File(this.parentFile, "include/event2/event-config.h").apply { parentFile.mkdirs() } + renameTo(destination) + } + } +} diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/FileUtils.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/FileUtils.kt index 040fe0673bb0..28774b823595 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/FileUtils.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/FileUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt index d677d2d95916..17f5e874a97c 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/Os.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,12 +7,10 @@ package com.facebook.react.utils -import java.util.* - object Os { fun isWindows(): Boolean = - System.getProperty("os.name")?.toLowerCase(Locale.ROOT)?.contains("windows") ?: false + System.getProperty("os.name")?.lowercase()?.contains("windows") ?: false fun String.unixifyPath() = this.replace('\\', '/').replace(":", "").let { diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt index 4a215f22fc3f..d485aa69bdf4 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/PathUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -11,7 +11,6 @@ package com.facebook.react.utils import com.facebook.react.ReactExtension import java.io.File -import java.util.* import org.apache.tools.ant.taskdefs.condition.Os /** @@ -25,7 +24,7 @@ import org.apache.tools.ant.taskdefs.condition.Os */ internal fun detectedEntryFile(config: ReactExtension): File = detectEntryFile( - entryFile = config.entryFile.orNull?.asFile, reactRoot = config.reactRoot.get().asFile) + entryFile = config.entryFile.orNull?.asFile, reactRoot = config.root.get().asFile) /** * Computes the CLI location for React Native. The Algo follows this order: @@ -40,7 +39,7 @@ internal fun detectedCliPath( ): String = detectCliPath( projectDir = projectDir, - reactRoot = config.reactRoot.get().asFile, + reactRoot = config.root.get().asFile, preconfiguredCliPath = config.cliPath.orNull) /** @@ -68,7 +67,18 @@ private fun detectCliPath( ): String { // 1. preconfigured path if (preconfiguredCliPath != null) { - return File(projectDir, preconfiguredCliPath).toString() + val preconfiguredCliJsAbsolute = File(preconfiguredCliPath) + if (preconfiguredCliJsAbsolute.exists()) { + return preconfiguredCliJsAbsolute.absolutePath + } + val preconfiguredCliJsRelativeToReactRoot = File(reactRoot, preconfiguredCliPath) + if (preconfiguredCliJsRelativeToReactRoot.exists()) { + return preconfiguredCliJsRelativeToReactRoot.absolutePath + } + val preconfiguredCliJsRelativeToProject = File(projectDir, preconfiguredCliPath) + if (preconfiguredCliJsRelativeToProject.exists()) { + return preconfiguredCliJsRelativeToProject.absolutePath + } } // 2. node module path @@ -82,7 +92,10 @@ private fun detectCliPath( val nodeProcessOutput = nodeProcess.inputStream.use { it.bufferedReader().readText().trim() } if (nodeProcessOutput.isNotEmpty()) { - return nodeProcessOutput + val nodeModuleCliJs = File(nodeProcessOutput) + if (nodeModuleCliJs.exists()) { + return nodeModuleCliJs.absolutePath + } } // 3. cli.js in the root folder @@ -93,7 +106,8 @@ private fun detectCliPath( error( "Couldn't determine CLI location. " + - "Please set `project.react.cliPath` to the path of the react-native cli.js") + "Please set `project.react.cliPath` to the path of the react-native cli.js file. " + + "This file typically resides in `node_modules/react-native/cli.js`") } // Make sure not to inspect the Hermes config unless we need it, @@ -120,5 +134,5 @@ private fun getHermesOSBin(): String { internal fun projectPathToLibraryName(projectPath: String): String = projectPath .split(':', '-', '_', '.') - .joinToString("") { it.capitalize(Locale.ROOT) } + .joinToString("") { token -> token.replaceFirstChar { it.uppercase() } } .plus("Spec") diff --git a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt index dc4f1ac01c8c..fd557079f59d 100644 --- a/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt +++ b/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -14,13 +14,6 @@ internal fun windowsAwareCommandLine(vararg args: Any): List = args.toList() } -internal fun windowsAwareYarn(vararg args: Any): List = - if (Os.isWindows()) { - listOf("yarn.cmd") + args - } else { - listOf("yarn") + args - } - internal fun windowsAwareBashCommandLine( vararg args: String, bashWindowsHome: String? = null diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/AndroidConfigurationTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/AndroidConfigurationTest.kt index 34f799ed5053..55b919a3e4d6 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/AndroidConfigurationTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/AndroidConfigurationTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt new file mode 100644 index 000000000000..39caba83bfaf --- /dev/null +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/ReactPluginTest.kt @@ -0,0 +1,56 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react + +import com.android.build.gradle.AppExtension +import org.gradle.testfixtures.ProjectBuilder +import org.junit.Assert.assertTrue +import org.junit.Test + +class ReactPluginTest { + + @Test + fun reactPlugin_withApplyAppPluginSetToTrue_addsARelevantTask() { + val project = ProjectBuilder.builder().build() + project.plugins.apply("com.android.application") + project.plugins.apply("com.facebook.react") + + project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) } + project.extensions.getByType(ReactExtension::class.java).apply { + applyAppPlugin.set(true) + cliPath.set(".") + } + + // We check if the App Plugin si applied by finding one of the added task. + assertTrue(project.getTasksByName("bundleDebugJsAndAssets", false).isNotEmpty()) + } + + @Test + fun reactPlugin_withApplyAppPluginSetToFalse_doesNotApplyTheAppPlugin() { + val project = ProjectBuilder.builder().build() + project.plugins.apply("com.android.application") + project.plugins.apply("com.facebook.react") + + project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) } + project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(false) } + + assertTrue(project.getTasksByName("bundleDebugJsAndAssets", false).isEmpty()) + } + + @Test + fun reactPlugin_withApplyAppPluginSetToFalse_codegenPluginIsApplied() { + val project = ProjectBuilder.builder().build() + project.plugins.apply("com.android.application") + project.plugins.apply("com.facebook.react") + + project.extensions.getByType(AppExtension::class.java).apply { compileSdkVersion(31) } + project.extensions.getByType(ReactExtension::class.java).apply { applyAppPlugin.set(false) } + + assertTrue(project.getTasksByName("buildCodegenCLI", false).isNotEmpty()) + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/TestReactExtension.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/TestReactExtension.kt index e5c684b29caa..afc9ff358ea9 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/TestReactExtension.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/TestReactExtension.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/BuildCodegenCLITaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/BuildCodegenCLITaskTest.kt index 240d0c11d24c..33db1357ebdf 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/BuildCodegenCLITaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/BuildCodegenCLITaskTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt index b07244f49e81..900086e43c91 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenArtifactsTaskTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -79,13 +79,13 @@ class GenerateCodegenArtifactsTaskTest { @Test @WithOs(OS.UNIX) fun setupCommandLine_withoutJavaGenerator_willSetupCorrectly() { - val reactRoot = tempFolder.newFolder("node_modules/react-native/") + val reactNativeDir = tempFolder.newFolder("node_modules/react-native/") val codegenDir = tempFolder.newFolder("codegen") val outputDir = tempFolder.newFolder("output") val task = createTestTask { - it.reactRoot.set(reactRoot) + it.reactNativeDir.set(reactNativeDir) it.codegenDir.set(codegenDir) it.generatedSrcDir.set(outputDir) it.nodeExecutableAndArgs.set(listOf("--verbose")) @@ -99,11 +99,16 @@ class GenerateCodegenArtifactsTaskTest { listOf( "yarn", "--verbose", - File(reactRoot, "scripts/generate-specs-cli.js").toString(), + File(reactNativeDir, "scripts/generate-specs-cli.js").toString(), + "--platform", "android", + "--schemaPath", File(outputDir, "schema.json").toString(), + "--outputDir", outputDir.toString(), + "--libraryName", "example-test", + "--javaPackageName", "com.example.test", ), task.commandLine.toMutableList()) diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt index cb092dfc6ec9..8a3b59841534 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateCodegenSchemaTaskTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt new file mode 100644 index 000000000000..38394e3bf431 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/ExtractJniAndHeadersTaskTest.kt @@ -0,0 +1,72 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import com.facebook.react.tests.createProject +import com.facebook.react.tests.createTestTask +import com.facebook.react.tests.zipFiles +import java.io.* +import java.util.zip.ZipEntry +import java.util.zip.ZipOutputStream +import org.junit.Assert.assertTrue +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder + +class ExtractJniAndHeadersTaskTest { + + @get:Rule val tempFolder = TemporaryFolder() + + @Test + fun extractJniAndHeadersTask_extractsHeadersCorrectly() { + val project = createProject() + val aarFile = File(project.projectDir, "libheader.aar") + val headerFile = tempFolder.newFile("justaheader.h") + val output = tempFolder.newFolder("output") + zipFiles(aarFile, listOf(headerFile)) + + val task = + createTestTask(project = project) { + it.extractHeadersConfiguration.setFrom(aarFile) + it.baseOutputDir.set(output) + } + + task.taskAction() + + assertTrue(File(output, "libheader/headers/justaheader.h").exists()) + } + + @Test + fun extractJniAndHeadersTask_extractsJniCorrectly() { + val project = createProject() + val aarFile = File(project.projectDir, "something.aar") + File(tempFolder.root, "jni/libsomething.so").apply { + parentFile.mkdirs() + createNewFile() + } + val output = tempFolder.newFolder("output") + ZipOutputStream(BufferedOutputStream(FileOutputStream(aarFile.absolutePath))).use { out -> + FileInputStream(aarFile).use { fi -> + BufferedInputStream(fi).use { origin -> + out.putNextEntry(ZipEntry("jni/")) + out.putNextEntry(ZipEntry("jni/libsomething.so")) + origin.copyTo(out, 1024) + } + } + } + val task = + createTestTask(project = project) { + it.extractJniConfiguration.setFrom(aarFile) + it.baseOutputDir.set(output) + } + + task.taskAction() + + assertTrue(File(output, "something/jni/libsomething.so").exists()) + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt new file mode 100644 index 000000000000..d1ebb9c665f7 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareBoostTaskTest.kt @@ -0,0 +1,105 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import com.facebook.react.tests.createProject +import com.facebook.react.tests.createTestTask +import java.io.* +import org.junit.Assert.* +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder + +class PrepareBoostTaskTest { + + @get:Rule val tempFolder = TemporaryFolder() + + @Test(expected = IllegalStateException::class) + fun prepareBoostTask_withMissingConfiguration_fails() { + val task = createTestTask() + + task.taskAction() + } + + @Test + fun prepareBoostTask_copiesMakefile() { + val boostpath = tempFolder.newFolder("boostpath") + val output = tempFolder.newFolder("output") + val project = createProject() + val task = + createTestTask(project = project) { + it.boostPath.setFrom(boostpath) + it.boostVersion.set("1.0.0") + it.outputDir.set(output) + } + File(project.projectDir, "src/main/jni/third-party/boost/Android.mk").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(output.listFiles()!!.any { it.name == "Android.mk" }) + } + + @Test + fun prepareBoostTask_copiesAsmFiles() { + val boostpath = tempFolder.newFolder("boostpath") + val output = tempFolder.newFolder("output") + val task = + createTestTask() { + it.boostPath.setFrom(boostpath) + it.boostVersion.set("1.0.0") + it.outputDir.set(output) + } + File(boostpath, "asm/asm.S").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(File(output, "asm/asm.S").exists()) + } + + @Test + fun prepareBoostTask_copiesBoostSourceFiles() { + val boostpath = tempFolder.newFolder("boostpath") + val output = tempFolder.newFolder("output") + val task = + createTestTask { + it.boostPath.setFrom(boostpath) + it.boostVersion.set("1.0.0") + it.outputDir.set(output) + } + File(boostpath, "boost_1.0.0/boost/config.hpp").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(File(output, "boost_1.0.0/boost/config.hpp").exists()) + } + + @Test + fun prepareBoostTask_copiesVersionlessBoostSourceFiles() { + val boostpath = tempFolder.newFolder("boostpath") + val output = tempFolder.newFolder("output") + val task = + createTestTask { + it.boostPath.setFrom(boostpath) + it.boostVersion.set("1.0.0") + it.outputDir.set(output) + } + File(boostpath, "boost/boost/config.hpp").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(File(output, "boost_1.0.0/boost/config.hpp").exists()) + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt new file mode 100644 index 000000000000..ceb0c916e16d --- /dev/null +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareGlogTaskTest.kt @@ -0,0 +1,130 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import com.facebook.react.tests.createProject +import com.facebook.react.tests.createTestTask +import java.io.* +import org.junit.Assert.* +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder + +class PrepareGlogTaskTest { + + @get:Rule val tempFolder = TemporaryFolder() + + @Test(expected = IllegalStateException::class) + fun prepareGlogTask_withMissingConfiguration_fails() { + val task = createTestTask() + + task.taskAction() + } + + @Test + fun prepareGlogTask_copiesMakefile() { + val glogpath = tempFolder.newFolder("glogpath") + val output = tempFolder.newFolder("output") + val project = createProject() + val task = + createTestTask(project = project) { + it.glogPath.setFrom(glogpath) + it.glogVersion.set("1.0.0") + it.outputDir.set(output) + } + File(project.projectDir, "src/main/jni/third-party/glog/Android.mk").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(output.listFiles()!!.any { it.name == "Android.mk" }) + } + + @Test + fun prepareGlogTask_copiesConfigHeaderFile() { + val glogpath = tempFolder.newFolder("glogpath") + val output = tempFolder.newFolder("output") + val project = createProject() + val task = + createTestTask(project = project) { + it.glogPath.setFrom(glogpath) + it.glogVersion.set("1.0.0") + it.outputDir.set(output) + } + File(project.projectDir, "src/main/jni/third-party/glog/config.h").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(output.listFiles()!!.any { it.name == "config.h" }) + } + + @Test + fun prepareGlogTask_copiesSourceCode() { + val glogpath = tempFolder.newFolder("glogpath") + val output = tempFolder.newFolder("output") + val task = + createTestTask { + it.glogPath.setFrom(glogpath) + it.glogVersion.set("1.0.0") + it.outputDir.set(output) + } + File(glogpath, "glog-1.0.0/src/glog.cpp").apply { + parentFile.mkdirs() + createNewFile() + } + + task.taskAction() + + assertTrue(File(output, "glog-1.0.0/src/glog.cpp").exists()) + } + + @Test + fun prepareGlogTask_replacesTokenCorrectly() { + val glogpath = tempFolder.newFolder("glogpath") + val output = tempFolder.newFolder("output") + val task = + createTestTask { + it.glogPath.setFrom(glogpath) + it.glogVersion.set("1.0.0") + it.outputDir.set(output) + } + File(glogpath, "glog-1.0.0/src/glog.h.in").apply { + parentFile.mkdirs() + writeText("ac_google_start_namespace") + } + + task.taskAction() + + val expectedFile = File(output, "glog.h") + assertTrue(expectedFile.exists()) + assertEquals("ac_google_start_namespace", expectedFile.readText()) + } + + @Test + fun prepareGlogTask_exportsHeaderCorrectly() { + val glogpath = tempFolder.newFolder("glogpath") + val output = tempFolder.newFolder("output") + val task = + createTestTask { + it.glogPath.setFrom(glogpath) + it.glogVersion.set("1.0.0") + it.outputDir.set(output) + } + File(glogpath, "glog-1.0.0/src/logging.h.in").apply { + parentFile.mkdirs() + writeText("ac_google_start_namespace") + } + + task.taskAction() + + assertTrue(File(output, "exported/glog/logging.h").exists()) + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt new file mode 100644 index 000000000000..669664b88142 --- /dev/null +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareJSCTaskTest.kt @@ -0,0 +1,128 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import com.facebook.react.tests.createProject +import com.facebook.react.tests.createTestTask +import com.facebook.react.tests.zipFiles +import java.io.* +import org.junit.Assert.* +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder + +class PrepareJSCTaskTest { + + @get:Rule val tempFolder = TemporaryFolder() + + @Test(expected = IllegalStateException::class) + fun prepareJSCTask_withMissingPackage_fails() { + val task = createTestTask() + + task.taskAction() + } + + @Test(expected = IllegalStateException::class) + fun prepareJSCTask_withNullPackage_fails() { + val task = createTestTask { it.jscPackagePath.set(null as String?) } + + task.taskAction() + } + + @Test(expected = IllegalStateException::class) + fun prepareJSCTask_withMissingDistFolder_fails() { + val task = + createTestTask { it.jscPackagePath.set(tempFolder.root.absolutePath) } + + task.taskAction() + } + + @Test + fun prepareJSCTask_ignoresEmptyDirs() { + prepareInputFolder() + val output = tempFolder.newFolder("output") + File(tempFolder.root, "dist/just/an/empty/folders/").apply { mkdirs() } + + val task = + createTestTask { + it.jscPackagePath.set(tempFolder.root.absolutePath) + it.outputDir.set(output) + } + + task.taskAction() + + assertFalse(File(output, "just/an/empty/folders/").exists()) + } + + @Test + fun prepareJSCTask_copiesSoFiles() { + val soFile = tempFolder.newFile("libsomething.so") + prepareInputFolder(aarContent = listOf(soFile)) + val output = tempFolder.newFolder("output") + + val task = + createTestTask { + it.jscPackagePath.set(tempFolder.root.absolutePath) + it.outputDir.set(output) + } + + task.taskAction() + + assertEquals("libsomething.so", output.listFiles()?.first()?.name) + } + + @Test + fun prepareJSCTask_copiesHeaderFilesToCorrectFolder() { + prepareInputFolder() + File(tempFolder.root, "dist/include/justaheader.h").apply { + parentFile.mkdirs() + createNewFile() + } + val output = tempFolder.newFolder("output") + + val task = + createTestTask { + it.jscPackagePath.set(tempFolder.root.absolutePath) + it.outputDir.set(output) + } + + task.taskAction() + + assertTrue(File(output, "JavaScriptCore/justaheader.h").exists()) + } + + @Test + fun prepareJSCTask_copiesMakefile() { + val project = createProject() + prepareInputFolder() + File(project.projectDir, "src/main/jni/third-party/jsc/Android.mk").apply { + parentFile.mkdirs() + createNewFile() + } + val output = tempFolder.newFolder("output") + + val task = + createTestTask(project = project) { + it.jscPackagePath.set(tempFolder.root.absolutePath) + it.outputDir.set(output) + } + + task.taskAction() + + assertTrue(File(output, "Android.mk").exists()) + } + + private fun prepareInputFolder(aarContent: List = listOf(tempFolder.newFile())) { + val dist = tempFolder.newFolder("dist") + File(dist, "android-jsc/android-library.aar").apply { + parentFile.mkdirs() + createNewFile() + } + zipFiles(File(dist, "android-jsc/android-library.aar"), aarContent) + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt new file mode 100644 index 000000000000..1bb571fa769b --- /dev/null +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/internal/PrepareLibeventTaskTest.kt @@ -0,0 +1,101 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +package com.facebook.react.tasks.internal + +import com.facebook.react.tests.createProject +import com.facebook.react.tests.createTestTask +import java.io.* +import org.junit.Assert.* +import org.junit.Rule +import org.junit.Test +import org.junit.rules.TemporaryFolder + +class PrepareLibeventTaskTest { + + @get:Rule val tempFolder = TemporaryFolder() + + @Test(expected = IllegalStateException::class) + fun prepareBoostTask_withMissingConfiguration_fails() { + val task = createTestTask() + + task.taskAction() + } + + @Test + fun prepareBoostTask_copiesMakefile() { + val libeventPath = tempFolder.newFolder("libeventPath") + val output = tempFolder.newFolder("output") + val project = createProject() + val task = + createTestTask(project = project) { + it.libeventPath.setFrom(libeventPath) + it.libeventVersion.set("1.0.0") + it.outputDir.set(output) + } + File(project.projectDir, "src/main/jni/third-party/libevent/Android.mk").apply { + parentFile.mkdirs() + createNewFile() + } + task.taskAction() + + assertTrue(File(output, "Android.mk").exists()) + } + + @Test + fun prepareBoostTask_copiesConfigFiles() { + val libeventPath = tempFolder.newFolder("libeventPath") + val output = tempFolder.newFolder("output") + val project = createProject() + val task = + createTestTask(project = project) { + it.libeventPath.setFrom(libeventPath) + it.libeventVersion.set("1.0.0") + it.outputDir.set(output) + } + File(project.projectDir, "src/main/jni/third-party/libevent/event-config.h").apply { + parentFile.mkdirs() + createNewFile() + } + File(project.projectDir, "src/main/jni/third-party/libevent/evconfig-private.h").createNewFile() + + task.taskAction() + + assertTrue(File(output, "evconfig-private.h").exists()) + assertTrue(File(output, "include/event2/event-config.h").exists()) + } + + @Test + fun prepareBoostTask_copiesSourceFiles() { + val libeventPath = tempFolder.newFolder("libeventPath") + val output = tempFolder.newFolder("output") + val task = + createTestTask { + it.libeventPath.setFrom(libeventPath) + it.libeventVersion.set("1.0.0") + it.outputDir.set(output) + } + File(libeventPath, "libevent-1.0.0-stable/sample.c").apply { + parentFile.mkdirs() + createNewFile() + } + File(libeventPath, "libevent-1.0.0-stable/sample.h").apply { + parentFile.mkdirs() + createNewFile() + } + File(libeventPath, "libevent-1.0.0-stable/include/sample.h").apply { + parentFile.mkdirs() + createNewFile() + } + + task.taskAction() + + assertTrue(File(output, "sample.c").exists()) + assertTrue(File(output, "sample.h").exists()) + assertTrue(File(output, "include/sample.h").exists()) + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/OsRule.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/OsRule.kt index 33d4dacd3746..1b3e7cfcc4d8 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/OsRule.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/OsRule.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/TaskTestUtils.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/TaskTestUtils.kt index 67e89e1fa142..04122985cad3 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/TaskTestUtils.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/TaskTestUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -7,6 +7,9 @@ package com.facebook.react.tests +import java.io.* +import java.util.zip.ZipEntry +import java.util.zip.ZipOutputStream import org.gradle.api.Project import org.gradle.api.Task import org.gradle.testfixtures.ProjectBuilder @@ -23,3 +26,18 @@ internal inline fun createTestTask( taskName: String = T::class.java.simpleName, crossinline block: (T) -> Unit = {} ): T = project.tasks.register(taskName, T::class.java) { block(it) }.get() + +/** A util function to zip a list of files from [contents] inside the zipfile at [destination]. */ +internal fun zipFiles(destination: File, contents: List) { + ZipOutputStream(BufferedOutputStream(FileOutputStream(destination.absolutePath))).use { out -> + for (file in contents) { + FileInputStream(file).use { fi -> + BufferedInputStream(fi).use { origin -> + val entry = ZipEntry(file.name) + out.putNextEntry(entry) + origin.copyTo(out, 1024) + } + } + } + } +} diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/WithOs.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/WithOs.kt index cd1118331e31..beda3142cd30 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/WithOs.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tests/WithOs.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/FileUtilsTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/FileUtilsTest.kt index be38dd6fa877..a47e6ed47b88 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/FileUtilsTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/FileUtilsTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/OsTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/OsTest.kt index 987a6d841637..e5fe9b695586 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/OsTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/OsTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt index 8c9b4434698d..0c9d36690790 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/PathUtilsTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -33,7 +33,7 @@ class PathUtilsTest { @Test fun detectedEntryFile_withAndroidEntryPoint() { val extension = TestReactExtension(ProjectBuilder.builder().build()) - extension.reactRoot.set(tempFolder.root) + extension.root.set(tempFolder.root) tempFolder.newFile("index.android.js") val actual = detectedEntryFile(extension) @@ -44,7 +44,7 @@ class PathUtilsTest { @Test fun detectedEntryFile_withDefaultEntryPoint() { val extension = TestReactExtension(ProjectBuilder.builder().build()) - extension.reactRoot.set(tempFolder.root) + extension.root.set(tempFolder.root) val actual = detectedEntryFile(extension) @@ -52,10 +52,47 @@ class PathUtilsTest { } @Test - fun detectedCliPath_withCliPathFromExtension() { + fun detectedCliPath_withCliPathFromExtensionAbsolute() { val project = ProjectBuilder.builder().build() val extension = TestReactExtension(project) - val expected = File(project.projectDir, "fake-cli.sh") + val expected = + File(project.projectDir, "abs/fake-cli.sh").apply { + parentFile.mkdirs() + writeText("") + } + extension.cliPath.set(project.projectDir + "/abs/fake-cli.sh") + + val actual = detectedCliPath(project.projectDir, extension) + + assertEquals(expected.toString(), actual) + } + + @Test + fun detectedCliPath_withCliPathFromExtensionInReactFolder() { + val project = ProjectBuilder.builder().build() + val extension = TestReactExtension(project) + val expected = + File(project.projectDir, "/react-root/fake-cli.sh").apply { + parentFile.mkdirs() + writeText("") + } + extension.cliPath.set("fake-cli.sh") + extension.reactRoot.set(project.projectDir + "/react-root") + + val actual = detectedCliPath(project.projectDir, extension) + + assertEquals(expected.toString(), actual) + } + + @Test + fun detectedCliPath_withCliPathFromExtensionInProjectFolder() { + val project = ProjectBuilder.builder().build() + val extension = TestReactExtension(project) + val expected = + File(project.projectDir, "fake-cli.sh").apply { + parentFile.mkdirs() + writeText("") + } extension.cliPath.set("fake-cli.sh") val actual = detectedCliPath(project.projectDir, extension) @@ -80,7 +117,7 @@ class PathUtilsTest { fun detectedCliPath_withCliFromNodeModules() { val project = ProjectBuilder.builder().build() val extension = TestReactExtension(project) - extension.reactRoot.set(tempFolder.root) + extension.root.set(tempFolder.root) val expected = File(tempFolder.root, "node_modules/react-native/cli.js").apply { parentFile.mkdirs() diff --git a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/TaskUtilsTest.kt b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/TaskUtilsTest.kt index 90ac0063189b..8156ef029e71 100644 --- a/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/TaskUtilsTest.kt +++ b/packages/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/utils/TaskUtilsTest.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. @@ -42,24 +42,6 @@ class TaskUtilsTest { assertEquals(listOf("cmd", "/c", "a", "b", "c"), windowsAwareCommandLine("a", "b", "c")) } - @Test - @WithOs(OS.MAC) - fun windowsAwareYarn_onMac_returnsTheList() { - assertEquals(listOf("yarn", "a", "b", "c"), windowsAwareYarn("a", "b", "c")) - } - - @Test - @WithOs(OS.UNIX) - fun windowsAwareYarn_onLinux_returnsTheList() { - assertEquals(listOf("yarn", "a", "b", "c"), windowsAwareYarn("a", "b", "c")) - } - - @Test - @WithOs(OS.WIN) - fun windowsAwareYarn_onWindows_prependsCmd() { - assertEquals(listOf("yarn.cmd", "a", "b", "c"), windowsAwareYarn("a", "b", "c")) - } - @Test @WithOs(OS.MAC) fun windowsAwareBashCommandLine_onMac_returnsTheList() { diff --git a/packages/rn-tester/BUCK b/packages/rn-tester/BUCK index b62e80d495cf..6fdf40b6c761 100644 --- a/packages/rn-tester/BUCK +++ b/packages/rn-tester/BUCK @@ -1,3 +1,4 @@ +load("@fbsource//xplat/hermes/defs:hermes.bzl", "HERMES_BYTECODE_VERSION") load("//tools/build_defs:fb_native_wrapper.bzl", "fb_native") load("//tools/build_defs:fb_xplat_platform_specific_rule.bzl", "fb_xplat_platform_specific_rule") load("//tools/build_defs:fb_xplat_resource.bzl", "fb_xplat_resource") @@ -13,6 +14,7 @@ load( "YOGA_APPLE_TARGET", "js_glob", "make_resource_glob", + "react_fabric_component_plugin_provider", "react_module_plugin_providers", "rn_apple_library", "rn_extra_build_flags", @@ -48,6 +50,7 @@ rn_library( [ "js", "NativeModuleExample", + "NativeComponentExample", "RCTTest", ], excludes = [ @@ -57,7 +60,9 @@ rn_library( "js/examples/WebSocket/websocket_test_server.js", ], ), + codegen_components = True, labels = ["supermodule:xplat/default/public.react_native.playground"], + native_component_spec_name = "MyNativeViewSpec", skip_processors = True, visibility = ["PUBLIC"], deps = [ @@ -75,6 +80,9 @@ fb_native.filegroup( [ "**/*NativeComponent.js", ], + exclude = [ + "NativeComponentExample/**/*", + ], ), visibility = ["PUBLIC"], ) @@ -120,7 +128,9 @@ fb_apple_test( "QuartzCore", "UIKit", ], - preprocessor_flags = get_objc_arc_preprocessor_flags() + get_preprocessor_flags_for_build_mode(), + preprocessor_flags = get_objc_arc_preprocessor_flags() + [ + "-DHERMES_BYTECODE_VERSION={}".format(HERMES_BYTECODE_VERSION), + ] + get_preprocessor_flags_for_build_mode(), visibility = [ "//fbobjc/Libraries/FBReactKit:workspace", ], @@ -270,3 +280,40 @@ rn_apple_library( YOGA_APPLE_TARGET, ], ) + +rn_xplat_cxx_library2( + name = "NativeComponentExample", + plugins_only = True, + srcs = glob( + [ + "NativeComponentExample/ios/*.m", + "NativeComponentExample/ios/*.mm", + ], + ), + headers = glob( + [ + "NativeComponentExample/ios/*.h", + ], + ), + header_namespace = "", + compiler_flags = [ + "-fexceptions", + "-frtti", + "-std=c++17", + "-Wall", + ], + contacts = ["oncall+react_native@xmail.facebook.com"], + labels = [ + "supermodule:xplat/default/public.react_native.infra", + ], + plugins = [ + react_fabric_component_plugin_provider("RNTMyNativeView", "RNTMyNativeViewCls"), + ], + plugins_header = "RCTFabricComponentsPlugins.h", + reexport_all_header_dependencies = False, + visibility = ["PUBLIC"], + deps = [ + ":generated_components-MyNativeViewSpec", + "//xplat/js/react-native-github:RCTFabricComponentViewsBase", + ], +) diff --git a/packages/rn-tester/Gemfile b/packages/rn-tester/Gemfile index cefffcd9c8bd..7c4f5b666796 100644 --- a/packages/rn-tester/Gemfile +++ b/packages/rn-tester/Gemfile @@ -1,5 +1,5 @@ # Gemfile source 'https://rubygems.org' -gem 'cocoapods', '= 1.11.2' +gem 'cocoapods', '~> 1.11', '>= 1.11.2' gem 'rexml' diff --git a/packages/rn-tester/NativeComponentExample/MyNativeView.podspec b/packages/rn-tester/NativeComponentExample/MyNativeView.podspec new file mode 100644 index 000000000000..a9db83577242 --- /dev/null +++ b/packages/rn-tester/NativeComponentExample/MyNativeView.podspec @@ -0,0 +1,47 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +require "json" + +package = JSON.parse(File.read(File.join(__dir__, "../" "package.json"))) + +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' +folly_version = '2021.06.28.00-v2' +boost_version = '1.76.0' +boost_compiler_flags = '-Wno-documentation' + +Pod::Spec.new do |s| + s.name = "MyNativeView" + s.version = package["version"] + s.summary = package["description"] + s.description = "my-native-view" + s.homepage = "https://github.com/sota000/my-native-view.git" + s.license = "MIT" + s.platforms = { :ios => "11.0", :tvos => "11.0" } + s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags + ' -Wno-nullability-completeness' + s.author = "Facebook, Inc. and its affiliates" + s.source = { :git => "https://github.com/facebook/my-native-view.git", :tag => "#{s.version}" } + s.pod_target_xcconfig = { + "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"", + } + + s.source_files = "ios/**/*.{h,m,mm,cpp}" + s.requires_arc = true + + s.dependency "React" + s.dependency "React-RCTFabric" + s.dependency "React-Codegen" + s.dependency "RCTRequired" + s.dependency "RCTTypeSafety" + s.dependency "ReactCommon/turbomodule/core" + + # Enable codegen for this library + use_react_native_codegen!(s, { + :library_name => "MyNativeViewSpec", + :react_native_path => "../../../", + :js_srcs_dir => "./js", + :library_type => "components" + }) +end diff --git a/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.h b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.h new file mode 100644 index 000000000000..6d7adce1eabb --- /dev/null +++ b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RNTMyNativeViewComponentView : RCTViewComponentView + +- (UIColor *)UIColorFromHexString:(const std::string)hexString; + +@end + +NS_ASSUME_NONNULL_END diff --git a/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm new file mode 100644 index 000000000000..7c5d0ac794c5 --- /dev/null +++ b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewComponentView.mm @@ -0,0 +1,88 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import "RNTMyNativeViewComponentView.h" + +#import +#import +#import +#import + +#import "RCTFabricComponentsPlugins.h" + +using namespace facebook::react; + +@interface RNTMyNativeViewComponentView () +@end + +@implementation RNTMyNativeViewComponentView { + UIView *_view; +} + ++ (ComponentDescriptorProvider)componentDescriptorProvider +{ + return concreteComponentDescriptorProvider(); +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + static const auto defaultProps = std::make_shared(); + _props = defaultProps; + + _view = [[UIView alloc] init]; + _view.backgroundColor = [UIColor redColor]; + + self.contentView = _view; + } + + return self; +} + +- (UIColor *)UIColorFromHexString:(const std::string)hexString +{ + unsigned rgbValue = 0; + NSString *colorString = [NSString stringWithCString:hexString.c_str() encoding:[NSString defaultCStringEncoding]]; + NSScanner *scanner = [NSScanner scannerWithString:colorString]; + [scanner setScanLocation:1]; // bypass '#' character + [scanner scanHexInt:&rgbValue]; + return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16) / 255.0 + green:((rgbValue & 0xFF00) >> 8) / 255.0 + blue:(rgbValue & 0xFF) / 255.0 + alpha:1.0]; +} + +- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps +{ + [super updateProps:props oldProps:oldProps]; +} + +- (void)onChange:(UIView *)sender +{ + // No-op + // std::dynamic_pointer_cast(_eventEmitter) + // ->onChange(ViewEventEmitter::OnChange{.value = static_cast(sender.on)}); +} + +#pragma mark - Native Commands + +- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args +{ + RCTRNTMyNativeViewHandleCommand(self, commandName, args); +} + +- (void)callNativeMethodToChangeBackgroundColor:(NSString *)colorString +{ + UIColor *color = [self UIColorFromHexString:std::string([colorString UTF8String])]; + _view.backgroundColor = color; +} +@end + +Class RNTMyNativeViewCls(void) +{ + return RNTMyNativeViewComponentView.class; +} diff --git a/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewManager.mm b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewManager.mm new file mode 100644 index 000000000000..83d8f231d425 --- /dev/null +++ b/packages/rn-tester/NativeComponentExample/ios/RNTMyNativeViewManager.mm @@ -0,0 +1,49 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import +#import +#import + +@interface RNTMyNativeViewManager : RCTViewManager +@end + +@implementation RNTMyNativeViewManager + +RCT_EXPORT_MODULE(RNTMyNativeView) + +RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) + +RCT_EXPORT_METHOD(callNativeMethodToChangeBackgroundColor : (nonnull NSNumber *)reactTag color : (NSString *)color) +{ + [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { + UIView *view = viewRegistry[reactTag]; + if (!view || ![view isKindOfClass:[UIView class]]) { + RCTLogError(@"Cannot find NativeView with tag #%@", reactTag); + return; + } + + unsigned rgbValue = 0; + NSString *colorString = [NSString stringWithCString:std::string([color UTF8String]).c_str() + encoding:[NSString defaultCStringEncoding]]; + NSScanner *scanner = [NSScanner scannerWithString:colorString]; + [scanner setScanLocation:1]; // bypass '#' character + [scanner scanHexInt:&rgbValue]; + + view.backgroundColor = [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16) / 255.0 + green:((rgbValue & 0xFF00) >> 8) / 255.0 + blue:(rgbValue & 0xFF) / 255.0 + alpha:1.0]; + }]; +} + +- (UIView *)view +{ + return [[UIView alloc] init]; +} + +@end diff --git a/packages/rn-tester/NativeComponentExample/js/MyNativeView.js b/packages/rn-tester/NativeComponentExample/js/MyNativeView.js new file mode 100644 index 000000000000..373e6d22f856 --- /dev/null +++ b/packages/rn-tester/NativeComponentExample/js/MyNativeView.js @@ -0,0 +1,62 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow strict-local + * @format + */ + +import * as React from 'react'; +import {useRef, useState} from 'react'; +import {View, Button} from 'react-native'; +import RNTMyNativeView, { + Commands as RNTMyNativeViewCommands, +} from './MyNativeViewNativeComponent'; +import type {MyNativeViewType} from './MyNativeViewNativeComponent'; + +const colors = [ + '#0000FF', + '#FF0000', + '#00FF00', + '#003300', + '#330000', + '#000033', +]; + +// This is an example component that migrates to use the new architecture. +export default function MyNativeView(props: {}): React.Node { + const ref = useRef | null>(null); + const [opacity, setOpacity] = useState(1.0); + return ( + + +