├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── BUG_REPORT.MD │ └── FEATURE_REQUEST.MD ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── ci.yml │ └── codeql-analysis.yml ├── .gitignore ├── .nvmrc ├── .watchmanconfig ├── .yarn └── releases │ └── yarn-3.4.1.cjs ├── .yarnrc.yml ├── CONTRIBUTING.md ├── LICENSE ├── LICENSE-3rdparty.csv ├── NOTICE ├── README.md ├── android ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── perfkiller │ │ ├── PerfKillerModuleImpl.kt │ │ └── PerfKillerPackage.kt │ ├── newarch │ └── java │ │ └── com │ │ └── perfkiller │ │ └── PerfKillerModule.kt │ └── oldarch │ └── java │ └── com │ └── perfkiller │ └── PerfKillerModule.kt ├── babel.config.js ├── bin └── check-licenses.js ├── example ├── .bundle │ └── config ├── .node-version ├── .ruby-version ├── .watchmanconfig ├── Gemfile ├── android │ ├── app │ │ ├── _BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ ├── AndroidManifest.xml │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── perfkillerexample │ │ │ │ └── ReactNativeFlipper.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── perfkillerexample │ │ │ │ ├── MainActivity.java │ │ │ │ ├── MainApplication.java │ │ │ │ └── newarchitecture │ │ │ │ ├── MainApplicationReactNativeHost.java │ │ │ │ ├── components │ │ │ │ └── MainComponentsRegistry.java │ │ │ │ └── modules │ │ │ │ └── MainApplicationTurboModuleManagerDelegate.java │ │ │ ├── jni │ │ │ ├── CMakeLists.txt │ │ │ ├── MainApplicationModuleProvider.cpp │ │ │ ├── MainApplicationModuleProvider.h │ │ │ ├── MainApplicationTurboModuleManagerDelegate.cpp │ │ │ ├── MainApplicationTurboModuleManagerDelegate.h │ │ │ ├── MainComponentsRegistry.cpp │ │ │ ├── MainComponentsRegistry.h │ │ │ └── OnLoad.cpp │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── .xcode.env │ ├── File.swift │ ├── PerfKillerExample-Bridging-Header.h │ ├── PerfKillerExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── PerfKillerExample.xcscheme │ ├── PerfKillerExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── PerfKillerExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.mm │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── main.m │ ├── PerfKillerExampleTests │ │ ├── Info.plist │ │ └── PerfKillerExampleTests.m │ ├── Podfile │ └── Podfile.lock ├── metro.config.js ├── package.json ├── react-native.config.js ├── src │ └── App.tsx └── yarn.lock ├── ios ├── PerfKiller.h ├── PerfKiller.mm └── PerfKiller.xcodeproj │ └── project.pbxproj ├── lefthook.yml ├── package.json ├── react-native-performance-limiter.podspec ├── scripts └── bootstrap.js ├── src ├── NativePerfKiller.ts ├── __tests__ │ └── index.test.tsx └── index.tsx ├── tsconfig.build.json ├── tsconfig.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Global code owners - RUM Mobile Team 2 | 3 | * @DataDog/rum-mobile 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/BUG_REPORT.MD: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a bug 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | --- 8 | 9 | **Describe what happened** 10 | Include any error message or stack trace if available. 11 | 12 | **Steps to reproduce the issue:** 13 | 📝 14 | 15 | **Expected behaviour:** 16 | 📝 17 | 18 | **Actual behaviour:** 19 | 📝 20 | 21 | **Additional context** 22 | 23 | - react-native version 24 | - react-native-performance-limiter version 25 | 26 | - an explanation of what might cause the bug and/or how it can be fixed 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/FEATURE_REQUEST.MD: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea or request a feature 4 | title: "" 5 | labels: enhancement 6 | assignees: "" 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe:** 10 | 📝 A clear and concise description of what the problem is. 11 | 12 | **Describe the solution you'd like:** 13 | 📝 A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered:** 16 | 📝 A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context:** 19 | 📝 Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### What and why? 2 | 3 | A short description of what changes this PR introduces and why. 4 | 5 | ### How? 6 | 7 | A brief description of implementation details of this PR. 8 | 9 | ### Review checklist 10 | 11 | - [ ] Feature or bugfix MUST have appropriate tests (unit) 12 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | # This workflow will do a clean install of node dependencies and run tests 2 | 3 | name: Continuous Integration 4 | 5 | on: push 6 | 7 | jobs: 8 | build-and-test: 9 | name: Build and test 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Install node 14 | uses: actions/setup-node@v1 15 | with: 16 | node-version: '18.0.0' 17 | - run: yarn install --immutable 18 | - run: yarn typecheck 19 | - run: yarn lint 20 | - run: yarn test 21 | - run: yarn prepack 22 | 23 | check-licenses: 24 | name: Check licenses 25 | runs-on: ubuntu-latest 26 | 27 | steps: 28 | - uses: actions/checkout@v2 29 | - name: Install node 30 | uses: actions/setup-node@v1 31 | with: 32 | node-version: '18.0.0' 33 | - run: yarn install --immutable 34 | - run: yarn check-licenses 35 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | pull_request: 7 | # The branches below must be a subset of the branches above 8 | branches: [ "main" ] 9 | 10 | jobs: 11 | analyze: 12 | name: Analyze 13 | runs-on: ubuntu-latest 14 | permissions: 15 | actions: read 16 | contents: read 17 | security-events: write 18 | 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | language: [ 'javascript' ] 23 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 24 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support 25 | 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v3 29 | 30 | # Initializes the CodeQL tools for scanning. 31 | - name: Initialize CodeQL 32 | uses: github/codeql-action/init@v2 33 | with: 34 | languages: ${{ matrix.language }} 35 | # If you wish to specify custom queries, you can do so here or in a config file. 36 | # By default, queries listed here will override any specified in a config file. 37 | # Prefix the list here with "+" to use these queries and those in the config file. 38 | 39 | # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs 40 | # queries: security-extended,security-and-quality 41 | 42 | 43 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 44 | # If this step fails, then you should remove it and run the build manually (see below) 45 | - name: Autobuild 46 | uses: github/codeql-action/autobuild@v2 47 | 48 | - name: Perform CodeQL Analysis 49 | uses: github/codeql-action/analyze@v2 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | 32 | # Android/IJ 33 | # 34 | .classpath 35 | .cxx 36 | .gradle 37 | .idea 38 | .project 39 | .settings 40 | local.properties 41 | android.iml 42 | 43 | # Cocoapods 44 | # 45 | example/ios/Pods 46 | 47 | # Ruby 48 | example/vendor/ 49 | 50 | # node.js 51 | # 52 | node_modules/ 53 | npm-debug.log 54 | yarn-debug.log 55 | yarn-error.log 56 | 57 | # BUCK 58 | buck-out/ 59 | \.buckd/ 60 | android/app/libs 61 | android/keystores/debug.keystore 62 | 63 | # Expo 64 | .expo/ 65 | 66 | # Turborepo 67 | .turbo/ 68 | 69 | # generated by bob 70 | lib/ 71 | 72 | # Yarn ignored files 73 | .pnp.* 74 | .yarn/* 75 | !.yarn/patches 76 | !.yarn/plugins 77 | !.yarn/releases 78 | !.yarn/sdks 79 | !.yarn/versions 80 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | 16.18.1 2 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | yarnPath: .yarn/releases/yarn-3.4.1.cjs 2 | nodeLinker: node-modules 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | First of all, thanks for contributing! 4 | 5 | This document provides some basic guidelines for contributing to this repository. 6 | To propose improvements, feel free to submit a PR or open an Issue. 7 | 8 | ## Setup your developer Environment 9 | 10 | To get started with the project, clone it, then run `yarn install` in the root directory to install the required dependencies for each package: 11 | 12 | ```bash 13 | yarn install 14 | ``` 15 | 16 | ## Testing your changes locally 17 | 18 | We strongly encourage you to write unit tests. 19 | All commands and steps take the absolute path to the project as a parameter to make testing easier. 20 | 21 | You can test your changes in the example application located under the `example/` directory. 22 | 23 | ## Submitting Issues 24 | 25 | Many great ideas for new features come from the community, and we'd be happy to 26 | consider yours! 27 | 28 | To share your request, you can open an [issue](https://github.com/DataDog/react-native-performance-limiter/issues/new) 29 | with the details about what you'd like to see. At a minimum, please provide: 30 | 31 | - The goal of the new feature; 32 | - A description of how it might be used or behave; 33 | - Links to any important resources (e.g. Github repos, websites, screenshots, 34 | specifications, diagrams). 35 | 36 | ## Found a bug? 37 | 38 | For any urgent matters (such as outages) or issues concerning the Datadog service 39 | or UI, contact our support team via https://docs.datadoghq.com/help/ for direct, 40 | faster assistance. 41 | 42 | You may submit bug reports concerning React Native Performance Limiter by 43 | [opening a Github issue](https://github.com/DataDog/react-native-performance-limiter/issues/new). 44 | At a minimum, please provide: 45 | 46 | - A description of the problem; 47 | - Steps to reproduce; 48 | - Expected behavior; 49 | - Actual behavior; 50 | - Errors (with stack traces) or warnings received; 51 | - Any details you can share about your configuration including: 52 | - node version; 53 | - react-native version; 54 | - react-native-performance-limiter version; 55 | 56 | If at all possible, also provide: 57 | 58 | - Screenshots, links, or other visual aids that are publicly accessible; 59 | - Code sample or test that reproduces the problem; 60 | - An explanation of what causes the bug and/or how it can be fixed. 61 | 62 | Reports that include rich detail are better, and ones with code that reproduce 63 | the bug are best. 64 | 65 | ## Have a patch? 66 | 67 | We welcome code contributions to the library, which you can 68 | [submit as a pull request](https://github.com/DataDog/react-native-performance-limiter/pull/new/master). 69 | Before you submit a PR, make sure that you first create an Issue to explain the 70 | bug or the feature your patch covers, and make sure another Issue or PR doesn't 71 | already exist. 72 | 73 | To create a pull request: 74 | 75 | 1. **Fork the repository** from https://github.com/DataDog/react-native-performance-limiter ; 76 | 2. **Make any changes** for your patch; 77 | 3. **Write tests** that demonstrate how the feature works or how the bug is fixed; 78 | 4. **Update any documentation**, especially for new features; 79 | 5. **Submit the pull request** from your fork back to this 80 | [repository](https://github.com/DataDog/react-native-performance-limiter) . 81 | 82 | The pull request will be run through our CI pipeline, and a project member will 83 | review the changes with you. At a minimum, to be accepted and merged, pull 84 | requests must: 85 | 86 | - Have a stated goal and detailed description of the changes made; 87 | - Include thorough test coverage and documentation, where applicable; 88 | - Pass all tests and code quality checks (linting/coverage/benchmarks) on CI; 89 | - Receive at least one approval from a project member with push permissions. 90 | 91 | Make sure that your code is clean and readable, that your commits are small and 92 | atomic, with a proper commit message. 93 | 94 | ## Releasing a new version 95 | 96 | 1. Create a branch named `release/x.y.z` 97 | 1. Increment the version in package.json 98 | 1. Run `yarn pack`, unpack the archive and check all relevant files are there 99 | 1. Run `yarn build` 100 | 1. Run `yarn publish` 101 | 1. Create a release with a tag on Github 102 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2022 Datadog, Inc. 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-3rdparty.csv: -------------------------------------------------------------------------------- 1 | Component,Origin,Licence,Copyright 2 | @react-native-community/eslint-config,dev,MIT,"Copyright (c) Facebook, Inc. and its affiliates." 3 | @types/jest,dev,MIT,"Copyrights are respective of each contributor listed at the beginning of each definition file." 4 | @types/react,dev,MIT,"Copyrights are respective of each contributor listed at the beginning of each definition file." 5 | @types/react-native,dev,MIT,"Copyrights are respective of each contributor listed at the beginning of each definition file." 6 | eslint,dev,MIT,"Copyright OpenJS Foundation and other contributors, " 7 | eslint-config-prettier,dev,MIT,"Copyright (c) 2017, 2018, 2019, 2020, 2021, 2022 Simon Lydell and contributors" 8 | eslint-plugin-prettier,dev,MIT,"Copyright © 2017 Andres Suarez and Teddy Katz" 9 | jest,dev,MIT,"Copyright (c) Facebook, Inc. and its affiliates." 10 | prettier,dev,MIT,"Copyright © James Long and contributors" 11 | react,dev,MIT,"Copyright (c) Facebook, Inc. and its affiliates." 12 | react-native,dev,MIT,"Copyright (c) Facebook, Inc. and its affiliates." 13 | react-native-builder-bob,dev,MIT,"Copyright (c) 2017 React Native Community" 14 | typescript,dev,Apache-2.0,"Copyright (c) Microsoft Corporation." 15 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Datadog react-native-performance-limiter 2 | Copyright 2022 Datadog, Inc. 3 | 4 | This product includes software developed at Datadog (https://www.datadoghq.com/). 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-performance-limiter 2 | 3 | A package for intentionally lowering performance and generating crashes on React Native applications. 4 | 5 | Use `blockJavascriptThread` and `blockNativeMainThread` to test your implementation of performance monitoring tools, `crashJavascriptThread` and `crashNativeMainThread` to test your implementation of crash reporting tools. 6 | 7 | ## Installation 8 | 9 | ```sh 10 | npm install react-native-performance-limiter 11 | ``` 12 | 13 | ```sh 14 | yarn add react-native-performance-limiter 15 | ``` 16 | 17 | Then re-install your pods: 18 | 19 | ```sh 20 | (cd ios && pod install) 21 | ``` 22 | 23 | ## Usage 24 | 25 | ### Block the javascript thread 26 | 27 | ```js 28 | import { blockJavascriptThread } from 'react-native-performance-limiter'; 29 | 30 | blockJavascriptThread(1000); // blocks javascript thread for 1 second 31 | ``` 32 | 33 | ### Block the native main thread 34 | 35 | ```js 36 | import { blockNativeMainThread } from 'react-native-performance-limiter'; 37 | 38 | blockNativeMainThread(1000); // blocks native main thread for 1 second 39 | ``` 40 | 41 | Inside functions you can `await` for the block to be finised: 42 | 43 | ```js 44 | const myfun = async () => { 45 | await blockNativeMainThread(1000); 46 | // do something else afterwards 47 | }; 48 | ``` 49 | 50 | ### Crash the app from the javascript thread 51 | 52 | ```js 53 | import { crashJavascriptThread } from 'react-native-performance-limiter'; 54 | 55 | crashJavascriptThread('custom error message'); 56 | ``` 57 | 58 | ### Crash the app from the native main thread 59 | 60 | ```js 61 | import { crashNativeMainThread } from 'react-native-performance-limiter'; 62 | 63 | crashNativeMainThread('custom error message'); 64 | ``` 65 | 66 | ## Contributing 67 | 68 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. 69 | 70 | --- 71 | 72 | Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob) 73 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | // Buildscript is evaluated before everything else so we can't use getExtOrDefault 3 | def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["PerfKiller_kotlinVersion"] 4 | 5 | repositories { 6 | google() 7 | mavenCentral() 8 | } 9 | 10 | dependencies { 11 | classpath "com.android.tools.build:gradle:7.2.1" 12 | // noinspection DifferentKotlinGradleVersion 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | def isNewArchitectureEnabled() { 18 | return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" 19 | } 20 | 21 | apply plugin: "com.android.library" 22 | apply plugin: "kotlin-android" 23 | 24 | if (isNewArchitectureEnabled()) { 25 | apply plugin: "com.facebook.react" 26 | } 27 | 28 | def getExtOrDefault(name) { 29 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["PerfKiller_" + name] 30 | } 31 | 32 | def getExtOrIntegerDefault(name) { 33 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["PerfKiller_" + name]).toInteger() 34 | } 35 | 36 | android { 37 | compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") 38 | 39 | defaultConfig { 40 | minSdkVersion getExtOrIntegerDefault("minSdkVersion") 41 | targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") 42 | buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() 43 | } 44 | buildTypes { 45 | release { 46 | minifyEnabled false 47 | } 48 | } 49 | 50 | lintOptions { 51 | disable "GradleCompatible" 52 | } 53 | 54 | compileOptions { 55 | sourceCompatibility JavaVersion.VERSION_1_8 56 | targetCompatibility JavaVersion.VERSION_1_8 57 | } 58 | 59 | sourceSets { 60 | main { 61 | if (isNewArchitectureEnabled()) { 62 | java.srcDirs += [ 63 | "src/newarch", 64 | // This is needed to build Kotlin project with NewArch enabled 65 | "${project.buildDir}/generated/source/codegen/java" 66 | ] 67 | } else { 68 | java.srcDirs += ["src/oldarch"] 69 | } 70 | } 71 | } 72 | } 73 | 74 | repositories { 75 | mavenCentral() 76 | google() 77 | } 78 | 79 | def kotlin_version = getExtOrDefault("kotlinVersion") 80 | 81 | def resolveReactNativeDirectory() { 82 | def reactNativeLocation = rootProject.hasProperty("reactNativeDir") ? rootProject.getProperty("reactNativeDir") : null 83 | 84 | if (reactNativeLocation != null) { 85 | return file(reactNativeLocation) 86 | } 87 | 88 | try { 89 | // Resolve React Native location with Node 90 | // This will make sure that we get installation location correctly in monorepos 91 | def reactNativePackageJsonPathStdout = new ByteArrayOutputStream() 92 | 93 | exec { 94 | commandLine("node", "-p", "require.resolve('react-native/package.json')") 95 | ignoreExitValue true 96 | standardOutput = reactNativePackageJsonPathStdout 97 | } 98 | 99 | def reactNativeFromProjectNodeModules = file(reactNativePackageJsonPathStdout.toString().trim()).getParentFile(); 100 | 101 | if (reactNativeFromProjectNodeModules.exists()) { 102 | return reactNativeFromProjectNodeModules 103 | } 104 | } catch (e) { 105 | // Ignore 106 | } 107 | 108 | throw new Exception( 109 | "${project.name}: Failed to resolve 'react-native' in the project. " + 110 | "Altenatively, you can specify 'reactNativeDir' with the path to 'react-native' in your 'gradle.properties' file." 111 | ) 112 | } 113 | 114 | def reactNativeRootDir = resolveReactNativeDirectory() 115 | def reactProperties = new Properties() 116 | file("$reactNativeRootDir/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) } 117 | 118 | def reactNativeVersion = reactProperties.getProperty("VERSION_NAME") 119 | def (reactNativeMajorVersion, reactNativeMinorVersion) = reactNativeVersion.split("\\.").collect { it.isInteger() ? it.toInteger() : it } 120 | 121 | dependencies { 122 | if (reactNativeMajorVersion == 0 && reactNativeMinorVersion < 71) { 123 | // noinspection GradleDynamicVersion 124 | api 'com.facebook.react:react-native:+' 125 | } else { 126 | api "com.facebook.react:react-android" 127 | } 128 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 129 | } 130 | 131 | if (isNewArchitectureEnabled()) { 132 | react { 133 | jsRootDir = file("../src/") 134 | libraryName = "PerfKiller" 135 | codegenJavaPackageName = "com.perfkiller" 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | PerfKiller_kotlinVersion=1.7.0 2 | PerfKiller_minSdkVersion=21 3 | PerfKiller_targetSdkVersion=31 4 | PerfKiller_compileSdkVersion=31 5 | PerfKiller_ndkversion=21.4.7075529 6 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /android/src/main/java/com/perfkiller/PerfKillerModuleImpl.kt: -------------------------------------------------------------------------------- 1 | package com.perfkiller 2 | 3 | import android.os.Handler 4 | import android.os.Looper 5 | import com.facebook.react.bridge.Promise 6 | import java.lang.RuntimeException 7 | import java.util.Date 8 | 9 | class PerfKillerModuleImpl { 10 | companion object { 11 | fun blockNativeMainThread(durationMs: Double, promise: Promise) { 12 | Handler(Looper.getMainLooper()).post { 13 | val startTime = Date().time 14 | while((Date().time - startTime) < durationMs.toLong()) { 15 | // do nothing 16 | } 17 | promise.resolve(null) 18 | } 19 | } 20 | 21 | fun crashNativeMainThread(message: String, promise: Promise) { 22 | throw RuntimeException(message) 23 | promise.resolve(null) 24 | } 25 | 26 | const val NAME = "PerfKiller" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /android/src/main/java/com/perfkiller/PerfKillerPackage.kt: -------------------------------------------------------------------------------- 1 | package com.perfkiller 2 | 3 | import com.facebook.react.TurboReactPackage 4 | import com.facebook.react.bridge.ReactApplicationContext 5 | import com.facebook.react.bridge.NativeModule 6 | import com.facebook.react.module.model.ReactModuleInfoProvider 7 | import com.facebook.react.module.model.ReactModuleInfo 8 | import java.util.HashMap 9 | 10 | class PerfKillerPackage : TurboReactPackage() { 11 | override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? { 12 | return if (name == PerfKillerModuleImpl.NAME) { 13 | PerfKillerModule(reactContext) 14 | } else { 15 | null 16 | } 17 | } 18 | 19 | override fun getReactModuleInfoProvider(): ReactModuleInfoProvider { 20 | return ReactModuleInfoProvider { 21 | val moduleInfos: MutableMap = HashMap() 22 | val isTurboModule: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 23 | moduleInfos[PerfKillerModuleImpl.NAME] = ReactModuleInfo( 24 | PerfKillerModuleImpl.NAME, 25 | PerfKillerModuleImpl.NAME, 26 | false, // canOverrideExistingModule 27 | false, // needsEagerInit 28 | true, // hasConstants 29 | false, // isCxxModule 30 | isTurboModule // isTurboModule 31 | ) 32 | moduleInfos 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /android/src/newarch/java/com/perfkiller/PerfKillerModule.kt: -------------------------------------------------------------------------------- 1 | package com.perfkiller 2 | 3 | import android.os.Handler 4 | import android.os.Looper 5 | import com.facebook.react.bridge.ReactApplicationContext 6 | import com.facebook.react.bridge.Promise 7 | import java.lang.RuntimeException 8 | import java.util.Date 9 | 10 | class PerfKillerModule internal constructor(context: ReactApplicationContext) : 11 | NativePerfKillerSpec(context) { 12 | 13 | override fun getName(): String { 14 | return PerfKillerModuleImpl.NAME 15 | } 16 | 17 | override fun blockNativeMainThread(durationMs: Double, promise: Promise) { 18 | PerfKillerModuleImpl.blockNativeMainThread(durationMs, promise) 19 | } 20 | 21 | override fun crashNativeMainThread(message: String, promise: Promise) { 22 | PerfKillerModuleImpl.crashNativeMainThread(message, promise) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/src/oldarch/java/com/perfkiller/PerfKillerModule.kt: -------------------------------------------------------------------------------- 1 | package com.perfkiller 2 | 3 | import android.os.Handler 4 | import android.os.Looper 5 | import com.facebook.react.bridge.ReactApplicationContext 6 | import com.facebook.react.bridge.ReactContextBaseJavaModule; 7 | import com.facebook.react.bridge.ReactMethod 8 | import com.facebook.react.bridge.Promise 9 | import java.lang.RuntimeException 10 | import java.util.Date 11 | 12 | class PerfKillerModule internal constructor(context: ReactApplicationContext) : 13 | ReactContextBaseJavaModule(context) { 14 | 15 | override fun getName(): String { 16 | return PerfKillerModuleImpl.NAME 17 | } 18 | 19 | @ReactMethod 20 | fun blockNativeMainThread(durationMs: Double, promise: Promise) { 21 | PerfKillerModuleImpl.blockNativeMainThread(durationMs, promise) 22 | } 23 | 24 | @ReactMethod 25 | fun crashNativeMainThread(message: String, promise: Promise) { 26 | PerfKillerModuleImpl.crashNativeMainThread(message, promise) 27 | } 28 | 29 | companion object { 30 | const val NAME = "PerfKiller" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /bin/check-licenses.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // from @datadog/datadog-ci 3 | 4 | const fs = require('fs'); 5 | const path = require('path'); 6 | const readline = require('readline'); 7 | const util = require('util'); 8 | const exec = util.promisify(require('child_process').exec); 9 | 10 | const LICENSE_FILE = 'LICENSE-3rdparty.csv'; 11 | 12 | async function main() { 13 | const packageJsonPaths = await findPackageJsonPaths(); 14 | 15 | console.log(`Look for dependencies in:\n`, packageJsonPaths); 16 | const declaredDependencies = withoutDuplicates( 17 | packageJsonPaths.reduce( 18 | (acc, packageJsonPath) => 19 | acc.concat(retrievePackageJsonDependencies(packageJsonPath)), 20 | [] 21 | ) 22 | ).sort(); 23 | 24 | const declaredLicenses = (await retrieveLicenses()).sort(); 25 | 26 | if ( 27 | JSON.stringify(declaredDependencies) !== JSON.stringify(declaredLicenses) 28 | ) { 29 | console.error(JSON.stringify(declaredDependencies, null, 2)); 30 | console.error(JSON.stringify(declaredLicenses, null, 2)); 31 | console.error( 32 | `\n❌ package.json dependencies and ${LICENSE_FILE} mismatch` 33 | ); 34 | console.error( 35 | `\nIn package.json but not in ${LICENSE_FILE}:\n`, 36 | declaredDependencies.filter((d) => !declaredLicenses.includes(d)) 37 | ); 38 | console.error( 39 | `\nIn ${LICENSE_FILE} but not in package.json:\n`, 40 | declaredLicenses.filter((d) => !declaredDependencies.includes(d)) 41 | ); 42 | throw new Error('dependencies mismatch'); 43 | } 44 | console.log(`\n✅ All dependencies listed in ${LICENSE_FILE}`); 45 | } 46 | 47 | async function findPackageJsonPaths() { 48 | const { stdout } = await exec( 49 | 'find . -path "*/node_modules/*" -or -path "*/__tests__/*" -or -path "*/example/*" -prune -o -name "package.json" -print' 50 | ); 51 | return stdout.trim().split('\n'); 52 | } 53 | 54 | function retrievePackageJsonDependencies(packageJsonPath) { 55 | const packageJson = require(path.join(__dirname, '..', packageJsonPath)); 56 | 57 | return Object.keys(packageJson.dependencies || {}) 58 | .concat(Object.keys(packageJson.devDependencies || {})) 59 | .filter((dependency) => !dependency.includes('@datadog')); 60 | } 61 | 62 | function withoutDuplicates(a) { 63 | return [...new Set(a)]; 64 | } 65 | 66 | async function retrieveLicenses() { 67 | const fileStream = fs.createReadStream( 68 | path.join(__dirname, '..', LICENSE_FILE) 69 | ); 70 | const rl = readline.createInterface({ input: fileStream }); 71 | const licenses = []; 72 | let header = true; 73 | for await (const line of rl) { 74 | const csvColumns = line.split(','); 75 | if (!header && csvColumns[0] !== 'file') { 76 | licenses.push(csvColumns[0]); 77 | } 78 | header = false; 79 | } 80 | return licenses; 81 | } 82 | 83 | main().catch((e) => { 84 | console.error('\nStacktrace:\n', e); 85 | process.exit(1); 86 | }); 87 | -------------------------------------------------------------------------------- /example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /example/.node-version: -------------------------------------------------------------------------------- 1 | 16 2 | -------------------------------------------------------------------------------- /example/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.7.5 2 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby '2.7.5' 5 | 6 | gem 'cocoapods', '~> 1.11', '>= 1.11.2' 7 | -------------------------------------------------------------------------------- /example/android/app/_BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.perfkillerexample", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.perfkillerexample", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | import org.apache.tools.ant.taskdefs.condition.Os 5 | 6 | /** 7 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 8 | * and bundleReleaseJsAndAssets). 9 | * These basically call `react-native bundle` with the correct arguments during the Android build 10 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 11 | * bundle directly from the development server. Below you can see all the possible configurations 12 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 13 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 14 | * 15 | * project.ext.react = [ 16 | * // the name of the generated asset file containing your JS bundle 17 | * bundleAssetName: "index.android.bundle", 18 | * 19 | * // the entry file for bundle generation. If none specified and 20 | * // "index.android.js" exists, it will be used. Otherwise "index.js" is 21 | * // default. Can be overridden with ENTRY_FILE environment variable. 22 | * entryFile: "index.android.js", 23 | * 24 | * // https://reactnative.dev/docs/performance#enable-the-ram-format 25 | * bundleCommand: "ram-bundle", 26 | * 27 | * // whether to bundle JS and assets in debug mode 28 | * bundleInDebug: false, 29 | * 30 | * // whether to bundle JS and assets in release mode 31 | * bundleInRelease: true, 32 | * 33 | * // whether to bundle JS and assets in another build variant (if configured). 34 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 35 | * // The configuration property can be in the following formats 36 | * // 'bundleIn${productFlavor}${buildType}' 37 | * // 'bundleIn${buildType}' 38 | * // bundleInFreeDebug: true, 39 | * // bundleInPaidRelease: true, 40 | * // bundleInBeta: true, 41 | * 42 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 43 | * // for example: to disable dev mode in the staging build type (if configured) 44 | * devDisabledInStaging: true, 45 | * // The configuration property can be in the following formats 46 | * // 'devDisabledIn${productFlavor}${buildType}' 47 | * // 'devDisabledIn${buildType}' 48 | * 49 | * // the root of your project, i.e. where "package.json" lives 50 | * root: "../../", 51 | * 52 | * // where to put the JS bundle asset in debug mode 53 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 54 | * 55 | * // where to put the JS bundle asset in release mode 56 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 57 | * 58 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 59 | * // require('./image.png')), in debug mode 60 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 61 | * 62 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 63 | * // require('./image.png')), in release mode 64 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 65 | * 66 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 67 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 68 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 69 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 70 | * // for example, you might want to remove it from here. 71 | * inputExcludes: ["android/**", "ios/**"], 72 | * 73 | * // override which node gets called and with what additional arguments 74 | * nodeExecutableAndArgs: ["node"], 75 | * 76 | * // supply additional arguments to the packager 77 | * extraPackagerArgs: [] 78 | * ] 79 | */ 80 | 81 | project.ext.react = [ 82 | enableHermes: true, // clean and rebuild if changing 83 | ] 84 | 85 | apply from: "../../node_modules/react-native/react.gradle" 86 | 87 | /** 88 | * Set this to true to create two separate APKs instead of one: 89 | * - An APK that only works on ARM devices 90 | * - An APK that only works on x86 devices 91 | * The advantage is the size of the APK is reduced by about 4MB. 92 | * Upload all the APKs to the Play Store and people will download 93 | * the correct one based on the CPU architecture of their device. 94 | */ 95 | def enableSeparateBuildPerCPUArchitecture = false 96 | 97 | /** 98 | * Run Proguard to shrink the Java bytecode in release builds. 99 | */ 100 | def enableProguardInReleaseBuilds = false 101 | 102 | /** 103 | * The preferred build flavor of JavaScriptCore. 104 | * 105 | * For example, to use the international variant, you can use: 106 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` 107 | * 108 | * The international variant includes ICU i18n library and necessary data 109 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 110 | * give correct results when using with locales other than en-US. Note that 111 | * this variant is about 6MiB larger per architecture than default. 112 | */ 113 | def jscFlavor = 'org.webkit:android-jsc:+' 114 | 115 | /** 116 | * Whether to enable the Hermes VM. 117 | * 118 | * This should be set on project.ext.react and that value will be read here. If it is not set 119 | * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode 120 | * and the benefits of using Hermes will therefore be sharply reduced. 121 | */ 122 | def enableHermes = project.ext.react.get("enableHermes", false); 123 | 124 | /** 125 | * Architectures to build native code for. 126 | */ 127 | def reactNativeArchitectures() { 128 | def value = project.getProperties().get("reactNativeArchitectures") 129 | return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"] 130 | } 131 | 132 | android { 133 | ndkVersion rootProject.ext.ndkVersion 134 | 135 | compileSdkVersion rootProject.ext.compileSdkVersion 136 | 137 | defaultConfig { 138 | applicationId "com.perfkillerexample" 139 | minSdkVersion rootProject.ext.minSdkVersion 140 | targetSdkVersion rootProject.ext.targetSdkVersion 141 | versionCode 1 142 | versionName "1.0" 143 | buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() 144 | 145 | if (isNewArchitectureEnabled()) { 146 | // We configure the CMake build only if you decide to opt-in for the New Architecture. 147 | externalNativeBuild { 148 | cmake { 149 | arguments "-DPROJECT_BUILD_DIR=$buildDir", 150 | "-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid", 151 | "-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build", 152 | "-DNODE_MODULES_DIR=$rootDir/../node_modules", 153 | "-DANDROID_STL=c++_shared" 154 | } 155 | } 156 | if (!enableSeparateBuildPerCPUArchitecture) { 157 | ndk { 158 | abiFilters (*reactNativeArchitectures()) 159 | } 160 | } 161 | } 162 | } 163 | 164 | if (isNewArchitectureEnabled()) { 165 | // We configure the NDK build only if you decide to opt-in for the New Architecture. 166 | externalNativeBuild { 167 | cmake { 168 | path "$projectDir/src/main/jni/CMakeLists.txt" 169 | } 170 | } 171 | def reactAndroidProjectDir = project(':ReactAndroid').projectDir 172 | def packageReactNdkDebugLibs = tasks.register("packageReactNdkDebugLibs", Copy) { 173 | dependsOn(":ReactAndroid:packageReactNdkDebugLibsForBuck") 174 | from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") 175 | into("$buildDir/react-ndk/exported") 176 | } 177 | def packageReactNdkReleaseLibs = tasks.register("packageReactNdkReleaseLibs", Copy) { 178 | dependsOn(":ReactAndroid:packageReactNdkReleaseLibsForBuck") 179 | from("$reactAndroidProjectDir/src/main/jni/prebuilt/lib") 180 | into("$buildDir/react-ndk/exported") 181 | } 182 | afterEvaluate { 183 | // If you wish to add a custom TurboModule or component locally, 184 | // you should uncomment this line. 185 | // preBuild.dependsOn("generateCodegenArtifactsFromSchema") 186 | preDebugBuild.dependsOn(packageReactNdkDebugLibs) 187 | preReleaseBuild.dependsOn(packageReactNdkReleaseLibs) 188 | 189 | // Due to a bug inside AGP, we have to explicitly set a dependency 190 | // between configureCMakeDebug* tasks and the preBuild tasks. 191 | // This can be removed once this is solved: https://issuetracker.google.com/issues/207403732 192 | configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild) 193 | configureCMakeDebug.dependsOn(preDebugBuild) 194 | reactNativeArchitectures().each { architecture -> 195 | tasks.findByName("configureCMakeDebug[${architecture}]")?.configure { 196 | dependsOn("preDebugBuild") 197 | } 198 | tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure { 199 | dependsOn("preReleaseBuild") 200 | } 201 | } 202 | } 203 | } 204 | 205 | splits { 206 | abi { 207 | reset() 208 | enable enableSeparateBuildPerCPUArchitecture 209 | universalApk false // If true, also generate a universal APK 210 | include (*reactNativeArchitectures()) 211 | } 212 | } 213 | signingConfigs { 214 | debug { 215 | storeFile file('debug.keystore') 216 | storePassword 'android' 217 | keyAlias 'androiddebugkey' 218 | keyPassword 'android' 219 | } 220 | } 221 | buildTypes { 222 | debug { 223 | signingConfig signingConfigs.debug 224 | } 225 | release { 226 | // Caution! In production, you need to generate your own keystore file. 227 | // see https://reactnative.dev/docs/signed-apk-android. 228 | signingConfig signingConfigs.debug 229 | minifyEnabled enableProguardInReleaseBuilds 230 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 231 | } 232 | } 233 | 234 | // applicationVariants are e.g. debug, release 235 | applicationVariants.all { variant -> 236 | variant.outputs.each { output -> 237 | // For each separate APK per architecture, set a unique version code as described here: 238 | // https://developer.android.com/studio/build/configure-apk-splits.html 239 | // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc. 240 | def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] 241 | def abi = output.getFilter(OutputFile.ABI) 242 | if (abi != null) { // null for the universal-debug, universal-release variants 243 | output.versionCodeOverride = 244 | defaultConfig.versionCode * 1000 + versionCodes.get(abi) 245 | } 246 | 247 | } 248 | } 249 | } 250 | 251 | dependencies { 252 | implementation fileTree(dir: "libs", include: ["*.jar"]) 253 | 254 | //noinspection GradleDynamicVersion 255 | implementation "com.facebook.react:react-native:+" // From node_modules 256 | 257 | implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" 258 | 259 | debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") { 260 | exclude group:'com.facebook.fbjni' 261 | } 262 | 263 | debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") { 264 | exclude group:'com.facebook.flipper' 265 | exclude group:'com.squareup.okhttp3', module:'okhttp' 266 | } 267 | 268 | debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") { 269 | exclude group:'com.facebook.flipper' 270 | } 271 | 272 | if (enableHermes) { 273 | //noinspection GradleDynamicVersion 274 | implementation("com.facebook.react:hermes-engine:+") { // From node_modules 275 | exclude group:'com.facebook.fbjni' 276 | } 277 | } else { 278 | implementation jscFlavor 279 | } 280 | } 281 | 282 | if (isNewArchitectureEnabled()) { 283 | // If new architecture is enabled, we let you build RN from source 284 | // Otherwise we fallback to a prebuilt .aar bundled in the NPM package. 285 | // This will be applied to all the imported transtitive dependency. 286 | configurations.all { 287 | resolutionStrategy.dependencySubstitution { 288 | substitute(module("com.facebook.react:react-native")) 289 | .using(project(":ReactAndroid")) 290 | .because("On New Architecture we're building React Native from source") 291 | substitute(module("com.facebook.react:hermes-engine")) 292 | .using(project(":ReactAndroid:hermes-engine")) 293 | .because("On New Architecture we're building Hermes from source") 294 | } 295 | } 296 | } 297 | 298 | // Run this once to be able to run the application with BUCK 299 | // puts all compile dependencies into folder libs for BUCK to use 300 | task copyDownloadableDepsToLibs(type: Copy) { 301 | from configurations.implementation 302 | into 'libs' 303 | } 304 | 305 | apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) 306 | 307 | def isNewArchitectureEnabled() { 308 | // To opt-in for the New Architecture, you can either: 309 | // - Set `newArchEnabled` to true inside the `gradle.properties` file 310 | // - Invoke gradle with `-newArchEnabled=true` 311 | // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true` 312 | return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true" 313 | } 314 | -------------------------------------------------------------------------------- /example/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /example/android/app/src/debug/java/com/perfkillerexample/ReactNativeFlipper.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. 3 | * 4 | *

This source code is licensed under the MIT license found in the LICENSE file in the root 5 | * directory of this source tree. 6 | */ 7 | package com.perfkillerexample; 8 | 9 | import android.content.Context; 10 | import com.facebook.flipper.android.AndroidFlipperClient; 11 | import com.facebook.flipper.android.utils.FlipperUtils; 12 | import com.facebook.flipper.core.FlipperClient; 13 | import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; 14 | import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; 15 | import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; 16 | import com.facebook.flipper.plugins.inspector.DescriptorMapping; 17 | import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; 18 | import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; 19 | import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; 20 | import com.facebook.flipper.plugins.react.ReactFlipperPlugin; 21 | import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; 22 | import com.facebook.react.ReactInstanceEventListener; 23 | import com.facebook.react.ReactInstanceManager; 24 | import com.facebook.react.bridge.ReactContext; 25 | import com.facebook.react.modules.network.NetworkingModule; 26 | import okhttp3.OkHttpClient; 27 | 28 | public class ReactNativeFlipper { 29 | public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { 30 | if (FlipperUtils.shouldEnableFlipper(context)) { 31 | final FlipperClient client = AndroidFlipperClient.getInstance(context); 32 | 33 | client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); 34 | client.addPlugin(new ReactFlipperPlugin()); 35 | client.addPlugin(new DatabasesFlipperPlugin(context)); 36 | client.addPlugin(new SharedPreferencesFlipperPlugin(context)); 37 | client.addPlugin(CrashReporterPlugin.getInstance()); 38 | 39 | NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); 40 | NetworkingModule.setCustomClientBuilder( 41 | new NetworkingModule.CustomClientBuilder() { 42 | @Override 43 | public void apply(OkHttpClient.Builder builder) { 44 | builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); 45 | } 46 | }); 47 | client.addPlugin(networkFlipperPlugin); 48 | client.start(); 49 | 50 | // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized 51 | // Hence we run if after all native modules have been initialized 52 | ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); 53 | if (reactContext == null) { 54 | reactInstanceManager.addReactInstanceEventListener( 55 | new ReactInstanceEventListener() { 56 | @Override 57 | public void onReactContextInitialized(ReactContext reactContext) { 58 | reactInstanceManager.removeReactInstanceEventListener(this); 59 | reactContext.runOnNativeModulesQueueThread( 60 | new Runnable() { 61 | @Override 62 | public void run() { 63 | client.addPlugin(new FrescoFlipperPlugin()); 64 | } 65 | }); 66 | } 67 | }); 68 | } else { 69 | client.addPlugin(new FrescoFlipperPlugin()); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/perfkillerexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.perfkillerexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | import com.facebook.react.ReactActivityDelegate; 5 | import com.facebook.react.ReactRootView; 6 | 7 | public class MainActivity extends ReactActivity { 8 | 9 | /** 10 | * Returns the name of the main component registered from JavaScript. This is used to schedule 11 | * rendering of the component. 12 | */ 13 | @Override 14 | protected String getMainComponentName() { 15 | return "PerfKillerExample"; 16 | } 17 | 18 | /** 19 | * Returns the instance of the {@link ReactActivityDelegate}. There the RootView is created and 20 | * you can specify the renderer you wish to use - the new renderer (Fabric) or the old renderer 21 | * (Paper). 22 | */ 23 | @Override 24 | protected ReactActivityDelegate createReactActivityDelegate() { 25 | return new MainActivityDelegate(this, getMainComponentName()); 26 | } 27 | 28 | public static class MainActivityDelegate extends ReactActivityDelegate { 29 | public MainActivityDelegate(ReactActivity activity, String mainComponentName) { 30 | super(activity, mainComponentName); 31 | } 32 | 33 | @Override 34 | protected ReactRootView createRootView() { 35 | ReactRootView reactRootView = new ReactRootView(getContext()); 36 | // If you opted-in for the New Architecture, we enable the Fabric Renderer. 37 | reactRootView.setIsFabric(BuildConfig.IS_NEW_ARCHITECTURE_ENABLED); 38 | return reactRootView; 39 | } 40 | 41 | @Override 42 | protected boolean isConcurrentRootEnabled() { 43 | // If you opted-in for the New Architecture, we enable Concurrent Root (i.e. React 18). 44 | // More on this on https://reactjs.org/blog/2022/03/29/react-v18.html 45 | return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/perfkillerexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.perfkillerexample; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.config.ReactFeatureFlags; 11 | import com.facebook.soloader.SoLoader; 12 | import com.perfkillerexample.newarchitecture.MainApplicationReactNativeHost; 13 | import java.lang.reflect.InvocationTargetException; 14 | import java.util.List; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = 19 | new ReactNativeHost(this) { 20 | @Override 21 | public boolean getUseDeveloperSupport() { 22 | return BuildConfig.DEBUG; 23 | } 24 | 25 | @Override 26 | protected List getPackages() { 27 | @SuppressWarnings("UnnecessaryLocalVariable") 28 | List packages = new PackageList(this).getPackages(); 29 | // Packages that cannot be autolinked yet can be added manually here, for example: 30 | // packages.add(new MyReactNativePackage()); 31 | return packages; 32 | } 33 | 34 | @Override 35 | protected String getJSMainModuleName() { 36 | return "index"; 37 | } 38 | }; 39 | 40 | private final ReactNativeHost mNewArchitectureNativeHost = 41 | new MainApplicationReactNativeHost(this); 42 | 43 | @Override 44 | public ReactNativeHost getReactNativeHost() { 45 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 46 | return mNewArchitectureNativeHost; 47 | } else { 48 | return mReactNativeHost; 49 | } 50 | } 51 | 52 | @Override 53 | public void onCreate() { 54 | super.onCreate(); 55 | // If you opted-in for the New Architecture, we enable the TurboModule system 56 | ReactFeatureFlags.useTurboModules = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED; 57 | SoLoader.init(this, /* native exopackage */ false); 58 | initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 59 | } 60 | 61 | /** 62 | * Loads Flipper in React Native templates. Call this in the onCreate method with something like 63 | * initializeFlipper(this, getReactNativeHost().getReactInstanceManager()); 64 | * 65 | * @param context 66 | * @param reactInstanceManager 67 | */ 68 | private static void initializeFlipper( 69 | Context context, ReactInstanceManager reactInstanceManager) { 70 | if (BuildConfig.DEBUG) { 71 | try { 72 | /* 73 | We use reflection here to pick up the class that initializes Flipper, 74 | since Flipper library is not available in release mode 75 | */ 76 | Class aClass = Class.forName("com.perfkillerexample.ReactNativeFlipper"); 77 | aClass 78 | .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class) 79 | .invoke(null, context, reactInstanceManager); 80 | } catch (ClassNotFoundException e) { 81 | e.printStackTrace(); 82 | } catch (NoSuchMethodException e) { 83 | e.printStackTrace(); 84 | } catch (IllegalAccessException e) { 85 | e.printStackTrace(); 86 | } catch (InvocationTargetException e) { 87 | e.printStackTrace(); 88 | } 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/perfkillerexample/newarchitecture/MainApplicationReactNativeHost.java: -------------------------------------------------------------------------------- 1 | package com.perfkillerexample.newarchitecture; 2 | 3 | import android.app.Application; 4 | import androidx.annotation.NonNull; 5 | import com.facebook.react.PackageList; 6 | import com.facebook.react.ReactInstanceManager; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.ReactPackageTurboModuleManagerDelegate; 10 | import com.facebook.react.bridge.JSIModulePackage; 11 | import com.facebook.react.bridge.JSIModuleProvider; 12 | import com.facebook.react.bridge.JSIModuleSpec; 13 | import com.facebook.react.bridge.JSIModuleType; 14 | import com.facebook.react.bridge.JavaScriptContextHolder; 15 | import com.facebook.react.bridge.ReactApplicationContext; 16 | import com.facebook.react.bridge.UIManager; 17 | import com.facebook.react.fabric.ComponentFactory; 18 | import com.facebook.react.fabric.CoreComponentsRegistry; 19 | import com.facebook.react.fabric.FabricJSIModuleProvider; 20 | import com.facebook.react.fabric.ReactNativeConfig; 21 | import com.facebook.react.uimanager.ViewManagerRegistry; 22 | import com.perfkillerexample.BuildConfig; 23 | import com.perfkillerexample.newarchitecture.components.MainComponentsRegistry; 24 | import com.perfkillerexample.newarchitecture.modules.MainApplicationTurboModuleManagerDelegate; 25 | import java.util.ArrayList; 26 | import java.util.List; 27 | 28 | /** 29 | * A {@link ReactNativeHost} that helps you load everything needed for the New Architecture, both 30 | * TurboModule delegates and the Fabric Renderer. 31 | * 32 | *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the 33 | * `newArchEnabled` property). Is ignored otherwise. 34 | */ 35 | public class MainApplicationReactNativeHost extends ReactNativeHost { 36 | public MainApplicationReactNativeHost(Application application) { 37 | super(application); 38 | } 39 | 40 | @Override 41 | public boolean getUseDeveloperSupport() { 42 | return BuildConfig.DEBUG; 43 | } 44 | 45 | @Override 46 | protected List getPackages() { 47 | List packages = new PackageList(this).getPackages(); 48 | // Packages that cannot be autolinked yet can be added manually here, for example: 49 | // packages.add(new MyReactNativePackage()); 50 | // TurboModules must also be loaded here providing a valid TurboReactPackage implementation: 51 | // packages.add(new TurboReactPackage() { ... }); 52 | // If you have custom Fabric Components, their ViewManagers should also be loaded here 53 | // inside a ReactPackage. 54 | return packages; 55 | } 56 | 57 | @Override 58 | protected String getJSMainModuleName() { 59 | return "index"; 60 | } 61 | 62 | @NonNull 63 | @Override 64 | protected ReactPackageTurboModuleManagerDelegate.Builder 65 | getReactPackageTurboModuleManagerDelegateBuilder() { 66 | // Here we provide the ReactPackageTurboModuleManagerDelegate Builder. This is necessary 67 | // for the new architecture and to use TurboModules correctly. 68 | return new MainApplicationTurboModuleManagerDelegate.Builder(); 69 | } 70 | 71 | @Override 72 | protected JSIModulePackage getJSIModulePackage() { 73 | return new JSIModulePackage() { 74 | @Override 75 | public List getJSIModules( 76 | final ReactApplicationContext reactApplicationContext, 77 | final JavaScriptContextHolder jsContext) { 78 | final List specs = new ArrayList<>(); 79 | 80 | // Here we provide a new JSIModuleSpec that will be responsible of providing the 81 | // custom Fabric Components. 82 | specs.add( 83 | new JSIModuleSpec() { 84 | @Override 85 | public JSIModuleType getJSIModuleType() { 86 | return JSIModuleType.UIManager; 87 | } 88 | 89 | @Override 90 | public JSIModuleProvider getJSIModuleProvider() { 91 | final ComponentFactory componentFactory = new ComponentFactory(); 92 | CoreComponentsRegistry.register(componentFactory); 93 | 94 | // Here we register a Components Registry. 95 | // The one that is generated with the template contains no components 96 | // and just provides you the one from React Native core. 97 | MainComponentsRegistry.register(componentFactory); 98 | 99 | final ReactInstanceManager reactInstanceManager = getReactInstanceManager(); 100 | 101 | ViewManagerRegistry viewManagerRegistry = 102 | new ViewManagerRegistry( 103 | reactInstanceManager.getOrCreateViewManagers(reactApplicationContext)); 104 | 105 | return new FabricJSIModuleProvider( 106 | reactApplicationContext, 107 | componentFactory, 108 | ReactNativeConfig.DEFAULT_CONFIG, 109 | viewManagerRegistry); 110 | } 111 | }); 112 | return specs; 113 | } 114 | }; 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/perfkillerexample/newarchitecture/components/MainComponentsRegistry.java: -------------------------------------------------------------------------------- 1 | package com.perfkillerexample.newarchitecture.components; 2 | 3 | import com.facebook.jni.HybridData; 4 | import com.facebook.proguard.annotations.DoNotStrip; 5 | import com.facebook.react.fabric.ComponentFactory; 6 | import com.facebook.soloader.SoLoader; 7 | 8 | /** 9 | * Class responsible to load the custom Fabric Components. This class has native methods and needs a 10 | * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ 11 | * folder for you). 12 | * 13 | *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the 14 | * `newArchEnabled` property). Is ignored otherwise. 15 | */ 16 | @DoNotStrip 17 | public class MainComponentsRegistry { 18 | static { 19 | SoLoader.loadLibrary("fabricjni"); 20 | } 21 | 22 | @DoNotStrip private final HybridData mHybridData; 23 | 24 | @DoNotStrip 25 | private native HybridData initHybrid(ComponentFactory componentFactory); 26 | 27 | @DoNotStrip 28 | private MainComponentsRegistry(ComponentFactory componentFactory) { 29 | mHybridData = initHybrid(componentFactory); 30 | } 31 | 32 | @DoNotStrip 33 | public static MainComponentsRegistry register(ComponentFactory componentFactory) { 34 | return new MainComponentsRegistry(componentFactory); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/perfkillerexample/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate.java: -------------------------------------------------------------------------------- 1 | package com.perfkillerexample.newarchitecture.modules; 2 | 3 | import com.facebook.jni.HybridData; 4 | import com.facebook.react.ReactPackage; 5 | import com.facebook.react.ReactPackageTurboModuleManagerDelegate; 6 | import com.facebook.react.bridge.ReactApplicationContext; 7 | import com.facebook.soloader.SoLoader; 8 | import java.util.List; 9 | 10 | /** 11 | * Class responsible to load the TurboModules. This class has native methods and needs a 12 | * corresponding C++ implementation/header file to work correctly (already placed inside the jni/ 13 | * folder for you). 14 | * 15 | *

Please note that this class is used ONLY if you opt-in for the New Architecture (see the 16 | * `newArchEnabled` property). Is ignored otherwise. 17 | */ 18 | public class MainApplicationTurboModuleManagerDelegate 19 | extends ReactPackageTurboModuleManagerDelegate { 20 | 21 | private static volatile boolean sIsSoLibraryLoaded; 22 | 23 | protected MainApplicationTurboModuleManagerDelegate( 24 | ReactApplicationContext reactApplicationContext, List packages) { 25 | super(reactApplicationContext, packages); 26 | } 27 | 28 | protected native HybridData initHybrid(); 29 | 30 | native boolean canCreateTurboModule(String moduleName); 31 | 32 | public static class Builder extends ReactPackageTurboModuleManagerDelegate.Builder { 33 | protected MainApplicationTurboModuleManagerDelegate build( 34 | ReactApplicationContext context, List packages) { 35 | return new MainApplicationTurboModuleManagerDelegate(context, packages); 36 | } 37 | } 38 | 39 | @Override 40 | protected synchronized void maybeLoadOtherSoLibraries() { 41 | if (!sIsSoLibraryLoaded) { 42 | // If you change the name of your application .so file in the Android.mk file, 43 | // make sure you update the name here as well. 44 | SoLoader.loadLibrary("perfkillerexample_appmodules"); 45 | sIsSoLibraryLoaded = true; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | 3 | # Define the library name here. 4 | project(perfkillerexample_appmodules) 5 | 6 | # This file includes all the necessary to let you build your application with the New Architecture. 7 | include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake) 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/MainApplicationModuleProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "MainApplicationModuleProvider.h" 2 | 3 | #include 4 | #include 5 | 6 | namespace facebook { 7 | namespace react { 8 | 9 | std::shared_ptr MainApplicationModuleProvider( 10 | const std::string &moduleName, 11 | const JavaTurboModule::InitParams ¶ms) { 12 | // Here you can provide your own module provider for TurboModules coming from 13 | // either your application or from external libraries. The approach to follow 14 | // is similar to the following (for a library called `samplelibrary`: 15 | // 16 | // auto module = samplelibrary_ModuleProvider(moduleName, params); 17 | // if (module != nullptr) { 18 | // return module; 19 | // } 20 | // return rncore_ModuleProvider(moduleName, params); 21 | 22 | // Module providers autolinked by RN CLI 23 | auto rncli_module = rncli_ModuleProvider(moduleName, params); 24 | if (rncli_module != nullptr) { 25 | return rncli_module; 26 | } 27 | 28 | return rncore_ModuleProvider(moduleName, params); 29 | } 30 | 31 | } // namespace react 32 | } // namespace facebook 33 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/MainApplicationModuleProvider.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace facebook { 9 | namespace react { 10 | 11 | std::shared_ptr MainApplicationModuleProvider( 12 | const std::string &moduleName, 13 | const JavaTurboModule::InitParams ¶ms); 14 | 15 | } // namespace react 16 | } // namespace facebook 17 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "MainApplicationTurboModuleManagerDelegate.h" 2 | #include "MainApplicationModuleProvider.h" 3 | 4 | namespace facebook { 5 | namespace react { 6 | 7 | jni::local_ref 8 | MainApplicationTurboModuleManagerDelegate::initHybrid( 9 | jni::alias_ref) { 10 | return makeCxxInstance(); 11 | } 12 | 13 | void MainApplicationTurboModuleManagerDelegate::registerNatives() { 14 | registerHybrid({ 15 | makeNativeMethod( 16 | "initHybrid", MainApplicationTurboModuleManagerDelegate::initHybrid), 17 | makeNativeMethod( 18 | "canCreateTurboModule", 19 | MainApplicationTurboModuleManagerDelegate::canCreateTurboModule), 20 | }); 21 | } 22 | 23 | std::shared_ptr 24 | MainApplicationTurboModuleManagerDelegate::getTurboModule( 25 | const std::string &name, 26 | const std::shared_ptr &jsInvoker) { 27 | // Not implemented yet: provide pure-C++ NativeModules here. 28 | return nullptr; 29 | } 30 | 31 | std::shared_ptr 32 | MainApplicationTurboModuleManagerDelegate::getTurboModule( 33 | const std::string &name, 34 | const JavaTurboModule::InitParams ¶ms) { 35 | return MainApplicationModuleProvider(name, params); 36 | } 37 | 38 | bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule( 39 | const std::string &name) { 40 | return getTurboModule(name, nullptr) != nullptr || 41 | getTurboModule(name, {.moduleName = name}) != nullptr; 42 | } 43 | 44 | } // namespace react 45 | } // namespace facebook 46 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | namespace facebook { 8 | namespace react { 9 | 10 | class MainApplicationTurboModuleManagerDelegate 11 | : public jni::HybridClass< 12 | MainApplicationTurboModuleManagerDelegate, 13 | TurboModuleManagerDelegate> { 14 | public: 15 | // Adapt it to the package you used for your Java class. 16 | static constexpr auto kJavaDescriptor = 17 | "Lcom/perfkillerexample/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;"; 18 | 19 | static jni::local_ref initHybrid(jni::alias_ref); 20 | 21 | static void registerNatives(); 22 | 23 | std::shared_ptr getTurboModule( 24 | const std::string &name, 25 | const std::shared_ptr &jsInvoker) override; 26 | std::shared_ptr getTurboModule( 27 | const std::string &name, 28 | const JavaTurboModule::InitParams ¶ms) override; 29 | 30 | /** 31 | * Test-only method. Allows user to verify whether a TurboModule can be 32 | * created by instances of this class. 33 | */ 34 | bool canCreateTurboModule(const std::string &name); 35 | }; 36 | 37 | } // namespace react 38 | } // namespace facebook 39 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/MainComponentsRegistry.cpp: -------------------------------------------------------------------------------- 1 | #include "MainComponentsRegistry.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | namespace facebook { 10 | namespace react { 11 | 12 | MainComponentsRegistry::MainComponentsRegistry(ComponentFactory *delegate) {} 13 | 14 | std::shared_ptr 15 | MainComponentsRegistry::sharedProviderRegistry() { 16 | auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry(); 17 | 18 | // Autolinked providers registered by RN CLI 19 | rncli_registerProviders(providerRegistry); 20 | 21 | // Custom Fabric Components go here. You can register custom 22 | // components coming from your App or from 3rd party libraries here. 23 | // 24 | // providerRegistry->add(concreteComponentDescriptorProvider< 25 | // AocViewerComponentDescriptor>()); 26 | return providerRegistry; 27 | } 28 | 29 | jni::local_ref 30 | MainComponentsRegistry::initHybrid( 31 | jni::alias_ref, 32 | ComponentFactory *delegate) { 33 | auto instance = makeCxxInstance(delegate); 34 | 35 | auto buildRegistryFunction = 36 | [](EventDispatcher::Weak const &eventDispatcher, 37 | ContextContainer::Shared const &contextContainer) 38 | -> ComponentDescriptorRegistry::Shared { 39 | auto registry = MainComponentsRegistry::sharedProviderRegistry() 40 | ->createComponentDescriptorRegistry( 41 | {eventDispatcher, contextContainer}); 42 | 43 | auto mutableRegistry = 44 | std::const_pointer_cast(registry); 45 | 46 | mutableRegistry->setFallbackComponentDescriptor( 47 | std::make_shared( 48 | ComponentDescriptorParameters{ 49 | eventDispatcher, contextContainer, nullptr})); 50 | 51 | return registry; 52 | }; 53 | 54 | delegate->buildRegistryFunction = buildRegistryFunction; 55 | return instance; 56 | } 57 | 58 | void MainComponentsRegistry::registerNatives() { 59 | registerHybrid({ 60 | makeNativeMethod("initHybrid", MainComponentsRegistry::initHybrid), 61 | }); 62 | } 63 | 64 | } // namespace react 65 | } // namespace facebook 66 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/MainComponentsRegistry.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | namespace facebook { 9 | namespace react { 10 | 11 | class MainComponentsRegistry 12 | : public facebook::jni::HybridClass { 13 | public: 14 | // Adapt it to the package you used for your Java class. 15 | constexpr static auto kJavaDescriptor = 16 | "Lcom/perfkillerexample/newarchitecture/components/MainComponentsRegistry;"; 17 | 18 | static void registerNatives(); 19 | 20 | MainComponentsRegistry(ComponentFactory *delegate); 21 | 22 | private: 23 | static std::shared_ptr 24 | sharedProviderRegistry(); 25 | 26 | static jni::local_ref initHybrid( 27 | jni::alias_ref, 28 | ComponentFactory *delegate); 29 | }; 30 | 31 | } // namespace react 32 | } // namespace facebook 33 | -------------------------------------------------------------------------------- /example/android/app/src/main/jni/OnLoad.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "MainApplicationTurboModuleManagerDelegate.h" 3 | #include "MainComponentsRegistry.h" 4 | 5 | JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) { 6 | return facebook::jni::initialize(vm, [] { 7 | facebook::react::MainApplicationTurboModuleManagerDelegate:: 8 | registerNatives(); 9 | facebook::react::MainComponentsRegistry::registerNatives(); 10 | }); 11 | } 12 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 21 | 22 | 23 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | PerfKillerExample 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "31.0.0" 6 | minSdkVersion = 21 7 | compileSdkVersion = 31 8 | targetSdkVersion = 31 9 | 10 | if (System.properties['os.arch'] == "aarch64") { 11 | // For M1 Users we need to use the NDK 24 which added support for aarch64 12 | ndkVersion = "24.0.8215888" 13 | } else { 14 | // Otherwise we default to the side-by-side NDK version from AGP. 15 | ndkVersion = "21.4.7075529" 16 | } 17 | } 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | dependencies { 23 | classpath("com.android.tools.build:gradle:7.2.1") 24 | classpath("com.facebook.react:react-native-gradle-plugin") 25 | classpath("de.undercouch:gradle-download-task:5.0.1") 26 | // NOTE: Do not place your application dependencies here; they belong 27 | // in the individual module build.gradle files 28 | } 29 | } 30 | 31 | allprojects { 32 | repositories { 33 | maven { 34 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 35 | url("$rootDir/../node_modules/react-native/android") 36 | } 37 | maven { 38 | // Android JSC is installed from npm 39 | url("$rootDir/../node_modules/jsc-android/dist") 40 | } 41 | mavenCentral { 42 | // We don't want to fetch react-native from Maven Central as there are 43 | // older versions over there. 44 | content { 45 | excludeGroup "com.facebook.react" 46 | } 47 | } 48 | google() 49 | maven { url 'https://www.jitpack.io' } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | # Automatically convert third-party libraries to use AndroidX 25 | android.enableJetifier=true 26 | 27 | # Version of flipper SDK to use with React Native 28 | FLIPPER_VERSION=0.125.0 29 | 30 | # Use this property to specify which architecture you want to build. 31 | # You can also override it from the CLI using 32 | # ./gradlew -PreactNativeArchitectures=x86_64 33 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 34 | 35 | # Use this property to enable support to the new architecture. 36 | # This will allow you to use TurboModules and the Fabric render in 37 | # your application. You should enable this flag either if you want 38 | # to write custom TurboModules/Fabric components OR use libraries that 39 | # are providing them. 40 | newArchEnabled=false 41 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/react-native-performance-limiter/2824774f37f9796a8a6dab3a5e130201ae44d38e/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | # 21 | # Gradle start up script for POSIX generated by Gradle. 22 | # 23 | # Important for running: 24 | # 25 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 26 | # noncompliant, but you have some other compliant shell such as ksh or 27 | # bash, then to run this script, type that shell name before the whole 28 | # command line, like: 29 | # 30 | # ksh Gradle 31 | # 32 | # Busybox and similar reduced shells will NOT work, because this script 33 | # requires all of these POSIX shell features: 34 | # * functions; 35 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 36 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 37 | # * compound commands having a testable exit status, especially «case»; 38 | # * various built-in commands including «command», «set», and «ulimit». 39 | # 40 | # Important for patching: 41 | # 42 | # (2) This script targets any POSIX shell, so it avoids extensions provided 43 | # by Bash, Ksh, etc; in particular arrays are avoided. 44 | # 45 | # The "traditional" practice of packing multiple parameters into a 46 | # space-separated string is a well documented source of bugs and security 47 | # problems, so this is (mostly) avoided, by progressively accumulating 48 | # options in "$@", and eventually passing that to Java. 49 | # 50 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 51 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 52 | # see the in-line comments for details. 53 | # 54 | # There are tweaks for specific operating systems such as AIX, CygWin, 55 | # Darwin, MinGW, and NonStop. 56 | # 57 | # (3) This script is generated from the Groovy template 58 | # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 59 | # within the Gradle project. 60 | # 61 | # You can find Gradle at https://github.com/gradle/gradle/. 62 | # 63 | ############################################################################## 64 | 65 | # Attempt to set APP_HOME 66 | 67 | # Resolve links: $0 may be a link 68 | app_path=$0 69 | 70 | # Need this for daisy-chained symlinks. 71 | while 72 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 73 | [ -h "$app_path" ] 74 | do 75 | ls=$( ls -ld "$app_path" ) 76 | link=${ls#*' -> '} 77 | case $link in #( 78 | /*) app_path=$link ;; #( 79 | *) app_path=$APP_HOME$link ;; 80 | esac 81 | done 82 | 83 | APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 84 | 85 | APP_NAME="Gradle" 86 | APP_BASE_NAME=${0##*/} 87 | 88 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 89 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 137 | 138 | Please set the JAVA_HOME variable in your environment to match the 139 | location of your Java installation." 140 | fi 141 | 142 | # Increase the maximum file descriptors if we can. 143 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 144 | case $MAX_FD in #( 145 | max*) 146 | MAX_FD=$( ulimit -H -n ) || 147 | warn "Could not query maximum file descriptor limit" 148 | esac 149 | case $MAX_FD in #( 150 | '' | soft) :;; #( 151 | *) 152 | ulimit -n "$MAX_FD" || 153 | warn "Could not set maximum file descriptor limit to $MAX_FD" 154 | esac 155 | fi 156 | 157 | # Collect all arguments for the java command, stacking in reverse order: 158 | # * args from the command line 159 | # * the main class name 160 | # * -classpath 161 | # * -D...appname settings 162 | # * --module-path (only if needed) 163 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 164 | 165 | # For Cygwin or MSYS, switch paths to Windows format before running java 166 | if "$cygwin" || "$msys" ; then 167 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 168 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 169 | 170 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 171 | 172 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 173 | for arg do 174 | if 175 | case $arg in #( 176 | -*) false ;; # don't mess with options #( 177 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 178 | [ -e "$t" ] ;; #( 179 | *) false ;; 180 | esac 181 | then 182 | arg=$( cygpath --path --ignore --mixed "$arg" ) 183 | fi 184 | # Roll the args list around exactly as many times as the number of 185 | # args, so each arg winds up back in the position where it started, but 186 | # possibly modified. 187 | # 188 | # NB: a `for` loop captures its iteration list before it begins, so 189 | # changing the positional parameters here affects neither the number of 190 | # iterations, nor the values presented in `arg`. 191 | shift # remove old arg 192 | set -- "$@" "$arg" # push replacement arg 193 | done 194 | fi 195 | 196 | # Collect all arguments for the java command; 197 | # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of 198 | # shell script including quotes and variable substitutions, so put them in 199 | # double quotes to make sure that they get re-expanded; and 200 | # * put everything else in single quotes, so that it's not re-expanded. 201 | 202 | set -- \ 203 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 204 | -classpath "$CLASSPATH" \ 205 | org.gradle.wrapper.GradleWrapperMain \ 206 | "$@" 207 | 208 | # Use "xargs" to parse quoted args. 209 | # 210 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 211 | # 212 | # In Bash we could simply go: 213 | # 214 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 215 | # set -- "${ARGS[@]}" "$@" 216 | # 217 | # but POSIX shell has neither arrays nor command substitution, so instead we 218 | # post-process each arg (as a line of input to sed) to backslash-escape any 219 | # character that might be a shell metacharacter, then use eval to reverse 220 | # that process (while maintaining the separation between arguments), and wrap 221 | # the whole thing up as a single "set" statement. 222 | # 223 | # This will of course break if any of these variables contains a newline or 224 | # an unmatched quote. 225 | # 226 | 227 | eval "set -- $( 228 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 229 | xargs -n1 | 230 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 231 | tr '\n' ' ' 232 | )" '"$@"' 233 | 234 | exec "$JAVACMD" "$@" 235 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'PerfKillerExample' 2 | apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) 3 | include ':app' 4 | includeBuild('../node_modules/react-native-gradle-plugin') 5 | 6 | if (settings.hasProperty("newArchEnabled") && settings.newArchEnabled == "true") { 7 | include(":ReactAndroid") 8 | project(":ReactAndroid").projectDir = file('../node_modules/react-native/ReactAndroid') 9 | include(":ReactAndroid:hermes-engine") 10 | project(":ReactAndroid:hermes-engine").projectDir = file('../node_modules/react-native/ReactAndroid/hermes-engine') 11 | } 12 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PerfKillerExample", 3 | "displayName": "PerfKillerExample" 4 | } -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | presets: ['module:metro-react-native-babel-preset'], 6 | plugins: [ 7 | [ 8 | 'module-resolver', 9 | { 10 | extensions: ['.tsx', '.ts', '.js', '.json'], 11 | alias: { 12 | [pak.name]: path.join(__dirname, '..', pak.source), 13 | }, 14 | }, 15 | ], 16 | ], 17 | }; 18 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import { AppRegistry } from 'react-native'; 2 | import App from './src/App'; 3 | import { name as appName } from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /example/ios/File.swift: -------------------------------------------------------------------------------- 1 | // 2 | // File.swift 3 | // PerfKillerExample 4 | // 5 | 6 | import Foundation 7 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample.xcodeproj/xcshareddata/xcschemes/PerfKillerExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : UIResponder 5 | 6 | @property (nonatomic, strong) UIWindow *window; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/AppDelegate.mm: -------------------------------------------------------------------------------- 1 | #import "AppDelegate.h" 2 | 3 | #import 4 | #import 5 | #import 6 | 7 | #import 8 | 9 | #if RCT_NEW_ARCH_ENABLED 10 | #import 11 | #import 12 | #import 13 | #import 14 | #import 15 | #import 16 | 17 | #import 18 | 19 | static NSString *const kRNConcurrentRoot = @"concurrentRoot"; 20 | 21 | @interface AppDelegate () { 22 | RCTTurboModuleManager *_turboModuleManager; 23 | RCTSurfacePresenterBridgeAdapter *_bridgeAdapter; 24 | std::shared_ptr _reactNativeConfig; 25 | facebook::react::ContextContainer::Shared _contextContainer; 26 | } 27 | @end 28 | #endif 29 | 30 | @implementation AppDelegate 31 | 32 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 33 | { 34 | RCTAppSetupPrepareApp(application); 35 | 36 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 37 | 38 | #if RCT_NEW_ARCH_ENABLED 39 | _contextContainer = std::make_shared(); 40 | _reactNativeConfig = std::make_shared(); 41 | _contextContainer->insert("ReactNativeConfig", _reactNativeConfig); 42 | _bridgeAdapter = [[RCTSurfacePresenterBridgeAdapter alloc] initWithBridge:bridge contextContainer:_contextContainer]; 43 | bridge.surfacePresenter = _bridgeAdapter.surfacePresenter; 44 | #endif 45 | 46 | NSDictionary *initProps = [self prepareInitialProps]; 47 | UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"PerfKillerExample", initProps); 48 | 49 | if (@available(iOS 13.0, *)) { 50 | rootView.backgroundColor = [UIColor systemBackgroundColor]; 51 | } else { 52 | rootView.backgroundColor = [UIColor whiteColor]; 53 | } 54 | 55 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 56 | UIViewController *rootViewController = [UIViewController new]; 57 | rootViewController.view = rootView; 58 | self.window.rootViewController = rootViewController; 59 | [self.window makeKeyAndVisible]; 60 | return YES; 61 | } 62 | 63 | /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off. 64 | /// 65 | /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html 66 | /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture). 67 | /// @return: `true` if the `concurrentRoot` feture is enabled. Otherwise, it returns `false`. 68 | - (BOOL)concurrentRootEnabled 69 | { 70 | // Switch this bool to turn on and off the concurrent root 71 | return true; 72 | } 73 | 74 | - (NSDictionary *)prepareInitialProps 75 | { 76 | NSMutableDictionary *initProps = [NSMutableDictionary new]; 77 | 78 | #ifdef RCT_NEW_ARCH_ENABLED 79 | initProps[kRNConcurrentRoot] = @([self concurrentRootEnabled]); 80 | #endif 81 | 82 | return initProps; 83 | } 84 | 85 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 86 | { 87 | #if DEBUG 88 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"]; 89 | #else 90 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 91 | #endif 92 | } 93 | 94 | #if RCT_NEW_ARCH_ENABLED 95 | 96 | #pragma mark - RCTCxxBridgeDelegate 97 | 98 | - (std::unique_ptr)jsExecutorFactoryForBridge:(RCTBridge *)bridge 99 | { 100 | _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridge:bridge 101 | delegate:self 102 | jsInvoker:bridge.jsCallInvoker]; 103 | return RCTAppSetupDefaultJsExecutorFactory(bridge, _turboModuleManager); 104 | } 105 | 106 | #pragma mark RCTTurboModuleManagerDelegate 107 | 108 | - (Class)getModuleClassFromName:(const char *)name 109 | { 110 | return RCTCoreModulesClassProvider(name); 111 | } 112 | 113 | - (std::shared_ptr)getTurboModule:(const std::string &)name 114 | jsInvoker:(std::shared_ptr)jsInvoker 115 | { 116 | return nullptr; 117 | } 118 | 119 | - (std::shared_ptr)getTurboModule:(const std::string &)name 120 | initParams: 121 | (const facebook::react::ObjCTurboModule::InitParams &)params 122 | { 123 | return nullptr; 124 | } 125 | 126 | - (id)getModuleInstanceFromClass:(Class)moduleClass 127 | { 128 | return RCTAppSetupDefaultModuleFromClass(moduleClass); 129 | } 130 | 131 | #endif 132 | 133 | @end 134 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | PerfKillerExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSExceptionDomains 30 | 31 | localhost 32 | 33 | NSExceptionAllowsInsecureHTTPLoads 34 | 35 | 36 | 37 | 38 | NSLocationWhenInUseUsageDescription 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UIViewControllerBasedStatusBarAppearance 53 | 54 | 55 | 56 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExample/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | @autoreleasepool { 8 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/PerfKillerExampleTests/PerfKillerExampleTests.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #import 5 | #import 6 | 7 | #define TIMEOUT_SECONDS 600 8 | #define TEXT_TO_LOOK_FOR @"Welcome to React" 9 | 10 | @interface PerfKillerExampleTests : XCTestCase 11 | 12 | @end 13 | 14 | @implementation PerfKillerExampleTests 15 | 16 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL (^)(UIView *view))test 17 | { 18 | if (test(view)) { 19 | return YES; 20 | } 21 | for (UIView *subview in [view subviews]) { 22 | if ([self findSubviewInView:subview matching:test]) { 23 | return YES; 24 | } 25 | } 26 | return NO; 27 | } 28 | 29 | - (void)testRendersWelcomeScreen 30 | { 31 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 32 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 33 | BOOL foundElement = NO; 34 | 35 | __block NSString *redboxError = nil; 36 | #ifdef DEBUG 37 | RCTSetLogFunction( 38 | ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 39 | if (level >= RCTLogLevelError) { 40 | redboxError = message; 41 | } 42 | }); 43 | #endif 44 | 45 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 46 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 47 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 48 | 49 | foundElement = [self findSubviewInView:vc.view 50 | matching:^BOOL(UIView *view) { 51 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 52 | return YES; 53 | } 54 | return NO; 55 | }]; 56 | } 57 | 58 | #ifdef DEBUG 59 | RCTSetLogFunction(RCTDefaultLogFunction); 60 | #endif 61 | 62 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 63 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 64 | } 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | require_relative '../node_modules/react-native/scripts/react_native_pods' 2 | require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' 3 | 4 | platform :ios, '12.4' 5 | install! 'cocoapods', :deterministic_uuids => false 6 | 7 | target 'PerfKillerExample' do 8 | config = use_native_modules! 9 | 10 | # Flags change depending on the env values. 11 | flags = get_default_flags() 12 | 13 | use_react_native!( 14 | :path => config[:reactNativePath], 15 | # Hermes is now enabled by default. Disable by setting this flag to false. 16 | # Upcoming versions of React Native may rely on get_default_flags(), but 17 | # we make it explicit here to aid in the React Native upgrade process. 18 | :hermes_enabled => true, 19 | :fabric_enabled => flags[:fabric_enabled], 20 | # Enables Flipper. 21 | # 22 | # Note that if you have use_frameworks! enabled, Flipper will not work and 23 | # you should disable the next line. 24 | :flipper_configuration => FlipperConfiguration.enabled, 25 | # An absolute path to your application root. 26 | :app_path => "#{Pod::Config.instance.installation_root}/.." 27 | ) 28 | 29 | target 'PerfKillerExampleTests' do 30 | inherit! :complete 31 | # Pods for testing 32 | end 33 | 34 | post_install do |installer| 35 | react_native_post_install( 36 | installer, 37 | # Set `mac_catalyst_enabled` to `true` in order to apply patches 38 | # necessary for Mac Catalyst builds 39 | :mac_catalyst_enabled => false 40 | ) 41 | __apply_Xcode_12_5_M1_post_install_workaround(installer) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - boost (1.76.0) 3 | - CocoaAsyncSocket (7.6.5) 4 | - DoubleConversion (1.1.6) 5 | - FBLazyVector (0.70.10) 6 | - FBReactNativeSpec (0.70.10): 7 | - RCT-Folly (= 2021.07.22.00) 8 | - RCTRequired (= 0.70.10) 9 | - RCTTypeSafety (= 0.70.10) 10 | - React-Core (= 0.70.10) 11 | - React-jsi (= 0.70.10) 12 | - ReactCommon/turbomodule/core (= 0.70.10) 13 | - Flipper (0.125.0): 14 | - Flipper-Folly (~> 2.6) 15 | - Flipper-RSocket (~> 1.4) 16 | - Flipper-Boost-iOSX (1.76.0.1.11) 17 | - Flipper-DoubleConversion (3.2.0.1) 18 | - Flipper-Fmt (7.1.7) 19 | - Flipper-Folly (2.6.10): 20 | - Flipper-Boost-iOSX 21 | - Flipper-DoubleConversion 22 | - Flipper-Fmt (= 7.1.7) 23 | - Flipper-Glog 24 | - libevent (~> 2.1.12) 25 | - OpenSSL-Universal (= 1.1.1100) 26 | - Flipper-Glog (0.5.0.5) 27 | - Flipper-PeerTalk (0.0.4) 28 | - Flipper-RSocket (1.4.3): 29 | - Flipper-Folly (~> 2.6) 30 | - FlipperKit (0.125.0): 31 | - FlipperKit/Core (= 0.125.0) 32 | - FlipperKit/Core (0.125.0): 33 | - Flipper (~> 0.125.0) 34 | - FlipperKit/CppBridge 35 | - FlipperKit/FBCxxFollyDynamicConvert 36 | - FlipperKit/FBDefines 37 | - FlipperKit/FKPortForwarding 38 | - SocketRocket (~> 0.6.0) 39 | - FlipperKit/CppBridge (0.125.0): 40 | - Flipper (~> 0.125.0) 41 | - FlipperKit/FBCxxFollyDynamicConvert (0.125.0): 42 | - Flipper-Folly (~> 2.6) 43 | - FlipperKit/FBDefines (0.125.0) 44 | - FlipperKit/FKPortForwarding (0.125.0): 45 | - CocoaAsyncSocket (~> 7.6) 46 | - Flipper-PeerTalk (~> 0.0.4) 47 | - FlipperKit/FlipperKitHighlightOverlay (0.125.0) 48 | - FlipperKit/FlipperKitLayoutHelpers (0.125.0): 49 | - FlipperKit/Core 50 | - FlipperKit/FlipperKitHighlightOverlay 51 | - FlipperKit/FlipperKitLayoutTextSearchable 52 | - FlipperKit/FlipperKitLayoutIOSDescriptors (0.125.0): 53 | - FlipperKit/Core 54 | - FlipperKit/FlipperKitHighlightOverlay 55 | - FlipperKit/FlipperKitLayoutHelpers 56 | - YogaKit (~> 1.18) 57 | - FlipperKit/FlipperKitLayoutPlugin (0.125.0): 58 | - FlipperKit/Core 59 | - FlipperKit/FlipperKitHighlightOverlay 60 | - FlipperKit/FlipperKitLayoutHelpers 61 | - FlipperKit/FlipperKitLayoutIOSDescriptors 62 | - FlipperKit/FlipperKitLayoutTextSearchable 63 | - YogaKit (~> 1.18) 64 | - FlipperKit/FlipperKitLayoutTextSearchable (0.125.0) 65 | - FlipperKit/FlipperKitNetworkPlugin (0.125.0): 66 | - FlipperKit/Core 67 | - FlipperKit/FlipperKitReactPlugin (0.125.0): 68 | - FlipperKit/Core 69 | - FlipperKit/FlipperKitUserDefaultsPlugin (0.125.0): 70 | - FlipperKit/Core 71 | - FlipperKit/SKIOSNetworkPlugin (0.125.0): 72 | - FlipperKit/Core 73 | - FlipperKit/FlipperKitNetworkPlugin 74 | - fmt (6.2.1) 75 | - glog (0.3.5) 76 | - hermes-engine (0.70.6) 77 | - libevent (2.1.12) 78 | - OpenSSL-Universal (1.1.1100) 79 | - RCT-Folly (2021.07.22.00): 80 | - boost 81 | - DoubleConversion 82 | - fmt (~> 6.2.1) 83 | - glog 84 | - RCT-Folly/Default (= 2021.07.22.00) 85 | - RCT-Folly/Default (2021.07.22.00): 86 | - boost 87 | - DoubleConversion 88 | - fmt (~> 6.2.1) 89 | - glog 90 | - RCT-Folly/Futures (2021.07.22.00): 91 | - boost 92 | - DoubleConversion 93 | - fmt (~> 6.2.1) 94 | - glog 95 | - libevent 96 | - RCTRequired (0.70.10) 97 | - RCTTypeSafety (0.70.10): 98 | - FBLazyVector (= 0.70.10) 99 | - RCTRequired (= 0.70.10) 100 | - React-Core (= 0.70.10) 101 | - React (0.70.10): 102 | - React-Core (= 0.70.10) 103 | - React-Core/DevSupport (= 0.70.10) 104 | - React-Core/RCTWebSocket (= 0.70.10) 105 | - React-RCTActionSheet (= 0.70.10) 106 | - React-RCTAnimation (= 0.70.10) 107 | - React-RCTBlob (= 0.70.10) 108 | - React-RCTImage (= 0.70.10) 109 | - React-RCTLinking (= 0.70.10) 110 | - React-RCTNetwork (= 0.70.10) 111 | - React-RCTSettings (= 0.70.10) 112 | - React-RCTText (= 0.70.10) 113 | - React-RCTVibration (= 0.70.10) 114 | - React-bridging (0.70.10): 115 | - RCT-Folly (= 2021.07.22.00) 116 | - React-jsi (= 0.70.10) 117 | - React-callinvoker (0.70.10) 118 | - React-Codegen (0.70.10): 119 | - FBReactNativeSpec (= 0.70.10) 120 | - RCT-Folly (= 2021.07.22.00) 121 | - RCTRequired (= 0.70.10) 122 | - RCTTypeSafety (= 0.70.10) 123 | - React-Core (= 0.70.10) 124 | - React-jsi (= 0.70.10) 125 | - React-jsiexecutor (= 0.70.10) 126 | - ReactCommon/turbomodule/core (= 0.70.10) 127 | - React-Core (0.70.10): 128 | - glog 129 | - RCT-Folly (= 2021.07.22.00) 130 | - React-Core/Default (= 0.70.10) 131 | - React-cxxreact (= 0.70.10) 132 | - React-jsi (= 0.70.10) 133 | - React-jsiexecutor (= 0.70.10) 134 | - React-perflogger (= 0.70.10) 135 | - Yoga 136 | - React-Core/CoreModulesHeaders (0.70.10): 137 | - glog 138 | - RCT-Folly (= 2021.07.22.00) 139 | - React-Core/Default 140 | - React-cxxreact (= 0.70.10) 141 | - React-jsi (= 0.70.10) 142 | - React-jsiexecutor (= 0.70.10) 143 | - React-perflogger (= 0.70.10) 144 | - Yoga 145 | - React-Core/Default (0.70.10): 146 | - glog 147 | - RCT-Folly (= 2021.07.22.00) 148 | - React-cxxreact (= 0.70.10) 149 | - React-jsi (= 0.70.10) 150 | - React-jsiexecutor (= 0.70.10) 151 | - React-perflogger (= 0.70.10) 152 | - Yoga 153 | - React-Core/DevSupport (0.70.10): 154 | - glog 155 | - RCT-Folly (= 2021.07.22.00) 156 | - React-Core/Default (= 0.70.10) 157 | - React-Core/RCTWebSocket (= 0.70.10) 158 | - React-cxxreact (= 0.70.10) 159 | - React-jsi (= 0.70.10) 160 | - React-jsiexecutor (= 0.70.10) 161 | - React-jsinspector (= 0.70.10) 162 | - React-perflogger (= 0.70.10) 163 | - Yoga 164 | - React-Core/RCTActionSheetHeaders (0.70.10): 165 | - glog 166 | - RCT-Folly (= 2021.07.22.00) 167 | - React-Core/Default 168 | - React-cxxreact (= 0.70.10) 169 | - React-jsi (= 0.70.10) 170 | - React-jsiexecutor (= 0.70.10) 171 | - React-perflogger (= 0.70.10) 172 | - Yoga 173 | - React-Core/RCTAnimationHeaders (0.70.10): 174 | - glog 175 | - RCT-Folly (= 2021.07.22.00) 176 | - React-Core/Default 177 | - React-cxxreact (= 0.70.10) 178 | - React-jsi (= 0.70.10) 179 | - React-jsiexecutor (= 0.70.10) 180 | - React-perflogger (= 0.70.10) 181 | - Yoga 182 | - React-Core/RCTBlobHeaders (0.70.10): 183 | - glog 184 | - RCT-Folly (= 2021.07.22.00) 185 | - React-Core/Default 186 | - React-cxxreact (= 0.70.10) 187 | - React-jsi (= 0.70.10) 188 | - React-jsiexecutor (= 0.70.10) 189 | - React-perflogger (= 0.70.10) 190 | - Yoga 191 | - React-Core/RCTImageHeaders (0.70.10): 192 | - glog 193 | - RCT-Folly (= 2021.07.22.00) 194 | - React-Core/Default 195 | - React-cxxreact (= 0.70.10) 196 | - React-jsi (= 0.70.10) 197 | - React-jsiexecutor (= 0.70.10) 198 | - React-perflogger (= 0.70.10) 199 | - Yoga 200 | - React-Core/RCTLinkingHeaders (0.70.10): 201 | - glog 202 | - RCT-Folly (= 2021.07.22.00) 203 | - React-Core/Default 204 | - React-cxxreact (= 0.70.10) 205 | - React-jsi (= 0.70.10) 206 | - React-jsiexecutor (= 0.70.10) 207 | - React-perflogger (= 0.70.10) 208 | - Yoga 209 | - React-Core/RCTNetworkHeaders (0.70.10): 210 | - glog 211 | - RCT-Folly (= 2021.07.22.00) 212 | - React-Core/Default 213 | - React-cxxreact (= 0.70.10) 214 | - React-jsi (= 0.70.10) 215 | - React-jsiexecutor (= 0.70.10) 216 | - React-perflogger (= 0.70.10) 217 | - Yoga 218 | - React-Core/RCTSettingsHeaders (0.70.10): 219 | - glog 220 | - RCT-Folly (= 2021.07.22.00) 221 | - React-Core/Default 222 | - React-cxxreact (= 0.70.10) 223 | - React-jsi (= 0.70.10) 224 | - React-jsiexecutor (= 0.70.10) 225 | - React-perflogger (= 0.70.10) 226 | - Yoga 227 | - React-Core/RCTTextHeaders (0.70.10): 228 | - glog 229 | - RCT-Folly (= 2021.07.22.00) 230 | - React-Core/Default 231 | - React-cxxreact (= 0.70.10) 232 | - React-jsi (= 0.70.10) 233 | - React-jsiexecutor (= 0.70.10) 234 | - React-perflogger (= 0.70.10) 235 | - Yoga 236 | - React-Core/RCTVibrationHeaders (0.70.10): 237 | - glog 238 | - RCT-Folly (= 2021.07.22.00) 239 | - React-Core/Default 240 | - React-cxxreact (= 0.70.10) 241 | - React-jsi (= 0.70.10) 242 | - React-jsiexecutor (= 0.70.10) 243 | - React-perflogger (= 0.70.10) 244 | - Yoga 245 | - React-Core/RCTWebSocket (0.70.10): 246 | - glog 247 | - RCT-Folly (= 2021.07.22.00) 248 | - React-Core/Default (= 0.70.10) 249 | - React-cxxreact (= 0.70.10) 250 | - React-jsi (= 0.70.10) 251 | - React-jsiexecutor (= 0.70.10) 252 | - React-perflogger (= 0.70.10) 253 | - Yoga 254 | - React-CoreModules (0.70.10): 255 | - RCT-Folly (= 2021.07.22.00) 256 | - RCTTypeSafety (= 0.70.10) 257 | - React-Codegen (= 0.70.10) 258 | - React-Core/CoreModulesHeaders (= 0.70.10) 259 | - React-jsi (= 0.70.10) 260 | - React-RCTImage (= 0.70.10) 261 | - ReactCommon/turbomodule/core (= 0.70.10) 262 | - React-cxxreact (0.70.10): 263 | - boost (= 1.76.0) 264 | - DoubleConversion 265 | - glog 266 | - RCT-Folly (= 2021.07.22.00) 267 | - React-callinvoker (= 0.70.10) 268 | - React-jsi (= 0.70.10) 269 | - React-jsinspector (= 0.70.10) 270 | - React-logger (= 0.70.10) 271 | - React-perflogger (= 0.70.10) 272 | - React-runtimeexecutor (= 0.70.10) 273 | - React-hermes (0.70.10): 274 | - DoubleConversion 275 | - glog 276 | - hermes-engine 277 | - RCT-Folly (= 2021.07.22.00) 278 | - RCT-Folly/Futures (= 2021.07.22.00) 279 | - React-cxxreact (= 0.70.10) 280 | - React-jsi (= 0.70.10) 281 | - React-jsiexecutor (= 0.70.10) 282 | - React-jsinspector (= 0.70.10) 283 | - React-perflogger (= 0.70.10) 284 | - React-jsi (0.70.10): 285 | - boost (= 1.76.0) 286 | - DoubleConversion 287 | - glog 288 | - RCT-Folly (= 2021.07.22.00) 289 | - React-jsi/Default (= 0.70.10) 290 | - React-jsi/Default (0.70.10): 291 | - boost (= 1.76.0) 292 | - DoubleConversion 293 | - glog 294 | - RCT-Folly (= 2021.07.22.00) 295 | - React-jsiexecutor (0.70.10): 296 | - DoubleConversion 297 | - glog 298 | - RCT-Folly (= 2021.07.22.00) 299 | - React-cxxreact (= 0.70.10) 300 | - React-jsi (= 0.70.10) 301 | - React-perflogger (= 0.70.10) 302 | - React-jsinspector (0.70.10) 303 | - React-logger (0.70.10): 304 | - glog 305 | - react-native-performance-limiter (0.2.0): 306 | - React-Core 307 | - React-perflogger (0.70.10) 308 | - React-RCTActionSheet (0.70.10): 309 | - React-Core/RCTActionSheetHeaders (= 0.70.10) 310 | - React-RCTAnimation (0.70.10): 311 | - RCT-Folly (= 2021.07.22.00) 312 | - RCTTypeSafety (= 0.70.10) 313 | - React-Codegen (= 0.70.10) 314 | - React-Core/RCTAnimationHeaders (= 0.70.10) 315 | - React-jsi (= 0.70.10) 316 | - ReactCommon/turbomodule/core (= 0.70.10) 317 | - React-RCTBlob (0.70.10): 318 | - RCT-Folly (= 2021.07.22.00) 319 | - React-Codegen (= 0.70.10) 320 | - React-Core/RCTBlobHeaders (= 0.70.10) 321 | - React-Core/RCTWebSocket (= 0.70.10) 322 | - React-jsi (= 0.70.10) 323 | - React-RCTNetwork (= 0.70.10) 324 | - ReactCommon/turbomodule/core (= 0.70.10) 325 | - React-RCTImage (0.70.10): 326 | - RCT-Folly (= 2021.07.22.00) 327 | - RCTTypeSafety (= 0.70.10) 328 | - React-Codegen (= 0.70.10) 329 | - React-Core/RCTImageHeaders (= 0.70.10) 330 | - React-jsi (= 0.70.10) 331 | - React-RCTNetwork (= 0.70.10) 332 | - ReactCommon/turbomodule/core (= 0.70.10) 333 | - React-RCTLinking (0.70.10): 334 | - React-Codegen (= 0.70.10) 335 | - React-Core/RCTLinkingHeaders (= 0.70.10) 336 | - React-jsi (= 0.70.10) 337 | - ReactCommon/turbomodule/core (= 0.70.10) 338 | - React-RCTNetwork (0.70.10): 339 | - RCT-Folly (= 2021.07.22.00) 340 | - RCTTypeSafety (= 0.70.10) 341 | - React-Codegen (= 0.70.10) 342 | - React-Core/RCTNetworkHeaders (= 0.70.10) 343 | - React-jsi (= 0.70.10) 344 | - ReactCommon/turbomodule/core (= 0.70.10) 345 | - React-RCTSettings (0.70.10): 346 | - RCT-Folly (= 2021.07.22.00) 347 | - RCTTypeSafety (= 0.70.10) 348 | - React-Codegen (= 0.70.10) 349 | - React-Core/RCTSettingsHeaders (= 0.70.10) 350 | - React-jsi (= 0.70.10) 351 | - ReactCommon/turbomodule/core (= 0.70.10) 352 | - React-RCTText (0.70.10): 353 | - React-Core/RCTTextHeaders (= 0.70.10) 354 | - React-RCTVibration (0.70.10): 355 | - RCT-Folly (= 2021.07.22.00) 356 | - React-Codegen (= 0.70.10) 357 | - React-Core/RCTVibrationHeaders (= 0.70.10) 358 | - React-jsi (= 0.70.10) 359 | - ReactCommon/turbomodule/core (= 0.70.10) 360 | - React-runtimeexecutor (0.70.10): 361 | - React-jsi (= 0.70.10) 362 | - ReactCommon/turbomodule/core (0.70.10): 363 | - DoubleConversion 364 | - glog 365 | - RCT-Folly (= 2021.07.22.00) 366 | - React-bridging (= 0.70.10) 367 | - React-callinvoker (= 0.70.10) 368 | - React-Core (= 0.70.10) 369 | - React-cxxreact (= 0.70.10) 370 | - React-jsi (= 0.70.10) 371 | - React-logger (= 0.70.10) 372 | - React-perflogger (= 0.70.10) 373 | - SocketRocket (0.6.0) 374 | - Yoga (1.14.0) 375 | - YogaKit (1.18.1): 376 | - Yoga (~> 1.14) 377 | 378 | DEPENDENCIES: 379 | - boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`) 380 | - DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`) 381 | - FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`) 382 | - FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`) 383 | - Flipper (= 0.125.0) 384 | - Flipper-Boost-iOSX (= 1.76.0.1.11) 385 | - Flipper-DoubleConversion (= 3.2.0.1) 386 | - Flipper-Fmt (= 7.1.7) 387 | - Flipper-Folly (= 2.6.10) 388 | - Flipper-Glog (= 0.5.0.5) 389 | - Flipper-PeerTalk (= 0.0.4) 390 | - Flipper-RSocket (= 1.4.3) 391 | - FlipperKit (= 0.125.0) 392 | - FlipperKit/Core (= 0.125.0) 393 | - FlipperKit/CppBridge (= 0.125.0) 394 | - FlipperKit/FBCxxFollyDynamicConvert (= 0.125.0) 395 | - FlipperKit/FBDefines (= 0.125.0) 396 | - FlipperKit/FKPortForwarding (= 0.125.0) 397 | - FlipperKit/FlipperKitHighlightOverlay (= 0.125.0) 398 | - FlipperKit/FlipperKitLayoutPlugin (= 0.125.0) 399 | - FlipperKit/FlipperKitLayoutTextSearchable (= 0.125.0) 400 | - FlipperKit/FlipperKitNetworkPlugin (= 0.125.0) 401 | - FlipperKit/FlipperKitReactPlugin (= 0.125.0) 402 | - FlipperKit/FlipperKitUserDefaultsPlugin (= 0.125.0) 403 | - FlipperKit/SKIOSNetworkPlugin (= 0.125.0) 404 | - glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`) 405 | - hermes-engine (from `../node_modules/react-native/sdks/hermes/hermes-engine.podspec`) 406 | - libevent (~> 2.1.12) 407 | - OpenSSL-Universal (= 1.1.1100) 408 | - RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`) 409 | - RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`) 410 | - RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`) 411 | - React (from `../node_modules/react-native/`) 412 | - React-bridging (from `../node_modules/react-native/ReactCommon`) 413 | - React-callinvoker (from `../node_modules/react-native/ReactCommon/callinvoker`) 414 | - React-Codegen (from `build/generated/ios`) 415 | - React-Core (from `../node_modules/react-native/`) 416 | - React-Core/DevSupport (from `../node_modules/react-native/`) 417 | - React-Core/RCTWebSocket (from `../node_modules/react-native/`) 418 | - React-CoreModules (from `../node_modules/react-native/React/CoreModules`) 419 | - React-cxxreact (from `../node_modules/react-native/ReactCommon/cxxreact`) 420 | - React-hermes (from `../node_modules/react-native/ReactCommon/hermes`) 421 | - React-jsi (from `../node_modules/react-native/ReactCommon/jsi`) 422 | - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) 423 | - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) 424 | - React-logger (from `../node_modules/react-native/ReactCommon/logger`) 425 | - react-native-performance-limiter (from `../..`) 426 | - React-perflogger (from `../node_modules/react-native/ReactCommon/reactperflogger`) 427 | - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) 428 | - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) 429 | - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) 430 | - React-RCTImage (from `../node_modules/react-native/Libraries/Image`) 431 | - React-RCTLinking (from `../node_modules/react-native/Libraries/LinkingIOS`) 432 | - React-RCTNetwork (from `../node_modules/react-native/Libraries/Network`) 433 | - React-RCTSettings (from `../node_modules/react-native/Libraries/Settings`) 434 | - React-RCTText (from `../node_modules/react-native/Libraries/Text`) 435 | - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) 436 | - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) 437 | - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) 438 | - Yoga (from `../node_modules/react-native/ReactCommon/yoga`) 439 | 440 | SPEC REPOS: 441 | trunk: 442 | - CocoaAsyncSocket 443 | - Flipper 444 | - Flipper-Boost-iOSX 445 | - Flipper-DoubleConversion 446 | - Flipper-Fmt 447 | - Flipper-Folly 448 | - Flipper-Glog 449 | - Flipper-PeerTalk 450 | - Flipper-RSocket 451 | - FlipperKit 452 | - fmt 453 | - libevent 454 | - OpenSSL-Universal 455 | - SocketRocket 456 | - YogaKit 457 | 458 | EXTERNAL SOURCES: 459 | boost: 460 | :podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec" 461 | DoubleConversion: 462 | :podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec" 463 | FBLazyVector: 464 | :path: "../node_modules/react-native/Libraries/FBLazyVector" 465 | FBReactNativeSpec: 466 | :path: "../node_modules/react-native/React/FBReactNativeSpec" 467 | glog: 468 | :podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec" 469 | hermes-engine: 470 | :podspec: "../node_modules/react-native/sdks/hermes/hermes-engine.podspec" 471 | RCT-Folly: 472 | :podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec" 473 | RCTRequired: 474 | :path: "../node_modules/react-native/Libraries/RCTRequired" 475 | RCTTypeSafety: 476 | :path: "../node_modules/react-native/Libraries/TypeSafety" 477 | React: 478 | :path: "../node_modules/react-native/" 479 | React-bridging: 480 | :path: "../node_modules/react-native/ReactCommon" 481 | React-callinvoker: 482 | :path: "../node_modules/react-native/ReactCommon/callinvoker" 483 | React-Codegen: 484 | :path: build/generated/ios 485 | React-Core: 486 | :path: "../node_modules/react-native/" 487 | React-CoreModules: 488 | :path: "../node_modules/react-native/React/CoreModules" 489 | React-cxxreact: 490 | :path: "../node_modules/react-native/ReactCommon/cxxreact" 491 | React-hermes: 492 | :path: "../node_modules/react-native/ReactCommon/hermes" 493 | React-jsi: 494 | :path: "../node_modules/react-native/ReactCommon/jsi" 495 | React-jsiexecutor: 496 | :path: "../node_modules/react-native/ReactCommon/jsiexecutor" 497 | React-jsinspector: 498 | :path: "../node_modules/react-native/ReactCommon/jsinspector" 499 | React-logger: 500 | :path: "../node_modules/react-native/ReactCommon/logger" 501 | react-native-performance-limiter: 502 | :path: "../.." 503 | React-perflogger: 504 | :path: "../node_modules/react-native/ReactCommon/reactperflogger" 505 | React-RCTActionSheet: 506 | :path: "../node_modules/react-native/Libraries/ActionSheetIOS" 507 | React-RCTAnimation: 508 | :path: "../node_modules/react-native/Libraries/NativeAnimation" 509 | React-RCTBlob: 510 | :path: "../node_modules/react-native/Libraries/Blob" 511 | React-RCTImage: 512 | :path: "../node_modules/react-native/Libraries/Image" 513 | React-RCTLinking: 514 | :path: "../node_modules/react-native/Libraries/LinkingIOS" 515 | React-RCTNetwork: 516 | :path: "../node_modules/react-native/Libraries/Network" 517 | React-RCTSettings: 518 | :path: "../node_modules/react-native/Libraries/Settings" 519 | React-RCTText: 520 | :path: "../node_modules/react-native/Libraries/Text" 521 | React-RCTVibration: 522 | :path: "../node_modules/react-native/Libraries/Vibration" 523 | React-runtimeexecutor: 524 | :path: "../node_modules/react-native/ReactCommon/runtimeexecutor" 525 | ReactCommon: 526 | :path: "../node_modules/react-native/ReactCommon" 527 | Yoga: 528 | :path: "../node_modules/react-native/ReactCommon/yoga" 529 | 530 | SPEC CHECKSUMS: 531 | boost: a7c83b31436843459a1961bfd74b96033dc77234 532 | CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 533 | DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 534 | FBLazyVector: 4d79ff044f28bf8ebf735074332e7a6c54e268f0 535 | FBReactNativeSpec: 944ea69e5efe4e94a63e0ceaf9bfdad6515aaf84 536 | Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0 537 | Flipper-Boost-iOSX: fd1e2b8cbef7e662a122412d7ac5f5bea715403c 538 | Flipper-DoubleConversion: 2dc99b02f658daf147069aad9dbd29d8feb06d30 539 | Flipper-Fmt: 60cbdd92fc254826e61d669a5d87ef7015396a9b 540 | Flipper-Folly: 584845625005ff068a6ebf41f857f468decd26b3 541 | Flipper-Glog: 70c50ce58ddaf67dc35180db05f191692570f446 542 | Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9 543 | Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 544 | FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 545 | fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 546 | glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b 547 | hermes-engine: 2af7b7a59128f250adfd86f15aa1d5a2ecd39995 548 | libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 549 | OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c 550 | RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda 551 | RCTRequired: 23f0d5d0dea22af22f30f146e090a7d16e6b8be7 552 | RCTTypeSafety: ca3de65d46a130875bf7816788998f13525f3235 553 | React: 5000106ef4132dad19f8a68dae76c987a5e33182 554 | React-bridging: d0b73f09bb4c83eb2e518ce28cb6ebedd4228ff1 555 | React-callinvoker: 6b14487211b7378f68602bbf2b3ae6513259339d 556 | React-Codegen: 49c45568b87b87ca4983c308df51e2aeeede5b44 557 | React-Core: 9348315d44f12995a55ee5d61b0f81a8829b2bfe 558 | React-CoreModules: 371d09d749b983527ac15d8368b49df7ce77ada9 559 | React-cxxreact: d1b7e6da62d6968d1c8d46c3bb39372c3131d09e 560 | React-hermes: f7c2a23a69ba46ab0fc2a9a4992c6f0c1dac6823 561 | React-jsi: c2cef15ce81a1150fac10e0b3f6ad9803bdec51b 562 | React-jsiexecutor: 1457c7bb2f08f257e6b5ece8b62348da43c4ccf2 563 | React-jsinspector: 2a1985769123b199c195a96f46478b35db139712 564 | React-logger: 7fbdc3576b2ed3834360c8ea3c1c2ec54ac3043a 565 | react-native-performance-limiter: 7e3c21d1ae93530660f2e22e399e45a7318b553c 566 | React-perflogger: f86e85eb59151d09e9b44b8931f5c088e4f08bbc 567 | React-RCTActionSheet: cd3d76501a6069e164986b93f144be34b593955c 568 | React-RCTAnimation: 2d09db635202e5d6f66de596f5a6b38389fe76ec 569 | React-RCTBlob: 4440a5ce3daa94b4dad8f23d8d7acc0c5ced99ff 570 | React-RCTImage: a6f1d5b74b6d6607217bf10512957440130445bb 571 | React-RCTLinking: c1ed0517e16591da5f783c88bbee6d408f48ef42 572 | React-RCTNetwork: 04f158cf31efb1d23d70163d45e148c62fd5a56c 573 | React-RCTSettings: 567bb65866245fb96f2151f80dd40c35ded425a4 574 | React-RCTText: e1ee68343ccaa3f03a84b48b513fdf59b01bc97d 575 | React-RCTVibration: 0b23ba09f2f6671a1ddee3c37d27b772b9448346 576 | React-runtimeexecutor: 77aa3714a353cfb1a5f5e315e8af5154cd3d9402 577 | ReactCommon: a29dac86d7219579db079cef8f380ebffe1ba545 578 | SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 579 | Yoga: 0518155cfbcc68c56223422f6a20a71b82e307d2 580 | YogaKit: f782866e155069a2cca2517aafea43200b01fd5a 581 | 582 | PODFILE CHECKSUM: a074e4ad5e3951b3c6f3f5fbe730984a957eb1fc 583 | 584 | COCOAPODS: 1.12.1 585 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const escape = require('escape-string-regexp'); 3 | const exclusionList = require('metro-config/src/defaults/exclusionList'); 4 | const pak = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | const modules = Object.keys({ 9 | ...pak.peerDependencies, 10 | }); 11 | 12 | module.exports = { 13 | projectRoot: __dirname, 14 | watchFolders: [root], 15 | 16 | // We need to make sure that only one version is loaded for peerDependencies 17 | // So we block them at the root, and alias them to the versions in example's node_modules 18 | resolver: { 19 | blacklistRE: exclusionList( 20 | modules.map( 21 | (m) => 22 | new RegExp(`^${escape(path.join(root, 'node_modules', m))}\\/.*$`) 23 | ) 24 | ), 25 | 26 | extraNodeModules: modules.reduce((acc, name) => { 27 | acc[name] = path.join(__dirname, 'node_modules', name); 28 | return acc; 29 | }, {}), 30 | }, 31 | 32 | transformer: { 33 | getTransformOptions: async () => ({ 34 | transform: { 35 | experimentalImportSupport: false, 36 | inlineRequires: true, 37 | }, 38 | }), 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PerfLimiterExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios", 8 | "start": "react-native start", 9 | "pods": "pod-install --quiet" 10 | }, 11 | "dependencies": { 12 | "react": "18.1.0", 13 | "react-native": "0.70.6" 14 | }, 15 | "devDependencies": { 16 | "@babel/core": "^7.12.9", 17 | "@babel/runtime": "^7.12.5", 18 | "metro-react-native-babel-preset": "0.72.3", 19 | "babel-plugin-module-resolver": "^4.1.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /example/react-native.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pak = require('../package.json'); 3 | 4 | module.exports = { 5 | dependencies: { 6 | [pak.name]: { 7 | root: path.join(__dirname, '..'), 8 | }, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | import { StyleSheet, View, Text, Button, Animated } from 'react-native'; 4 | import { 5 | blockJavascriptThread, 6 | blockNativeMainThread, 7 | crashJavascriptThread, 8 | crashNativeMainThread, 9 | } from 'react-native-performance-limiter'; 10 | 11 | export default function App() { 12 | const position = React.useRef(new Animated.Value(0)).current; 13 | const nativePosition = React.useRef(new Animated.Value(0)).current; 14 | 15 | React.useEffect(() => { 16 | Animated.loop( 17 | Animated.timing(position, { 18 | toValue: 200, 19 | duration: 2000, 20 | useNativeDriver: false, 21 | }) 22 | ).start(); 23 | }, [position]); 24 | 25 | React.useEffect(() => { 26 | Animated.loop( 27 | Animated.timing(nativePosition, { 28 | toValue: 200, 29 | duration: 2000, 30 | useNativeDriver: true, 31 | }) 32 | ).start(); 33 | }, [nativePosition]); 34 | 35 | return ( 36 | 37 | Javascript animation 38 | 41 | Native animation 42 | 45 |