mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
55
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82b401dc7d | ||
|
|
fb4587780e | ||
|
|
730a0d5aef | ||
|
|
14986a8dbf | ||
|
|
174ea179cd | ||
|
|
52f2cbab41 | ||
|
|
65671108f6 | ||
|
|
f697b5ad5c | ||
|
|
6c8bcad054 | ||
|
|
7b5307d181 | ||
|
|
5e1798ad7a | ||
|
|
ae4ce02752 | ||
|
|
52d8660964 | ||
|
|
bfc10ba90f | ||
|
|
3da74f0799 | ||
|
|
bbc0c0b6ef | ||
|
|
f84514a88b | ||
|
|
59101d6809 | ||
|
|
c102f24522 | ||
|
|
c0eeebbd9d | ||
|
|
2c3a00b7b1 | ||
|
|
7970ee9998 | ||
|
|
976055e52b | ||
|
|
2372c1c56a | ||
|
|
3ea2f62531 | ||
|
|
a7a51275b5 | ||
|
|
5c869fd0a5 | ||
|
|
0068b9ee90 | ||
|
|
aa27cdba9b | ||
|
|
57b5d7bf6f | ||
|
|
1f6eb884bf | ||
|
|
a0a77f7476 | ||
|
|
794df48ad6 | ||
|
|
6d4ea946f8 | ||
|
|
8488eaecea | ||
|
|
690cb00353 | ||
|
|
2534aeaddb | ||
|
|
ff85e2f6dd | ||
|
|
cb94e71845 | ||
|
|
087da29604 | ||
|
|
34fb932f97 | ||
|
|
1ceba3b470 | ||
|
|
b3d1d2a0a5 | ||
|
|
ea394f6229 | ||
|
|
7ea0ef7a90 | ||
|
|
36fed563c4 | ||
|
|
391a6b87a0 | ||
|
|
81c2e798d7 | ||
|
|
9f0903780b | ||
|
|
ae3b793de6 | ||
|
|
37a0517b3f | ||
|
|
e186f1bf17 | ||
|
|
eb2461c7c9 | ||
|
|
d89acc1596 | ||
|
|
5e3edafec6 |
+1
-1
@@ -104,4 +104,4 @@ untyped-import
|
||||
untyped-type-import
|
||||
|
||||
[version]
|
||||
^0.275.0
|
||||
^0.276.0
|
||||
|
||||
@@ -4,9 +4,6 @@ inputs:
|
||||
release-type:
|
||||
required: true
|
||||
description: The type of release we are building. It could be nightly, release or dry-run
|
||||
run-e2e-tests:
|
||||
default: 'false'
|
||||
description: If we need to build to run E2E tests. If yes, we need to build also x86.
|
||||
gradle-cache-encryption-key:
|
||||
description: "The encryption key needed to store the Gradle Configuration cache"
|
||||
runs:
|
||||
@@ -31,10 +28,11 @@ runs:
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: /github/home/.cache/ccache
|
||||
key: v1-ccache-android-${{ github.job }}-${{ github.ref }}
|
||||
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}-${{ hashFiles('packages/react-native/ReactAndroid/**/*.cpp', 'packages/react-native/ReactAndroid/**/*.h', 'packages/react-native/ReactCommon/**/*.cpp', 'packages/react-native/ReactAndroid/**/CMakeLists.txt', 'packages/react-native/ReactCommon/**/CMakeLists.txt') }}
|
||||
restore-keys: |
|
||||
v1-ccache-android-${{ github.job }}-
|
||||
v1-ccache-android-
|
||||
v2-ccache-android-${{ github.job }}-${{ github.ref }}-
|
||||
v2-ccache-android-${{ github.job }}-
|
||||
v2-ccache-android-
|
||||
- name: Show ccache stats
|
||||
shell: bash
|
||||
run: ccache -s -v
|
||||
@@ -43,11 +41,7 @@ runs:
|
||||
run: |
|
||||
if [[ "${{ inputs.release-type }}" == "dry-run" ]]; then
|
||||
# dry-run: we only build ARM64 to save time/resources. For release/nightlies the default is to build all archs.
|
||||
if [[ "${{ inputs.run-e2e-tests }}" == 'true' ]]; then
|
||||
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing
|
||||
else
|
||||
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a"
|
||||
fi
|
||||
export ORG_GRADLE_PROJECT_reactNativeArchitectures="arm64-v8a,x86" # x86 is required for E2E testing
|
||||
TASKS="publishAllToMavenTempLocal build"
|
||||
elif [[ "${{ inputs.release-type }}" == "nightly" ]]; then
|
||||
# nightly: we set isSnapshot to true so artifacts are sent to the right repository on Maven Central.
|
||||
@@ -63,7 +57,7 @@ runs:
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: /github/home/.cache/ccache
|
||||
key: v1-ccache-android-${{ github.job }}-${{ github.ref }}
|
||||
key: v2-ccache-android-${{ github.job }}-${{ github.ref }}-${{ hashFiles('packages/react-native/ReactAndroid/**/*.cpp', 'packages/react-native/ReactAndroid/**/*.h', 'packages/react-native/ReactCommon/**/*.cpp', 'packages/react-native/ReactAndroid/**/CMakeLists.txt', 'packages/react-native/ReactCommon/**/CMakeLists.txt') }}
|
||||
- name: Show ccache stats
|
||||
shell: bash
|
||||
run: ccache -s -v
|
||||
|
||||
@@ -15,8 +15,6 @@ runs:
|
||||
steps:
|
||||
- name: Setup xcode
|
||||
uses: ./.github/actions/setup-xcode
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Restore Hermes workspace
|
||||
uses: ./.github/actions/restore-hermes-workspace
|
||||
- name: Restore Cached Artifacts
|
||||
@@ -45,6 +43,8 @@ runs:
|
||||
echo "ARTIFACTS_EXIST=true" >> $GITHUB_ENV
|
||||
echo "ARTIFACTS_EXIST=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Yarn- Install Dependencies
|
||||
if: ${{ steps.check_if_apple_artifacts_are_there.outputs.ARTIFACTS_EXIST != 'true' }}
|
||||
uses: ./.github/actions/yarn-install
|
||||
|
||||
@@ -116,12 +116,12 @@ runs:
|
||||
- name: Print Artifacts Directory
|
||||
shell: bash
|
||||
run: ls -lR ./packages/react-native/ReactAndroid/external-artifacts/artifacts/
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Setup gradle
|
||||
uses: ./.github/actions/setup-gradle
|
||||
with:
|
||||
cache-encryption-key: ${{ inputs.gradle-cache-encryption-key }}
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Build packages
|
||||
|
||||
@@ -14,6 +14,8 @@ inputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Configure Git
|
||||
|
||||
@@ -35,6 +35,8 @@ runs:
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'zulu'
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Start Metro in Debug
|
||||
|
||||
@@ -17,9 +17,6 @@ outputs:
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
|
||||
- name: Setup hermes version
|
||||
shell: bash
|
||||
id: hermes-version
|
||||
@@ -67,6 +64,8 @@ runs:
|
||||
echo "HERMES_CACHED=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Yarn- Install Dependencies
|
||||
if: ${{ steps.meaningful-cache.outputs.HERMES_CACHED != 'true' }}
|
||||
uses: ./.github/actions/yarn-install
|
||||
|
||||
@@ -23,6 +23,8 @@ runs:
|
||||
uses: ./.github/actions/setup-xcode
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Run yarn install
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Create Hermes folder
|
||||
shell: bash
|
||||
run: mkdir -p "$HERMES_WS_DIR"
|
||||
@@ -34,8 +36,6 @@ runs:
|
||||
- name: Print Downloaded hermes
|
||||
shell: bash
|
||||
run: ls -lR "$HERMES_WS_DIR"
|
||||
- name: Run yarn
|
||||
uses: ./.github/actions/yarn-install
|
||||
- name: Setup ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
|
||||
@@ -31,7 +31,7 @@ runs:
|
||||
run: |
|
||||
cd /tmp/RNApp/ios
|
||||
bundle install
|
||||
bundle exec pod install
|
||||
RCT_USE_RN_DEP=1 RCT_USE_PREBUILT_RNCORE=1 bundle exec pod install
|
||||
xcodebuild build \
|
||||
-workspace RNApp.xcworkspace \
|
||||
-scheme RNApp \
|
||||
|
||||
@@ -2,8 +2,6 @@ name: yarn-install
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Setup node.js
|
||||
uses: ./.github/actions/setup-node
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
|
||||
@@ -2,11 +2,6 @@ name: Test All
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
run-e2e-tests:
|
||||
description: Whether to run E2E tests or not
|
||||
type: boolean
|
||||
default: false
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
@@ -168,7 +163,6 @@ jobs:
|
||||
flavor: ${{ matrix.flavor }}
|
||||
|
||||
test_e2e_ios_rntester:
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
|
||||
runs-on: macos-14-large
|
||||
needs:
|
||||
[test_ios_rntester]
|
||||
@@ -202,7 +196,6 @@ jobs:
|
||||
flavor: ${{ matrix.flavor }}
|
||||
|
||||
test_e2e_ios_templateapp:
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
|
||||
runs-on: macos-14-large
|
||||
needs: [build_npm_package, prebuild_apple_dependencies]
|
||||
env:
|
||||
@@ -295,7 +288,6 @@ jobs:
|
||||
working-directory: /tmp/RNTestProject
|
||||
|
||||
test_e2e_android_templateapp:
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
|
||||
runs-on: 4-core-ubuntu
|
||||
needs: build_npm_package
|
||||
strategy:
|
||||
@@ -414,11 +406,9 @@ jobs:
|
||||
uses: ./.github/actions/build-android
|
||||
with:
|
||||
release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }}
|
||||
run-e2e-tests: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
|
||||
gradle-cache-encryption-key: ${{ secrets.GRADLE_CACHE_ENCRYPTION_KEY }}
|
||||
|
||||
test_e2e_android_rntester:
|
||||
if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }}
|
||||
runs-on: 4-core-ubuntu
|
||||
needs: [build_android]
|
||||
strategy:
|
||||
@@ -583,7 +573,8 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node-version: ["24", "22", "20"]
|
||||
node-version: ["24", "22"]
|
||||
# node-version: ["24", "22", "20.19.4"]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -616,7 +607,7 @@ jobs:
|
||||
rerun-failed-jobs:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [test_e2e_ios_rntester, test_e2e_android_rntester, test_e2e_ios_templateapp, test_e2e_android_templateapp]
|
||||
if: always()
|
||||
if: ${{ github.ref == 'refs/heads/main' && always() }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -43,7 +43,6 @@ project.xcworkspace
|
||||
/private/helloworld/android/app/build/
|
||||
/private/helloworld/android/build/
|
||||
/packages/react-native-popup-menu-android/android/build/
|
||||
/packages/react-native-test-library/android/build/
|
||||
|
||||
# Buck
|
||||
.buckd
|
||||
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"bracketSameLine": true,
|
||||
"bracketSpacing": false,
|
||||
"requirePragma": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"endOfLine": "lf",
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*.code-workspace"],
|
||||
"options": {
|
||||
"parser": "json"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"*.js",
|
||||
"*.js.flow"
|
||||
],
|
||||
"options": {
|
||||
"parser": "hermes"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"**/__docs__/*.md"
|
||||
],
|
||||
"options": {
|
||||
"parser": "markdown",
|
||||
"proseWrap": "always",
|
||||
"requirePragma": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
arrowParens: 'avoid',
|
||||
bracketSameLine: true,
|
||||
bracketSpacing: false,
|
||||
requirePragma: true,
|
||||
singleQuote: true,
|
||||
trailingComma: 'all',
|
||||
endOfLine: 'lf',
|
||||
plugins: [
|
||||
// Using module.parent and createRequire hack to simulate prettier v2 plugin resolution behavior.
|
||||
// The hack allows us to resolve the plugin from the install location of prettier.
|
||||
(module.parent
|
||||
? require('module').createRequire(module.parent.id)
|
||||
: require
|
||||
).resolve('prettier-plugin-hermes-parser'),
|
||||
],
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.code-workspace'],
|
||||
options: {
|
||||
parser: 'json',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['*.js', '*.js.flow'],
|
||||
options: {
|
||||
parser: 'hermes',
|
||||
},
|
||||
},
|
||||
{
|
||||
files: ['**/__docs__/*.md'],
|
||||
options: {
|
||||
parser: 'markdown',
|
||||
proseWrap: 'always',
|
||||
requirePragma: false,
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
+109
@@ -1,5 +1,114 @@
|
||||
# Changelog
|
||||
|
||||
## v0.81.0-rc.2
|
||||
|
||||
### Breaking
|
||||
|
||||
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
|
||||
|
||||
### Added
|
||||
|
||||
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
- Added support to `react-native/babel-preset` for a `hermesParserOptions` option, that expects an object that enables overriding `hermes-parser` options. ([0508eddfe6](https://github.com/facebook/react-native/commit/0508eddfe60df60cb3bfa4074ae199bd0e492d5f) by [@yungsters](https://github.com/yungsters))
|
||||
- `NewAppScreen` no longer internally handles device safe area, use optional `safeAreaInsets` prop (aligned in 0.81 template) ([732bd12dc2](https://github.com/facebook/react-native/commit/732bd12dc21460641ef01b23f2eb722f26b060d5) by [@huntie](https://github.com/huntie))
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
|
||||
|
||||
### Deprecated
|
||||
|
||||
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
|
||||
|
||||
### Removed
|
||||
|
||||
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
- Fixed issue with RNDeps release/debug switch failing ([4ee2b60a1e](https://github.com/facebook/react-native/commit/4ee2b60a1eacca744d58a7ad336ca9d3714289f6) by [@chrfalch](https://github.com/chrfalch))
|
||||
- Fixed missing script for resolving prebuilt xcframework when switching between release/debug ([2e55241a90](https://github.com/facebook/react-native/commit/2e55241a901b4cd95917de68ce9078928820a208) by [@chrfalch](https://github.com/chrfalch))
|
||||
|
||||
### Security
|
||||
|
||||
|
||||
|
||||
#### Android specific
|
||||
|
||||
|
||||
|
||||
#### iOS specific
|
||||
|
||||
|
||||
|
||||
### Unknown
|
||||
|
||||
- Release 0.81.0-rc.2 ([68ef746ec5](https://github.com/facebook/react-native/commit/68ef746ec5dd7d2874d190733e75bb8197034c5a) by [@react-native-bot](https://github.com/react-native-bot))
|
||||
- Fix E2E test script when the ci flag is not specified ([cdd7f99581](https://github.com/facebook/react-native/commit/cdd7f995813727b630ff38abc8a910a0f8f10b37) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Fix E2E script when using CI artifacts ([d8bf94489a](https://github.com/facebook/react-native/commit/d8bf94489ab7498eba7e5f45d09dd2819fe739c3) by [@cipolleschi](https://github.com/cipolleschi))
|
||||
- Bump Podfile.lock ([10b63c15b6](https://github.com/facebook/react-native/commit/10b63c15b6faaf54d555ede879f82ac565f030a9) by [@react-native-bot](https://github.com/react-native-bot))
|
||||
- Release 0.81.0-rc.1 ([b06bb89ddd](https://github.com/facebook/react-native/commit/b06bb89ddd3cebddea4716036a4368b87a65f492) by [@react-native-bot](https://github.com/react-native-bot))
|
||||
|
||||
#### Android Unknown
|
||||
|
||||
|
||||
|
||||
#### iOS Unknown
|
||||
|
||||
|
||||
|
||||
#### Failed to parse
|
||||
|
||||
|
||||
|
||||
|
||||
## v0.81.0-rc.1
|
||||
|
||||
### Added
|
||||
|
||||
@@ -157,4 +157,11 @@ allprojects {
|
||||
com.ncorti.ktfmt.gradle.tasks.KtfmtCheckTask::class,
|
||||
com.ncorti.ktfmt.gradle.tasks.KtfmtFormatTask::class)
|
||||
.forEach { tasks.withType(it) { exclude(excludePatterns) } }
|
||||
|
||||
// Disable the problematic ktfmt script tasks due to symbolic link issues in subprojects
|
||||
afterEvaluate {
|
||||
listOf("ktfmtCheckScripts", "ktfmtFormatScripts").forEach {
|
||||
tasks.findByName(it)?.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -56,8 +56,8 @@
|
||||
"@electron/packager": "^18.3.6",
|
||||
"@jest/create-cache-key-function": "^29.7.0",
|
||||
"@microsoft/api-extractor": "^7.52.2",
|
||||
"@react-native/metro-babel-transformer": "0.81.0-main",
|
||||
"@react-native/metro-config": "0.81.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.82.0-main",
|
||||
"@react-native/metro-config": "0.82.0-main",
|
||||
"@tsconfig/node22": "22.0.2",
|
||||
"@types/react": "^19.1.0",
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
@@ -82,7 +82,7 @@
|
||||
"eslint-plugin-redundant-undefined": "^0.4.0",
|
||||
"eslint-plugin-relay": "^1.8.3",
|
||||
"flow-api-translator": "0.29.1",
|
||||
"flow-bin": "^0.275.0",
|
||||
"flow-bin": "^0.276.0",
|
||||
"glob": "^7.1.1",
|
||||
"hermes-eslint": "0.29.1",
|
||||
"hermes-transform": "0.29.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/assets-registry",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Asset support code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-plugin-codegen",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Babel plugin to generate native module and view manager code for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/traverse": "^7.25.3",
|
||||
"@react-native/codegen": "0.81.0-main"
|
||||
"@react-native/codegen": "0.82.0-main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.25.2"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/community-cli-plugin",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Core CLI commands for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -22,7 +22,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/dev-middleware": "0.81.0-main",
|
||||
"@react-native/dev-middleware": "0.82.0-main",
|
||||
"debug": "^4.4.0",
|
||||
"invariant": "^2.2.4",
|
||||
"metro": "^0.83.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/core-cli-utils",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "React Native CLI library for Frameworks to build on",
|
||||
"license": "MIT",
|
||||
"main": "./src/index.flow.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/debugger-frontend",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Debugger frontend for React Native based on Chrome DevTools",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env dotslash
|
||||
|
||||
// @generated SignedSource<<686df5695b32a90cd465412d979a1a3f>>
|
||||
|
||||
|
||||
{
|
||||
"name": "React Native DevTools",
|
||||
"platforms": {
|
||||
"linux-aarch64": {
|
||||
"size": 113511487,
|
||||
"hash": "sha256",
|
||||
"digest": "c22f7d5e029357f05055ce7c56cc284a0d441d558e103a7b7ebae118c67d0b95",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQPRilWDJV8xyKEv9lqYn7Hf2kyZg6nqW8KctGZCXsU95lS_MTFyAmEULrB3J6hGCjqBY2Zl-uq_FjERAIgzbZFWX2eceacTbutBSOKEj6QTZzkVN_L1zPh2lGh24x29MHpkwUzw4E-kAXV43f-11QxqD7orI1QicyOnsmUqeRNKE_QjM9rNRsw6iE8"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools-linux-arm64/React Native DevTools"
|
||||
},
|
||||
"linux-x86_64": {
|
||||
"size": 113244728,
|
||||
"hash": "sha256",
|
||||
"digest": "d749aee18d6c969f033511ed631b439c578068cc20786974bc0ee707c6c2f177",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQP8NAAXjHJ-9NJThip1nnmVim4yiS1tdYAXmWl2Remiluq5f13nXA8YEadsmGRLWxXz2WJouHXSK47ea4a30fxewyKeTt0niFn3T-lr_91m3Ve5ZS-FOZ_9CRVCkv5zC-Z1FlXJGOnphfWetIU10Pw9tho3IzjdSNlXle0XTrkJ2AyKSl4cKPaX"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools-linux-x64/React Native DevTools"
|
||||
},
|
||||
"macos-aarch64": {
|
||||
"size": 108805847,
|
||||
"hash": "sha256",
|
||||
"digest": "dc4a6cfa3d2d8646db8793ef497e43ad72be54bb14ed96345d059880ff72ce1e",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQPuZx9G4h30mUDM0hZ8y74LbzAi7-S6jnOqq8uyfDdIptLwIgpb8CKB8F2tduvaBFMGd7obwXd2NVy01r6XKVdgAK5-QTp8PYUPUE7VSCi6QAqobXcQ2uq_lY-jgyj8XkV4Ua4gA6KR609Bmh-beSTOrSqMymqVodaGqoGjB_9jVwfD99_PfFlex-Ta"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools.app/Contents/MacOS/React Native DevTools"
|
||||
},
|
||||
"macos-x86_64": {
|
||||
"size": 113766610,
|
||||
"hash": "sha256",
|
||||
"digest": "74178859ce6a1c26c32055e192b1b123822c76c827ea86a6dfdb5463b89b1ace",
|
||||
"providers": [
|
||||
{
|
||||
"type": "http",
|
||||
"url": "https://scontent.xx.fbcdn.net/mci_ab/uap/?ab_b=m&ab_page=react_native_devtools_binaries&ab_entry=AQN6DjGhr8_L7N_cwrh8pi3cfNcbn9dot_QQpgwe3Vv-780FDgi6JUeMvbo_wbFoT2rogxfHZ0-NbXbKdWYwhGUoGeQuikT57QnVMOYuPUTjlQUgYy0Ng9XPhq3iSEYwlMV1XsUJuPFRUg-hIHcgaaA55JoTLXZ1fLYydhHnmgRxGHc4pxaHvSpTtQ"
|
||||
}
|
||||
],
|
||||
"format": "tar.gz",
|
||||
"path": "React Native DevTools.app/Contents/MacOS/React Native DevTools"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/debugger-shell",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Experimental debugger shell for React Native for use with @react-native/debugger-frontend",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/dev-middleware",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Dev server middleware for React Native",
|
||||
"keywords": [
|
||||
"react-native",
|
||||
@@ -23,7 +23,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@isaacs/ttlcache": "^1.4.1",
|
||||
"@react-native/debugger-frontend": "0.81.0-main",
|
||||
"@react-native/debugger-frontend": "0.82.0-main",
|
||||
"chrome-launcher": "^0.15.2",
|
||||
"chromium-edge-launcher": "^0.2.0",
|
||||
"connect": "^3.6.5",
|
||||
|
||||
@@ -184,7 +184,7 @@ describe.each(['HTTP', 'HTTPS'])(
|
||||
describe.each(['10.0.2.2:8080', '[::1]', 'example.com:2000'])(
|
||||
'%s aliasing to and from localhost',
|
||||
sourceHost => {
|
||||
test('in source map fetching during Debugger.scriptParsed', async () => {
|
||||
test('Debugger.scriptParsed - in source map fetching', async () => {
|
||||
serverRef.app.use('/source-map', serveStaticJson({version: 3}));
|
||||
const {device, debugger_} = await createAndConnectTarget(
|
||||
serverRef,
|
||||
@@ -220,6 +220,53 @@ describe.each(['HTTP', 'HTTPS'])(
|
||||
}
|
||||
});
|
||||
|
||||
test('Runtime.consoleAPICalled - in location resolutions', async () => {
|
||||
const {device, debugger_} = await createAndConnectTarget(
|
||||
serverRef,
|
||||
autoCleanup.signal,
|
||||
{
|
||||
app: 'bar-app',
|
||||
id: 'page1',
|
||||
title: 'bar-title',
|
||||
vm: 'bar-vm',
|
||||
},
|
||||
{
|
||||
deviceHostHeader: sourceHost,
|
||||
},
|
||||
);
|
||||
try {
|
||||
const consoleMessage = await sendFromTargetToDebugger(
|
||||
device,
|
||||
debugger_,
|
||||
'page1',
|
||||
{
|
||||
method: 'Runtime.consoleAPICalled',
|
||||
params: {
|
||||
stackTrace: {
|
||||
callFrames: [
|
||||
{
|
||||
url: `${protocol.toLowerCase()}://${sourceHost}/bundleFile:1:2`,
|
||||
field2: 'aaa',
|
||||
},
|
||||
{
|
||||
url: `${protocol.toLowerCase()}://${sourceHost}/bundleFile:5:4`,
|
||||
field3: 'bbb',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
expect(consoleMessage.params.stackTrace.callFrames).toEqual([
|
||||
{url: `${serverRef.serverBaseUrl}/bundleFile:1:2`, field2: 'aaa'},
|
||||
{url: `${serverRef.serverBaseUrl}/bundleFile:5:4`, field3: 'bbb'},
|
||||
]);
|
||||
} finally {
|
||||
device.close();
|
||||
debugger_.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('in Debugger.setBreakpointByUrl', async () => {
|
||||
const {device, debugger_} = await createAndConnectTarget(
|
||||
serverRef,
|
||||
|
||||
@@ -844,6 +844,23 @@ export default class Device {
|
||||
|
||||
this.#isLegacyPageReloading = false;
|
||||
}
|
||||
|
||||
if (payload.method === 'Runtime.consoleAPICalled') {
|
||||
const callFrames = payload.params?.stackTrace?.callFrames ?? [];
|
||||
for (const callFrame of callFrames) {
|
||||
if (callFrame.url) {
|
||||
const parsedUrl = this.#tryParseHTTPURL(callFrame.url);
|
||||
if (parsedUrl) {
|
||||
// Rewrite device-relative URLs pointing to the server so that they're
|
||||
// reachable from the frontend.
|
||||
callFrame.url = this.#deviceRelativeUrlToDebuggerRelativeUrl(
|
||||
parsedUrl,
|
||||
debuggerInfo,
|
||||
).href;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,6 +48,7 @@ export type CDPClientMessage =
|
||||
|
||||
export type CDPServerMessage =
|
||||
| CDPEvent<'Debugger.scriptParsed'>
|
||||
| CDPEvent<'Runtime.consoleAPICalled'>
|
||||
| CDPEvent<>
|
||||
| CDPResponse<'Debugger.getScriptSource'>
|
||||
| CDPResponse<>;
|
||||
|
||||
@@ -84,10 +84,27 @@ export interface Debugger {
|
||||
*/
|
||||
sourceMapURL: string,
|
||||
};
|
||||
|
||||
ConsoleAPICalled: {
|
||||
args: Array<{type: string, value: string}>,
|
||||
executionContextId: number,
|
||||
stackTrace: {
|
||||
timestamp: number,
|
||||
type: string,
|
||||
callFrames: Array<{
|
||||
columnNumber: number,
|
||||
lineNumber: number,
|
||||
functionName: string,
|
||||
scriptId: string,
|
||||
url: string,
|
||||
}>,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type Events = {
|
||||
'Debugger.scriptParsed': Debugger['ScriptParsedEvent'],
|
||||
'Runtime.consoleAPICalled': Debugger['ConsoleAPICalled'],
|
||||
[method: string]: JSONSerializable,
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-config",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "ESLint config for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/eslint-parser": "^7.25.1",
|
||||
"@react-native/eslint-plugin": "0.81.0-main",
|
||||
"@react-native/eslint-plugin": "0.82.0-main",
|
||||
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
||||
"@typescript-eslint/parser": "^8.36.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "ESLint rules for @react-native/eslint-config",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/eslint-plugin-specs",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "ESLint rules to validate NativeModule and Component Specs",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,7 +26,7 @@
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
|
||||
"@react-native/codegen": "0.81.0-main",
|
||||
"@react-native/codegen": "0.82.0-main",
|
||||
"make-dir": "^2.1.0",
|
||||
"pirates": "^4.0.1",
|
||||
"source-map-support": "0.5.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/gradle-plugin",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Gradle Plugin for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+2
-2
@@ -100,10 +100,10 @@ abstract class ReactExtension @Inject constructor(val project: Project) {
|
||||
* Allows to specify the debuggable variants (by default just 'debug'). Variants in this list will
|
||||
* not be bundled (the bundle file will not be created and won't be copied over).
|
||||
*
|
||||
* Default: ['debug']
|
||||
* Default: ['debug', 'debugOptimized']
|
||||
*/
|
||||
val debuggableVariants: ListProperty<String> =
|
||||
objects.listProperty(String::class.java).convention(listOf("debug"))
|
||||
objects.listProperty(String::class.java).convention(listOf("debug", "debugOptimized"))
|
||||
|
||||
/** Hermes Config */
|
||||
|
||||
|
||||
+2
@@ -18,6 +18,7 @@ import com.facebook.react.tasks.GenerateEntryPointTask
|
||||
import com.facebook.react.tasks.GeneratePackageListTask
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForApp
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildConfigFieldsForLibraries
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureBuildTypesForApp
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureDevServerLocation
|
||||
import com.facebook.react.utils.AgpConfiguratorUtils.configureNamespaceForLibraries
|
||||
import com.facebook.react.utils.BackwardCompatUtils.configureBackwardCompatibilityReactMap
|
||||
@@ -84,6 +85,7 @@ class ReactPlugin : Plugin<Project> {
|
||||
configureAutolinking(project, extension)
|
||||
configureCodegen(project, extension, rootExtension, isLibrary = false)
|
||||
configureResources(project, extension)
|
||||
configureBuildTypesForApp(project)
|
||||
}
|
||||
|
||||
// Library Only Configuration
|
||||
|
||||
+31
@@ -19,6 +19,7 @@ import java.net.Inet4Address
|
||||
import java.net.NetworkInterface
|
||||
import javax.xml.parsers.DocumentBuilder
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
import kotlin.plus
|
||||
import org.gradle.api.Action
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.AppliedPlugin
|
||||
@@ -27,6 +28,36 @@ import org.w3c.dom.Element
|
||||
@Suppress("UnstableApiUsage")
|
||||
internal object AgpConfiguratorUtils {
|
||||
|
||||
fun configureBuildTypesForApp(project: Project) {
|
||||
val action =
|
||||
Action<AppliedPlugin> {
|
||||
project.extensions
|
||||
.getByType(ApplicationAndroidComponentsExtension::class.java)
|
||||
.finalizeDsl { ext ->
|
||||
ext.buildTypes {
|
||||
val debug =
|
||||
getByName("debug").apply {
|
||||
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
||||
}
|
||||
getByName("release").apply {
|
||||
manifestPlaceholders["usesCleartextTraffic"] = "false"
|
||||
}
|
||||
maybeCreate("debugOptimized").apply {
|
||||
manifestPlaceholders["usesCleartextTraffic"] = "true"
|
||||
initWith(debug)
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments("-DCMAKE_BUILD_TYPE=Release")
|
||||
matchingFallbacks += listOf("release")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
project.pluginManager.withPlugin("com.android.application", action)
|
||||
}
|
||||
|
||||
fun configureBuildConfigFieldsForApp(project: Project, extension: ReactExtension) {
|
||||
val action =
|
||||
Action<AppliedPlugin> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-config",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Metro configuration for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -26,8 +26,8 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/js-polyfills": "0.81.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.81.0-main",
|
||||
"@react-native/js-polyfills": "0.82.0-main",
|
||||
"@react-native/metro-babel-transformer": "0.82.0-main",
|
||||
"metro-config": "^0.83.0",
|
||||
"metro-runtime": "^0.83.0"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/new-app-screen",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "NewAppScreen component for React Native",
|
||||
"keywords": [
|
||||
"react-native"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/normalize-colors",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Color normalization for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/js-polyfills",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Polyfills for React Native.",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/babel-preset",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Babel preset for React Native applications",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -66,7 +66,7 @@
|
||||
"@babel/plugin-transform-typescript": "^7.25.2",
|
||||
"@babel/plugin-transform-unicode-regex": "^7.24.7",
|
||||
"@babel/template": "^7.25.0",
|
||||
"@react-native/babel-plugin-codegen": "0.81.0-main",
|
||||
"@react-native/babel-plugin-codegen": "0.82.0-main",
|
||||
"babel-plugin-syntax-hermes-parser": "0.29.1",
|
||||
"babel-plugin-transform-flow-enums": "^0.0.2",
|
||||
"react-refresh": "^0.14.0"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/metro-babel-transformer",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Babel transformer for React Native applications.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -27,7 +27,7 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.25.2",
|
||||
"@react-native/babel-preset": "0.81.0-main",
|
||||
"@react-native/babel-preset": "0.82.0-main",
|
||||
"hermes-parser": "0.29.1",
|
||||
"nullthrows": "^1.1.1"
|
||||
},
|
||||
|
||||
+2
-1
@@ -4,5 +4,6 @@
|
||||
"bracketSpacing": false,
|
||||
"requirePragma": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
"trailingComma": "all",
|
||||
"parser": "babel"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/codegen",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Code generation tools for React Native",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
||||
+8
-6
@@ -32,7 +32,7 @@ const prettier = require('prettier');
|
||||
const {styleText} = require('util');
|
||||
|
||||
const prettierConfig = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, '..', '.prettierrc'), 'utf8'),
|
||||
fs.readFileSync(path.resolve(__dirname, '..', 'build.prettierrc'), 'utf8'),
|
||||
);
|
||||
|
||||
const SRC_DIR = 'src';
|
||||
@@ -58,7 +58,7 @@ function getBuildPath(file, buildFolder) {
|
||||
return path.resolve(pkgBuildPath, relativeToSrcPath);
|
||||
}
|
||||
|
||||
function buildFile(file, silent) {
|
||||
async function buildFile(file, silent) {
|
||||
const destPath = getBuildPath(file, BUILD_DIR);
|
||||
|
||||
fs.mkdirSync(path.dirname(destPath), {recursive: true});
|
||||
@@ -82,7 +82,7 @@ function buildFile(file, silent) {
|
||||
'\n',
|
||||
);
|
||||
} else {
|
||||
const transformed = prettier.format(
|
||||
const transformed = await prettier.format(
|
||||
babel.transformFileSync(file, {}).code,
|
||||
{
|
||||
...prettierConfig,
|
||||
@@ -111,6 +111,8 @@ const files = glob.sync(pattern, {nodir: true});
|
||||
|
||||
process.stdout.write(fixedWidth(`${path.basename(PACKAGE_DIR)}\n`));
|
||||
|
||||
files.forEach(file => buildFile(file, !process.argv.includes('--verbose')));
|
||||
|
||||
process.stdout.write(`[ ${styleText('green', 'OK')} ]\n`);
|
||||
Promise.all(
|
||||
files.map(file => buildFile(file, !process.argv.includes('--verbose'))),
|
||||
).then(() => {
|
||||
process.stdout.write(`[ ${styleText('green', 'OK')} ]\n`);
|
||||
});
|
||||
|
||||
+3
-1
@@ -317,7 +317,9 @@ function buildViewConfig(
|
||||
return directEvents;
|
||||
}, []);
|
||||
|
||||
const properties = [
|
||||
const properties: Array<
|
||||
BabelNodeObjectMethod | BabelNodeObjectProperty | BabelNodeSpreadElement,
|
||||
> = [
|
||||
t.objectProperty(
|
||||
t.identifier('uiViewClassName'),
|
||||
t.stringLiteral(componentName),
|
||||
|
||||
@@ -47,15 +47,15 @@ const HostFunctionTemplate = ({
|
||||
isVoid
|
||||
? `\n ${methodCall};`
|
||||
: isNullable
|
||||
? `\n auto result = ${methodCall};`
|
||||
: ''
|
||||
? `\n auto result = ${methodCall};`
|
||||
: ''
|
||||
}
|
||||
return ${
|
||||
isVoid
|
||||
? 'jsi::Value::undefined()'
|
||||
: isNullable
|
||||
? 'result ? jsi::Value(std::move(*result)) : jsi::Value::null()'
|
||||
: methodCall
|
||||
? 'result ? jsi::Value(std::move(*result)) : jsi::Value::null()'
|
||||
: methodCall
|
||||
};
|
||||
}`;
|
||||
};
|
||||
|
||||
@@ -572,17 +572,17 @@ function translateEventEmitterToCpp(
|
||||
${
|
||||
isVoidTypeAnnotation ? '' : `template <typename ${templateName}> `
|
||||
}void emit${toPascalCase(eventEmitter.name)}(${
|
||||
isVoidTypeAnnotation
|
||||
? ''
|
||||
: `${isArray ? `std::vector<${templateName}>` : templateName} value`
|
||||
}) {${
|
||||
isVoidTypeAnnotation
|
||||
? ''
|
||||
: `
|
||||
isVoidTypeAnnotation
|
||||
? ''
|
||||
: `${isArray ? `std::vector<${templateName}>` : templateName} value`
|
||||
}) {${
|
||||
isVoidTypeAnnotation
|
||||
? ''
|
||||
: `
|
||||
static_assert(bridging::supportsFromJs<${
|
||||
isArray ? `std::vector<${templateName}>` : templateName
|
||||
}, ${jsiType}>, "value cannnot be converted to ${jsiType}");`
|
||||
}
|
||||
}
|
||||
static_cast<AsyncEventEmitter<${
|
||||
isVoidTypeAnnotation ? '' : 'jsi::Value'
|
||||
}>&>(*delegate_.eventEmitterMap_["${eventEmitter.name}"]).emit(${
|
||||
|
||||
+6
-6
@@ -84,10 +84,10 @@ function EventEmitterTemplate(
|
||||
: ''
|
||||
}) {
|
||||
mEventEmitterCallback.invoke("${eventEmitter.name}"${
|
||||
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
||||
? ', value'
|
||||
: ''
|
||||
});
|
||||
eventEmitter.typeAnnotation.typeAnnotation.type !== 'VoidTypeAnnotation'
|
||||
? ', value'
|
||||
: ''
|
||||
});
|
||||
}`;
|
||||
}
|
||||
|
||||
@@ -113,8 +113,8 @@ function MethodTemplate(
|
||||
const methodClosing = abstract
|
||||
? ';'
|
||||
: methodBody != null && methodBody.length > 0
|
||||
? ` { ${methodBody} }`
|
||||
: ' {}';
|
||||
? ` { ${methodBody} }`
|
||||
: ' {}';
|
||||
return ` ${methodJavaAnnotation}
|
||||
public ${methodQualifier}${translatedReturnType} ${methodName}(${traversedArgs.join(
|
||||
', ',
|
||||
|
||||
Vendored
+12
-12
@@ -74,22 +74,22 @@ namespace facebook::react {
|
||||
}),
|
||||
)
|
||||
.join('\n' + ' '.repeat(8))}${
|
||||
eventEmitters.length > 0
|
||||
? eventEmitters
|
||||
.map(eventEmitter => {
|
||||
return `
|
||||
eventEmitters.length > 0
|
||||
? eventEmitters
|
||||
.map(eventEmitter => {
|
||||
return `
|
||||
eventEmitterMap_["${eventEmitter.name}"] = std::make_shared<AsyncEventEmitter<id>>();`;
|
||||
})
|
||||
.join('')
|
||||
: ''
|
||||
}${
|
||||
eventEmitters.length > 0
|
||||
? `
|
||||
})
|
||||
.join('')
|
||||
: ''
|
||||
}${
|
||||
eventEmitters.length > 0
|
||||
? `
|
||||
setEventEmitterCallback([&](const std::string &name, id value) {
|
||||
static_cast<AsyncEventEmitter<id> &>(*eventEmitterMap_[name]).emit(value);
|
||||
});`
|
||||
: ''
|
||||
}
|
||||
: ''
|
||||
}
|
||||
}
|
||||
} // namespace facebook::react`;
|
||||
|
||||
|
||||
+24
-24
@@ -116,10 +116,10 @@ describe('Flow Module Parser', () => {
|
||||
nullable && optional
|
||||
? 'a nullable and optional'
|
||||
: nullable
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
|
||||
function annotateArg(paramName: string, paramType: string) {
|
||||
if (nullable && optional) {
|
||||
@@ -167,10 +167,10 @@ describe('Flow Module Parser', () => {
|
||||
(nullable && optional
|
||||
? 'Nullable and Optional'
|
||||
: nullable
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Parameter',
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Parameter',
|
||||
() => {
|
||||
it(`should not parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Function'`, () => {
|
||||
expect(() => parseParamType('arg', 'Function')).toThrow(
|
||||
@@ -397,10 +397,10 @@ describe('Flow Module Parser', () => {
|
||||
isPropNullable && isPropOptional
|
||||
? 'a nullable and optional'
|
||||
: isPropNullable
|
||||
? 'a nullable'
|
||||
: isPropOptional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
? 'a nullable'
|
||||
: isPropOptional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
|
||||
function annotateProp(propName: string, propType: string) {
|
||||
if (isPropNullable && isPropOptional) {
|
||||
@@ -465,10 +465,10 @@ describe('Flow Module Parser', () => {
|
||||
(isPropNullable && isPropOptional
|
||||
? 'Nullable and Optional'
|
||||
: isPropNullable
|
||||
? 'Nullable'
|
||||
: isPropOptional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
? 'Nullable'
|
||||
: isPropOptional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
() => {
|
||||
describe('Props with Primitive Types', () => {
|
||||
PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => {
|
||||
@@ -932,10 +932,10 @@ describe('Flow Module Parser', () => {
|
||||
nullable && optional
|
||||
? 'a nullable and optional'
|
||||
: nullable
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
|
||||
function annotateProp(propName: string, propType: string) {
|
||||
if (nullable && optional) {
|
||||
@@ -1001,10 +1001,10 @@ describe('Flow Module Parser', () => {
|
||||
(nullable && optional
|
||||
? 'Nullable and Optional'
|
||||
: nullable
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
() => {
|
||||
/**
|
||||
* TODO: Fill out props in promise
|
||||
|
||||
+10
-10
@@ -187,8 +187,8 @@ class FlowParser implements Parser {
|
||||
typeAnnotation.type === 'EnumStringBody'
|
||||
? 'StringTypeAnnotation'
|
||||
: typeAnnotation.type === 'EnumNumberBody'
|
||||
? 'NumberTypeAnnotation'
|
||||
: null;
|
||||
? 'NumberTypeAnnotation'
|
||||
: null;
|
||||
if (!enumMembersType) {
|
||||
throw new Error(
|
||||
`Unknown enum type annotation type. Got: ${typeAnnotation.type}. Expected: EnumStringBody or EnumNumberBody.`,
|
||||
@@ -242,14 +242,14 @@ class FlowParser implements Parser {
|
||||
value: member.init.value,
|
||||
}
|
||||
: typeof member.init?.value === 'string'
|
||||
? {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.init.value,
|
||||
}
|
||||
: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.id.name,
|
||||
};
|
||||
? {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.init.value,
|
||||
}
|
||||
: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.id.name,
|
||||
};
|
||||
|
||||
return {
|
||||
name: member.id.name,
|
||||
|
||||
+2
-2
@@ -353,8 +353,8 @@ function setDefaultValue(
|
||||
common.default = ((defaultValue === null
|
||||
? null
|
||||
: defaultValue
|
||||
? defaultValue
|
||||
: 0): number | null);
|
||||
? defaultValue
|
||||
: 0): number | null);
|
||||
break;
|
||||
case 'BooleanTypeAnnotation':
|
||||
common.default = defaultValue === null ? null : !!defaultValue;
|
||||
|
||||
+24
-24
@@ -192,10 +192,10 @@ describe('TypeScript Module Parser', () => {
|
||||
nullable && optional
|
||||
? 'a nullable and optional'
|
||||
: nullable
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
|
||||
function annotateArg(paramName: string, paramType: string) {
|
||||
if (nullable && optional) {
|
||||
@@ -243,10 +243,10 @@ describe('TypeScript Module Parser', () => {
|
||||
(nullable && optional
|
||||
? 'Nullable and Optional'
|
||||
: nullable
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Parameter',
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Parameter',
|
||||
() => {
|
||||
it(`should not parse methods that have ${PARAM_TYPE_DESCRIPTION} parameter of type 'Function'`, () => {
|
||||
expect(() => parseParamType('arg', 'Function')).toThrow(
|
||||
@@ -473,10 +473,10 @@ describe('TypeScript Module Parser', () => {
|
||||
isPropNullable && isPropOptional
|
||||
? 'a nullable and optional'
|
||||
: isPropNullable
|
||||
? 'a nullable'
|
||||
: isPropOptional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
? 'a nullable'
|
||||
: isPropOptional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
|
||||
function annotateProp(propName: string, propType: string) {
|
||||
if (isPropNullable && isPropOptional) {
|
||||
@@ -541,10 +541,10 @@ describe('TypeScript Module Parser', () => {
|
||||
(isPropNullable && isPropOptional
|
||||
? 'Nullable and Optional'
|
||||
: isPropNullable
|
||||
? 'Nullable'
|
||||
: isPropOptional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
? 'Nullable'
|
||||
: isPropOptional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
() => {
|
||||
describe('Props with Primitive Types', () => {
|
||||
PRIMITIVES.forEach(([FLOW_TYPE, PARSED_TYPE_NAME]) => {
|
||||
@@ -1007,10 +1007,10 @@ describe('TypeScript Module Parser', () => {
|
||||
nullable && optional
|
||||
? 'a nullable and optional'
|
||||
: nullable
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
? 'a nullable'
|
||||
: optional
|
||||
? 'an optional'
|
||||
: 'a required';
|
||||
|
||||
function annotateProp(propName: string, propType: string) {
|
||||
if (nullable && optional) {
|
||||
@@ -1076,10 +1076,10 @@ describe('TypeScript Module Parser', () => {
|
||||
(nullable && optional
|
||||
? 'Nullable and Optional'
|
||||
: nullable
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
? 'Nullable'
|
||||
: optional
|
||||
? 'Optional'
|
||||
: 'Required') + ' Property',
|
||||
() => {
|
||||
/**
|
||||
* TODO: Fill out props in promise
|
||||
|
||||
+15
-15
@@ -233,8 +233,8 @@ class TypeScriptParser implements Parser {
|
||||
enumMembersType === 'StringTypeAnnotation'
|
||||
? 'StringLiteral'
|
||||
: enumMembersType === 'NumberTypeAnnotation'
|
||||
? 'NumericLiteral'
|
||||
: null;
|
||||
? 'NumericLiteral'
|
||||
: null;
|
||||
|
||||
typeAnnotation.members.forEach(member => {
|
||||
const isNegative =
|
||||
@@ -263,19 +263,19 @@ class TypeScriptParser implements Parser {
|
||||
value: -1 * member.initializer?.argument?.value,
|
||||
}
|
||||
: typeof member.initializer?.value === 'number'
|
||||
? {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: member.initializer?.value,
|
||||
}
|
||||
: typeof member.initializer?.value === 'string'
|
||||
? {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.initializer?.value,
|
||||
}
|
||||
: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.id.name,
|
||||
};
|
||||
? {
|
||||
type: 'NumberLiteralTypeAnnotation',
|
||||
value: member.initializer?.value,
|
||||
}
|
||||
: typeof member.initializer?.value === 'string'
|
||||
? {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.initializer?.value,
|
||||
}
|
||||
: {
|
||||
type: 'StringLiteralTypeAnnotation',
|
||||
value: member.id.name,
|
||||
};
|
||||
|
||||
return {
|
||||
name: member.id.name,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/compatibility-check",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "Check a React Native app's boundary between JS and Native for incompatibilities",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
@@ -29,7 +29,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@react-native/codegen": "0.81.0-main"
|
||||
"@react-native/codegen": "0.82.0-main"
|
||||
},
|
||||
"devDependencies": {
|
||||
"flow-remove-types": "^2.237.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@react-native/popup-menu-android",
|
||||
"version": "0.81.0-main",
|
||||
"version": "0.82.0-main",
|
||||
"description": "PopupMenu for the Android platform",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@react-native/codegen": "0.81.0-main"
|
||||
"@react-native/codegen": "0.82.0-main"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^19.1.0",
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
require 'json'
|
||||
|
||||
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'OSSLibraryExample'
|
||||
s.version = package['version']
|
||||
s.summary = package['description']
|
||||
s.description = package['description']
|
||||
s.homepage = package['homepage']
|
||||
s.license = package['license']
|
||||
s.platforms = min_supported_versions
|
||||
s.author = 'Meta Platforms, Inc. and its affiliates'
|
||||
s.source = { :git => package['repository']['url'], :tag => "#{s.version}" }
|
||||
|
||||
s.source_files = 'ios/**/*.{h,m,mm,cpp}'
|
||||
|
||||
install_modules_dependencies(s)
|
||||
end
|
||||
@@ -1,9 +0,0 @@
|
||||
## Important
|
||||
This package is for testing only. It is a subject to frequent change. It does not represent the recomended structure for React native libraries. It should not be used as a referece for such purposes.
|
||||
|
||||
## Building
|
||||
```
|
||||
yarn install
|
||||
yarn build
|
||||
npx react-native codegen
|
||||
```
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id("com.facebook.react")
|
||||
alias(libs.plugins.android.library)
|
||||
alias(libs.plugins.kotlin.android)
|
||||
}
|
||||
|
||||
android {
|
||||
compileSdk = libs.versions.compileSdk.get().toInt()
|
||||
buildToolsVersion = libs.versions.buildTools.get()
|
||||
namespace = "com.facebook.react.osslibraryexample"
|
||||
|
||||
defaultConfig { minSdk = libs.versions.minSdk.get().toInt() }
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions { jvmTarget = "17" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Build React Native from source
|
||||
implementation(project(":packages:react-native:ReactAndroid"))
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
# We want to have more fine grained control on the Java version for
|
||||
# ReactAndroid, therefore we disable RGNP Java version alignment mechanism
|
||||
react.internal.disableJavaVersionAlignment=true
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleJavaSpec.js
|
||||
*
|
||||
* @nolint
|
||||
*/
|
||||
|
||||
package com.facebook.fbreact.specs;
|
||||
|
||||
import com.facebook.proguard.annotations.DoNotStrip;
|
||||
import com.facebook.react.bridge.ReactApplicationContext;
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
||||
import com.facebook.react.bridge.ReactMethod;
|
||||
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class NativeSampleModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
|
||||
public static final String NAME = "NativeSampleModule";
|
||||
|
||||
public NativeSampleModuleSpec(ReactApplicationContext reactContext) {
|
||||
super(reactContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nonnull String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@ReactMethod(isBlockingSynchronousMethod = true)
|
||||
@DoNotStrip
|
||||
public abstract double getRandomNumber();
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.osslibraryexample
|
||||
|
||||
import com.facebook.fbreact.specs.NativeSampleModuleSpec
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
||||
import com.facebook.react.bridge.ReactMethod
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
|
||||
@ReactModule(name = NativeSampleModuleSpec.NAME)
|
||||
public class NativeSampleModule(reactContext: ReactApplicationContext?) :
|
||||
ReactContextBaseJavaModule(reactContext) {
|
||||
|
||||
override fun getName(): String = NAME
|
||||
|
||||
private companion object {
|
||||
const val NAME = "NativeSampleModule"
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public fun getRandomNumber(): Int {
|
||||
return (0..99).random()
|
||||
}
|
||||
}
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.osslibraryexample
|
||||
|
||||
import com.facebook.react.ReactPackage
|
||||
import com.facebook.react.bridge.NativeModule
|
||||
import com.facebook.react.bridge.ReactApplicationContext
|
||||
import com.facebook.react.uimanager.ViewManager
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
public class OSSLibraryExamplePackage : ReactPackage {
|
||||
@Deprecated("Migrate to [BaseReactPackage] and implement [getModule] instead.")
|
||||
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> =
|
||||
listOf(NativeSampleModule(reactContext))
|
||||
|
||||
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> =
|
||||
listOf(SampleNativeComponentViewManager())
|
||||
}
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.osslibraryexample
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.graphics.Color
|
||||
import com.facebook.react.bridge.ReadableArray
|
||||
import com.facebook.react.module.annotations.ReactModule
|
||||
import com.facebook.react.uimanager.SimpleViewManager
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.ViewProps
|
||||
import com.facebook.react.uimanager.annotations.ReactProp
|
||||
import com.facebook.react.viewmanagers.SampleNativeComponentManagerInterface
|
||||
|
||||
/** Legacy View manager (non Fabric compatible) for {@link SampleNativeView} components. */
|
||||
@ReactModule(name = SampleNativeComponentViewManager.REACT_CLASS)
|
||||
internal class SampleNativeComponentViewManager :
|
||||
SimpleViewManager<SampleNativeView>(), SampleNativeComponentManagerInterface<SampleNativeView> {
|
||||
|
||||
override fun getName(): String = REACT_CLASS
|
||||
|
||||
// @ReactProp(name = ViewProps.OPACITY, defaultFloat = 1f)
|
||||
override fun setOpacity(view: SampleNativeView, opacity: Float) {
|
||||
super.setOpacity(view, opacity)
|
||||
}
|
||||
|
||||
@SuppressLint("BadMethodUse-android.view.View.setBackgroundColor")
|
||||
@ReactProp(name = ViewProps.COLOR)
|
||||
fun setColor(view: SampleNativeView, color: String) {
|
||||
view.setBackgroundColor(Color.parseColor(color))
|
||||
}
|
||||
|
||||
@ReactProp(name = "cornerRadius")
|
||||
fun setCornerRadius(view: SampleNativeView, cornerRadius: Float) {
|
||||
view.setCornerRadius(cornerRadius)
|
||||
}
|
||||
|
||||
override fun createViewInstance(reactContext: ThemedReactContext): SampleNativeView =
|
||||
SampleNativeView(reactContext)
|
||||
|
||||
@SuppressLint("BadMethodUse-android.view.View.setBackgroundColor")
|
||||
override fun changeBackgroundColor(view: SampleNativeView, color: String) {
|
||||
view.setBackgroundColor(Color.parseColor(color))
|
||||
}
|
||||
|
||||
override fun getExportedViewConstants(): Map<String, Any> = mapOf("PI" to 3.14)
|
||||
|
||||
override fun getExportedCustomBubblingEventTypeConstants(): Map<String, Any> {
|
||||
return mapOf(
|
||||
"onColorChanged" to
|
||||
mapOf(
|
||||
"phasedRegistrationNames" to
|
||||
mapOf(
|
||||
"bubbled" to "onColorChanged",
|
||||
"captured" to "onColorChangedCapture",
|
||||
)),
|
||||
"topIntArrayChanged" to
|
||||
mapOf(
|
||||
"phasedRegistrationNames" to
|
||||
mapOf(
|
||||
"bubbled" to "topIntArrayChanged",
|
||||
"captured" to "topIntArrayChangedCapture",
|
||||
)))
|
||||
}
|
||||
|
||||
@SuppressLint("BadMethodUse-android.view.View.setBackgroundColor")
|
||||
override fun receiveCommand(view: SampleNativeView, commandId: String, args: ReadableArray?) {
|
||||
if (commandId.contentEquals("changeBackgroundColor")) {
|
||||
val sentColor: Int = Color.parseColor(args?.getString(0))
|
||||
view.setBackgroundColor(sentColor)
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
@SuppressLint("BadMethodUse-android.view.View.setBackgroundColor")
|
||||
@Suppress("DEPRECATION") // We intentionally want to test against the legacy API here.
|
||||
override fun receiveCommand(view: SampleNativeView, commandId: Int, args: ReadableArray?) {
|
||||
when (commandId) {
|
||||
COMMAND_CHANGE_BACKGROUND_COLOR -> {
|
||||
val sentColor: Int = Color.parseColor(args?.getString(0))
|
||||
view.setBackgroundColor(sentColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getCommandsMap(): Map<String, Int> =
|
||||
mapOf("changeBackgroundColor" to COMMAND_CHANGE_BACKGROUND_COLOR)
|
||||
|
||||
companion object {
|
||||
const val REACT_CLASS = "SampleNativeComponent"
|
||||
const val COMMAND_CHANGE_BACKGROUND_COLOR = 42
|
||||
}
|
||||
|
||||
@ReactProp(name = "values")
|
||||
override fun setValues(view: SampleNativeView, value: ReadableArray?) {
|
||||
val values = mutableListOf<Int>()
|
||||
value?.toArrayList()?.forEach { values.add((it as Double).toInt()) }
|
||||
view.emitOnArrayChangedEvent(values)
|
||||
}
|
||||
}
|
||||
-97
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.osslibraryexample
|
||||
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.view.View
|
||||
import com.facebook.react.bridge.Arguments
|
||||
import com.facebook.react.bridge.ReactContext
|
||||
import com.facebook.react.bridge.WritableArray
|
||||
import com.facebook.react.bridge.WritableMap
|
||||
import com.facebook.react.uimanager.ThemedReactContext
|
||||
import com.facebook.react.uimanager.UIManagerHelper
|
||||
import com.facebook.react.uimanager.events.Event
|
||||
|
||||
public class SampleNativeView(context: ThemedReactContext) : View(context) {
|
||||
private var currentColor = 0
|
||||
private var background: GradientDrawable = GradientDrawable()
|
||||
private val reactContext: ReactContext = context.reactApplicationContext
|
||||
|
||||
override fun setBackgroundColor(color: Int) {
|
||||
if (color != currentColor) {
|
||||
background.setColor(color)
|
||||
currentColor = color
|
||||
setBackground(background)
|
||||
}
|
||||
}
|
||||
|
||||
public fun setCornerRadius(cornerRadius: Float) {
|
||||
background.cornerRadius = cornerRadius
|
||||
setBackground(background)
|
||||
}
|
||||
|
||||
public fun emitOnArrayChangedEvent(ints: List<Int>) {
|
||||
val newIntArray = Arguments.createArray()
|
||||
val newBoolArray = Arguments.createArray()
|
||||
val newFloatArray = Arguments.createArray()
|
||||
val newDoubleArray = Arguments.createArray()
|
||||
val newYesNoArray = Arguments.createArray()
|
||||
val newStringArray = Arguments.createArray()
|
||||
val newObjectArray = Arguments.createArray()
|
||||
val newArrayArray = Arguments.createArray()
|
||||
|
||||
for (i in ints) {
|
||||
newIntArray.pushInt(i * 2)
|
||||
newBoolArray.pushBoolean(i % 2 == 1)
|
||||
newFloatArray.pushDouble(i * 3.14)
|
||||
newDoubleArray.pushDouble(i / 3.14)
|
||||
newYesNoArray.pushString(if (i % 2 == 1) "yep" else "nope")
|
||||
newStringArray.pushString(i.toString())
|
||||
|
||||
val latLon = Arguments.createMap()
|
||||
latLon.putDouble("lat", -1.0 * i)
|
||||
latLon.putDouble("lon", 2.0 * i)
|
||||
newObjectArray.pushMap(latLon)
|
||||
|
||||
val innerArray: WritableArray = Arguments.createArray()
|
||||
innerArray.pushInt(i)
|
||||
innerArray.pushInt(i)
|
||||
innerArray.pushInt(i)
|
||||
newArrayArray.pushArray(innerArray)
|
||||
}
|
||||
|
||||
val payload =
|
||||
Arguments.createMap().apply {
|
||||
putArray("values", newIntArray)
|
||||
putArray("boolValues", newBoolArray)
|
||||
putArray("floats", newFloatArray)
|
||||
putArray("doubles", newDoubleArray)
|
||||
putArray("yesNos", newYesNoArray)
|
||||
putArray("strings", newStringArray)
|
||||
putArray("latLons", newObjectArray)
|
||||
putArray("multiArrays", newArrayArray)
|
||||
}
|
||||
|
||||
val reactContext = context as ReactContext
|
||||
val surfaceId = UIManagerHelper.getSurfaceId(reactContext)
|
||||
val eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(reactContext, id)
|
||||
val event = OnIntArrayChangedEvent(surfaceId, id, payload)
|
||||
|
||||
eventDispatcher?.dispatchEvent(event)
|
||||
}
|
||||
|
||||
private inner class OnIntArrayChangedEvent(
|
||||
surfaceId: Int,
|
||||
viewId: Int,
|
||||
private val payload: WritableMap
|
||||
) : Event<OnIntArrayChangedEvent>(surfaceId, viewId) {
|
||||
override fun getEventName() = "topIntArrayChanged"
|
||||
|
||||
override fun getEventData() = payload
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
||||
*/
|
||||
|
||||
package com.facebook.react.viewmanagers;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
||||
import com.facebook.react.uimanager.BaseViewManager;
|
||||
import com.facebook.react.uimanager.LayoutShadowNode;
|
||||
|
||||
public class SampleNativeComponentManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & SampleNativeComponentManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
||||
public SampleNativeComponentManagerDelegate(U viewManager) {
|
||||
super(viewManager);
|
||||
}
|
||||
@Override
|
||||
public void setProperty(T view, String propName, @Nullable Object value) {
|
||||
switch (propName) {
|
||||
case "opacity":
|
||||
mViewManager.setOpacity(view, value == null ? 0f : ((Double) value).floatValue());
|
||||
break;
|
||||
case "values":
|
||||
mViewManager.setValues(view, (ReadableArray) value);
|
||||
break;
|
||||
default:
|
||||
super.setProperty(view, propName, value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveCommand(T view, String commandName, @Nullable ReadableArray args) {
|
||||
switch (commandName) {
|
||||
case "changeBackgroundColor":
|
||||
mViewManager.changeBackgroundColor(view, args.getString(0));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
-21
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GeneratePropsJavaInterface.js
|
||||
*/
|
||||
|
||||
package com.facebook.react.viewmanagers;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.bridge.ReadableArray;
|
||||
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
||||
|
||||
public interface SampleNativeComponentManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
||||
void setOpacity(T view, float value);
|
||||
void setValues(T view, @Nullable ReadableArray value);
|
||||
void changeBackgroundColor(T view, String color);
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
#
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
set(CMAKE_VERBOSE_MAKEFILE on)
|
||||
|
||||
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/OSSLibraryExampleSpec/*.cpp)
|
||||
|
||||
add_library(
|
||||
react_codegen_OSSLibraryExampleSpec
|
||||
OBJECT
|
||||
${react_codegen_SRCS}
|
||||
)
|
||||
|
||||
target_include_directories(react_codegen_OSSLibraryExampleSpec PUBLIC . react/renderer/components/OSSLibraryExampleSpec)
|
||||
|
||||
target_link_libraries(
|
||||
react_codegen_OSSLibraryExampleSpec
|
||||
fbjni
|
||||
jsi
|
||||
reactnative
|
||||
)
|
||||
|
||||
target_compile_reactnative_options(react_codegen_OSSLibraryExampleSpec PRIVATE)
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleJniCpp.js
|
||||
*/
|
||||
|
||||
#include "OSSLibraryExampleSpec.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static facebook::jsi::Value __hostFunction_NativeSampleModuleSpecJSI_getRandomNumber(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
||||
static jmethodID cachedMethodId = nullptr;
|
||||
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, NumberKind, "getRandomNumber", "()D", args, count, cachedMethodId);
|
||||
}
|
||||
|
||||
NativeSampleModuleSpecJSI::NativeSampleModuleSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
||||
: JavaTurboModule(params) {
|
||||
methodMap_["getRandomNumber"] = MethodMetadata {0, __hostFunction_NativeSampleModuleSpecJSI_getRandomNumber};
|
||||
}
|
||||
|
||||
std::shared_ptr<TurboModule> OSSLibraryExampleSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
||||
if (moduleName == "NativeSampleModule") {
|
||||
return std::make_shared<NativeSampleModuleSpecJSI>(params);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleJniH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/JavaTurboModule.h>
|
||||
#include <ReactCommon/TurboModule.h>
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
/**
|
||||
* JNI C++ class for module 'NativeSampleModule'
|
||||
*/
|
||||
class JSI_EXPORT NativeSampleModuleSpecJSI : public JavaTurboModule {
|
||||
public:
|
||||
NativeSampleModuleSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
||||
};
|
||||
|
||||
|
||||
JSI_EXPORT
|
||||
std::shared_ptr<TurboModule> OSSLibraryExampleSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
||||
|
||||
} // namespace facebook::react
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
||||
*/
|
||||
|
||||
#include "ComponentDescriptors.h"
|
||||
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
void OSSLibraryExampleSpec_registerComponentDescriptorsFromCodegen(
|
||||
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
||||
registry->add(concreteComponentDescriptorProvider<SampleNativeComponentComponentDescriptor>());
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateComponentDescriptorH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ShadowNodes.h"
|
||||
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
using SampleNativeComponentComponentDescriptor = ConcreteComponentDescriptor<SampleNativeComponentShadowNode>;
|
||||
|
||||
void OSSLibraryExampleSpec_registerComponentDescriptorsFromCodegen(
|
||||
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
||||
|
||||
} // namespace facebook::react
|
||||
-95
@@ -1,95 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateEventEmitterCpp.js
|
||||
*/
|
||||
|
||||
#include "EventEmitters.h"
|
||||
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
void SampleNativeComponentEventEmitter::onIntArrayChanged(OnIntArrayChanged $event) const {
|
||||
dispatchEvent("intArrayChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
||||
auto $payload = jsi::Object(runtime);
|
||||
|
||||
auto values = jsi::Array(runtime, $event.values.size());
|
||||
size_t valuesIndex = 0;
|
||||
for (auto valuesValue : $event.values) {
|
||||
values.setValueAtIndex(runtime, valuesIndex++, valuesValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "values", values);
|
||||
|
||||
|
||||
auto boolValues = jsi::Array(runtime, $event.boolValues.size());
|
||||
size_t boolValuesIndex = 0;
|
||||
for (auto boolValuesValue : $event.boolValues) {
|
||||
boolValues.setValueAtIndex(runtime, boolValuesIndex++, (bool)boolValuesValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "boolValues", boolValues);
|
||||
|
||||
|
||||
auto floats = jsi::Array(runtime, $event.floats.size());
|
||||
size_t floatsIndex = 0;
|
||||
for (auto floatsValue : $event.floats) {
|
||||
floats.setValueAtIndex(runtime, floatsIndex++, floatsValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "floats", floats);
|
||||
|
||||
|
||||
auto doubles = jsi::Array(runtime, $event.doubles.size());
|
||||
size_t doublesIndex = 0;
|
||||
for (auto doublesValue : $event.doubles) {
|
||||
doubles.setValueAtIndex(runtime, doublesIndex++, doublesValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "doubles", doubles);
|
||||
|
||||
|
||||
auto yesNos = jsi::Array(runtime, $event.yesNos.size());
|
||||
size_t yesNosIndex = 0;
|
||||
for (auto yesNosValue : $event.yesNos) {
|
||||
yesNos.setValueAtIndex(runtime, yesNosIndex++, toString(yesNosValue));
|
||||
}
|
||||
$payload.setProperty(runtime, "yesNos", yesNos);
|
||||
|
||||
|
||||
auto strings = jsi::Array(runtime, $event.strings.size());
|
||||
size_t stringsIndex = 0;
|
||||
for (auto stringsValue : $event.strings) {
|
||||
strings.setValueAtIndex(runtime, stringsIndex++, stringsValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "strings", strings);
|
||||
|
||||
|
||||
auto latLons = jsi::Array(runtime, $event.latLons.size());
|
||||
size_t latLonsIndex = 0;
|
||||
for (auto latLonsValue : $event.latLons) {
|
||||
auto latLonsObject = jsi::Object(runtime);
|
||||
latLonsObject.setProperty(runtime, "lat", latLonsValue.lat);
|
||||
latLonsObject.setProperty(runtime, "lon", latLonsValue.lon);
|
||||
latLons.setValueAtIndex(runtime, latLonsIndex++, latLonsObject);
|
||||
}
|
||||
$payload.setProperty(runtime, "latLons", latLons);
|
||||
|
||||
|
||||
auto multiArrays = jsi::Array(runtime, $event.multiArrays.size());
|
||||
size_t multiArraysIndex = 0;
|
||||
for (auto multiArraysValue : $event.multiArrays) {
|
||||
auto multiArraysArray = jsi::Array(runtime, multiArraysValue.size());
|
||||
size_t multiArraysIndexInternal = 0;
|
||||
for (auto multiArraysValueInternal : multiArraysValue) {
|
||||
multiArraysArray.setValueAtIndex(runtime, multiArraysIndexInternal++, multiArraysValueInternal);
|
||||
}
|
||||
multiArrays.setValueAtIndex(runtime, multiArraysIndex++, multiArraysArray);
|
||||
}
|
||||
$payload.setProperty(runtime, "multiArrays", multiArrays);
|
||||
|
||||
return $payload;
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateEventEmitterH.js
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/components/view/ViewEventEmitter.h>
|
||||
|
||||
|
||||
namespace facebook::react {
|
||||
class SampleNativeComponentEventEmitter : public ViewEventEmitter {
|
||||
public:
|
||||
using ViewEventEmitter::ViewEventEmitter;
|
||||
|
||||
enum class OnIntArrayChangedYesNos {
|
||||
Yep,
|
||||
Nope
|
||||
};
|
||||
|
||||
static char const *toString(const OnIntArrayChangedYesNos value) {
|
||||
switch (value) {
|
||||
case OnIntArrayChangedYesNos::Yep: return "yep";
|
||||
case OnIntArrayChangedYesNos::Nope: return "nope";
|
||||
}
|
||||
}
|
||||
|
||||
struct OnIntArrayChangedLatLons {
|
||||
double lat;
|
||||
double lon;
|
||||
};
|
||||
|
||||
struct OnIntArrayChanged {
|
||||
std::vector<int> values;
|
||||
std::vector<bool> boolValues;
|
||||
std::vector<Float> floats;
|
||||
std::vector<double> doubles;
|
||||
std::vector<OnIntArrayChangedYesNos> yesNos;
|
||||
std::vector<std::string> strings;
|
||||
std::vector<OnIntArrayChangedLatLons> latLons;
|
||||
std::vector<std::vector<int>> multiArrays;
|
||||
};
|
||||
void onIntArrayChanged(OnIntArrayChanged value) const;
|
||||
};
|
||||
} // namespace facebook::react
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include "OSSLibraryExampleSpecJSI.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleModuleCxxSpecJSI_getRandomNumber(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleModuleCxxSpecJSI *>(&turboModule)->getRandomNumber(
|
||||
rt
|
||||
);
|
||||
}
|
||||
|
||||
NativeSampleModuleCxxSpecJSI::NativeSampleModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule("NativeSampleModule", jsInvoker) {
|
||||
methodMap_["getRandomNumber"] = MethodMetadata {0, __hostFunction_NativeSampleModuleCxxSpecJSI_getRandomNumber};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
-67
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/TurboModule.h>
|
||||
#include <react/bridging/Bridging.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
class JSI_EXPORT NativeSampleModuleCxxSpecJSI : public TurboModule {
|
||||
protected:
|
||||
NativeSampleModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
||||
|
||||
public:
|
||||
virtual double getRandomNumber(jsi::Runtime &rt) = 0;
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class JSI_EXPORT NativeSampleModuleCxxSpec : public TurboModule {
|
||||
public:
|
||||
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
||||
return delegate_.create(rt, propName);
|
||||
}
|
||||
|
||||
static constexpr std::string_view kModuleName = "NativeSampleModule";
|
||||
|
||||
protected:
|
||||
NativeSampleModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(std::string{NativeSampleModuleCxxSpec::kModuleName}, jsInvoker),
|
||||
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
||||
|
||||
|
||||
private:
|
||||
class Delegate : public NativeSampleModuleCxxSpecJSI {
|
||||
public:
|
||||
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
||||
NativeSampleModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
||||
|
||||
}
|
||||
|
||||
double getRandomNumber(jsi::Runtime &rt) override {
|
||||
static_assert(
|
||||
bridging::getParameterCount(&T::getRandomNumber) == 1,
|
||||
"Expected getRandomNumber(...) to have 1 parameters");
|
||||
|
||||
return bridging::callFromJs<double>(
|
||||
rt, &T::getRandomNumber, jsInvoker_, instance_);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class NativeSampleModuleCxxSpec;
|
||||
T *instance_;
|
||||
};
|
||||
|
||||
Delegate delegate_;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GeneratePropsCpp.js
|
||||
*/
|
||||
|
||||
#include "Props.h"
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/propsConversions.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
SampleNativeComponentProps::SampleNativeComponentProps(
|
||||
const PropsParserContext &context,
|
||||
const SampleNativeComponentProps &sourceProps,
|
||||
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
||||
|
||||
opacity(convertRawProp(context, rawProps, "opacity", sourceProps.opacity, {0.0})),
|
||||
values(convertRawProp(context, rawProps, "values", sourceProps.values, {}))
|
||||
{}
|
||||
|
||||
} // namespace facebook::react
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GeneratePropsH.js
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <vector>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class SampleNativeComponentProps final : public ViewProps {
|
||||
public:
|
||||
SampleNativeComponentProps() = default;
|
||||
SampleNativeComponentProps(const PropsParserContext& context, const SampleNativeComponentProps &sourceProps, const RawProps &rawProps);
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
Float opacity{0.0};
|
||||
std::vector<int> values{};
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateShadowNodeCpp.js
|
||||
*/
|
||||
|
||||
#include "ShadowNodes.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
extern const char SampleNativeComponentComponentName[] = "SampleNativeComponent";
|
||||
|
||||
} // namespace facebook::react
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateShadowNodeH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "EventEmitters.h"
|
||||
#include "Props.h"
|
||||
#include "States.h"
|
||||
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
JSI_EXPORT extern const char SampleNativeComponentComponentName[];
|
||||
|
||||
/*
|
||||
* `ShadowNode` for <SampleNativeComponent> component.
|
||||
*/
|
||||
using SampleNativeComponentShadowNode = ConcreteViewShadowNode<
|
||||
SampleNativeComponentComponentName,
|
||||
SampleNativeComponentProps,
|
||||
SampleNativeComponentEventEmitter,
|
||||
SampleNativeComponentState>;
|
||||
|
||||
} // namespace facebook::react
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateStateCpp.js
|
||||
*/
|
||||
#include "States.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateStateH.js
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class SampleNativeComponentState {
|
||||
public:
|
||||
SampleNativeComponentState() = default;
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
SampleNativeComponentState(SampleNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,18 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @noflow
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: [
|
||||
[
|
||||
'module:@react-native/babel-preset',
|
||||
{disableStaticViewConfigsCodegen: false},
|
||||
],
|
||||
],
|
||||
};
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @format
|
||||
*/
|
||||
|
||||
export {default as SampleNativeComponent} from './src/SampleNativeComponent';
|
||||
export type {NativeComponentType} from './src/SampleNativeComponent';
|
||||
import {Commands as SampleNativeComponentCommands} from './src/SampleNativeComponent';
|
||||
|
||||
export {SampleNativeComponentCommands};
|
||||
export {default as NativeSampleModule} from './src/NativeSampleModule';
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateComponentDescriptorCpp.js
|
||||
*/
|
||||
|
||||
#include "ComponentDescriptors.h"
|
||||
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
void OSSLibraryExampleSpec_registerComponentDescriptorsFromCodegen(
|
||||
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
||||
registry->add(concreteComponentDescriptorProvider<SampleNativeComponentComponentDescriptor>());
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,24 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateComponentDescriptorH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ShadowNodes.h"
|
||||
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
||||
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
using SampleNativeComponentComponentDescriptor = ConcreteComponentDescriptor<SampleNativeComponentShadowNode>;
|
||||
|
||||
void OSSLibraryExampleSpec_registerComponentDescriptorsFromCodegen(
|
||||
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,95 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateEventEmitterCpp.js
|
||||
*/
|
||||
|
||||
#include "EventEmitters.h"
|
||||
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
void SampleNativeComponentEventEmitter::onIntArrayChanged(OnIntArrayChanged $event) const {
|
||||
dispatchEvent("intArrayChanged", [$event=std::move($event)](jsi::Runtime &runtime) {
|
||||
auto $payload = jsi::Object(runtime);
|
||||
|
||||
auto values = jsi::Array(runtime, $event.values.size());
|
||||
size_t valuesIndex = 0;
|
||||
for (auto valuesValue : $event.values) {
|
||||
values.setValueAtIndex(runtime, valuesIndex++, valuesValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "values", values);
|
||||
|
||||
|
||||
auto boolValues = jsi::Array(runtime, $event.boolValues.size());
|
||||
size_t boolValuesIndex = 0;
|
||||
for (auto boolValuesValue : $event.boolValues) {
|
||||
boolValues.setValueAtIndex(runtime, boolValuesIndex++, (bool)boolValuesValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "boolValues", boolValues);
|
||||
|
||||
|
||||
auto floats = jsi::Array(runtime, $event.floats.size());
|
||||
size_t floatsIndex = 0;
|
||||
for (auto floatsValue : $event.floats) {
|
||||
floats.setValueAtIndex(runtime, floatsIndex++, floatsValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "floats", floats);
|
||||
|
||||
|
||||
auto doubles = jsi::Array(runtime, $event.doubles.size());
|
||||
size_t doublesIndex = 0;
|
||||
for (auto doublesValue : $event.doubles) {
|
||||
doubles.setValueAtIndex(runtime, doublesIndex++, doublesValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "doubles", doubles);
|
||||
|
||||
|
||||
auto yesNos = jsi::Array(runtime, $event.yesNos.size());
|
||||
size_t yesNosIndex = 0;
|
||||
for (auto yesNosValue : $event.yesNos) {
|
||||
yesNos.setValueAtIndex(runtime, yesNosIndex++, toString(yesNosValue));
|
||||
}
|
||||
$payload.setProperty(runtime, "yesNos", yesNos);
|
||||
|
||||
|
||||
auto strings = jsi::Array(runtime, $event.strings.size());
|
||||
size_t stringsIndex = 0;
|
||||
for (auto stringsValue : $event.strings) {
|
||||
strings.setValueAtIndex(runtime, stringsIndex++, stringsValue);
|
||||
}
|
||||
$payload.setProperty(runtime, "strings", strings);
|
||||
|
||||
|
||||
auto latLons = jsi::Array(runtime, $event.latLons.size());
|
||||
size_t latLonsIndex = 0;
|
||||
for (auto latLonsValue : $event.latLons) {
|
||||
auto latLonsObject = jsi::Object(runtime);
|
||||
latLonsObject.setProperty(runtime, "lat", latLonsValue.lat);
|
||||
latLonsObject.setProperty(runtime, "lon", latLonsValue.lon);
|
||||
latLons.setValueAtIndex(runtime, latLonsIndex++, latLonsObject);
|
||||
}
|
||||
$payload.setProperty(runtime, "latLons", latLons);
|
||||
|
||||
|
||||
auto multiArrays = jsi::Array(runtime, $event.multiArrays.size());
|
||||
size_t multiArraysIndex = 0;
|
||||
for (auto multiArraysValue : $event.multiArrays) {
|
||||
auto multiArraysArray = jsi::Array(runtime, multiArraysValue.size());
|
||||
size_t multiArraysIndexInternal = 0;
|
||||
for (auto multiArraysValueInternal : multiArraysValue) {
|
||||
multiArraysArray.setValueAtIndex(runtime, multiArraysIndexInternal++, multiArraysValueInternal);
|
||||
}
|
||||
multiArrays.setValueAtIndex(runtime, multiArraysIndex++, multiArraysArray);
|
||||
}
|
||||
$payload.setProperty(runtime, "multiArrays", multiArrays);
|
||||
|
||||
return $payload;
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,49 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateEventEmitterH.js
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/components/view/ViewEventEmitter.h>
|
||||
|
||||
|
||||
namespace facebook::react {
|
||||
class SampleNativeComponentEventEmitter : public ViewEventEmitter {
|
||||
public:
|
||||
using ViewEventEmitter::ViewEventEmitter;
|
||||
|
||||
enum class OnIntArrayChangedYesNos {
|
||||
Yep,
|
||||
Nope
|
||||
};
|
||||
|
||||
static char const *toString(const OnIntArrayChangedYesNos value) {
|
||||
switch (value) {
|
||||
case OnIntArrayChangedYesNos::Yep: return "yep";
|
||||
case OnIntArrayChangedYesNos::Nope: return "nope";
|
||||
}
|
||||
}
|
||||
|
||||
struct OnIntArrayChangedLatLons {
|
||||
double lat;
|
||||
double lon;
|
||||
};
|
||||
|
||||
struct OnIntArrayChanged {
|
||||
std::vector<int> values;
|
||||
std::vector<bool> boolValues;
|
||||
std::vector<Float> floats;
|
||||
std::vector<double> doubles;
|
||||
std::vector<OnIntArrayChangedYesNos> yesNos;
|
||||
std::vector<std::string> strings;
|
||||
std::vector<OnIntArrayChangedLatLons> latLons;
|
||||
std::vector<std::vector<int>> multiArrays;
|
||||
};
|
||||
void onIntArrayChanged(OnIntArrayChanged value) const;
|
||||
};
|
||||
} // namespace facebook::react
|
||||
-29
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleObjCpp
|
||||
*
|
||||
* We create an umbrella header (and corresponding implementation) here since
|
||||
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
||||
* must have a single output. More files => more genrule()s => slower builds.
|
||||
*/
|
||||
|
||||
#import "OSSLibraryExampleSpec.h"
|
||||
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static facebook::jsi::Value __hostFunction_NativeSampleModuleSpecJSI_getRandomNumber(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
||||
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, NumberKind, "getRandomNumber", @selector(getRandomNumber), args, count);
|
||||
}
|
||||
|
||||
NativeSampleModuleSpecJSI::NativeSampleModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms)
|
||||
: ObjCTurboModule(params) {
|
||||
|
||||
methodMap_["getRandomNumber"] = MethodMetadata {0, __hostFunction_NativeSampleModuleSpecJSI_getRandomNumber};
|
||||
|
||||
}
|
||||
} // namespace facebook::react
|
||||
@@ -1,49 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleObjCpp
|
||||
*
|
||||
* We create an umbrella header (and corresponding implementation) here since
|
||||
* Cxx compilation in BUCK has a limitation: source-code producing genrule()s
|
||||
* must have a single output. More files => more genrule()s => slower builds.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm.
|
||||
#endif
|
||||
|
||||
// Avoid multiple includes of OSSLibraryExampleSpec symbols
|
||||
#ifndef OSSLibraryExampleSpec_H
|
||||
#define OSSLibraryExampleSpec_H
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <RCTRequired/RCTRequired.h>
|
||||
#import <RCTTypeSafety/RCTConvertHelpers.h>
|
||||
#import <RCTTypeSafety/RCTTypedModuleConstants.h>
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <React/RCTCxxConvert.h>
|
||||
#import <React/RCTManagedPointer.h>
|
||||
#import <ReactCommon/RCTTurboModule.h>
|
||||
#import <optional>
|
||||
#import <vector>
|
||||
|
||||
|
||||
@protocol NativeSampleModuleSpec <RCTBridgeModule, RCTTurboModule>
|
||||
|
||||
- (NSNumber *)getRandomNumber;
|
||||
|
||||
@end
|
||||
namespace facebook::react {
|
||||
/**
|
||||
* ObjC++ class for module 'NativeSampleModule'
|
||||
*/
|
||||
class JSI_EXPORT NativeSampleModuleSpecJSI : public ObjCTurboModule {
|
||||
public:
|
||||
NativeSampleModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms);
|
||||
};
|
||||
} // namespace facebook::react
|
||||
|
||||
#endif // OSSLibraryExampleSpec_H
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GeneratePropsCpp.js
|
||||
*/
|
||||
|
||||
#include "Props.h"
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <react/renderer/core/propsConversions.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
SampleNativeComponentProps::SampleNativeComponentProps(
|
||||
const PropsParserContext &context,
|
||||
const SampleNativeComponentProps &sourceProps,
|
||||
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
||||
|
||||
opacity(convertRawProp(context, rawProps, "opacity", sourceProps.opacity, {0.0})),
|
||||
values(convertRawProp(context, rawProps, "values", sourceProps.values, {}))
|
||||
{}
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,29 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GeneratePropsH.js
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <react/renderer/components/view/ViewProps.h>
|
||||
#include <react/renderer/core/PropsParserContext.h>
|
||||
#include <vector>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class SampleNativeComponentProps final : public ViewProps {
|
||||
public:
|
||||
SampleNativeComponentProps() = default;
|
||||
SampleNativeComponentProps(const PropsParserContext& context, const SampleNativeComponentProps &sourceProps, const RawProps &rawProps);
|
||||
|
||||
#pragma mark - Props
|
||||
|
||||
Float opacity{0.0};
|
||||
std::vector<int> values{};
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
-50
@@ -1,50 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateComponentHObjCpp.js
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <React/RCTDefines.h>
|
||||
#import <React/RCTLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol RCTSampleNativeComponentViewProtocol <NSObject>
|
||||
- (void)changeBackgroundColor:(NSString *)color;
|
||||
@end
|
||||
|
||||
RCT_EXTERN inline void RCTSampleNativeComponentHandleCommand(
|
||||
id<RCTSampleNativeComponentViewProtocol> componentView,
|
||||
NSString const *commandName,
|
||||
NSArray const *args)
|
||||
{
|
||||
if ([commandName isEqualToString:@"changeBackgroundColor"]) {
|
||||
#if RCT_DEBUG
|
||||
if ([args count] != 1) {
|
||||
RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"SampleNativeComponent", commandName, (int)[args count], 1);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
NSObject *arg0 = args[0];
|
||||
#if RCT_DEBUG
|
||||
if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSString class], @"string", @"SampleNativeComponent", commandName, @"1st")) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
NSString * color = (NSString *)arg0;
|
||||
|
||||
[componentView changeBackgroundColor:color];
|
||||
return;
|
||||
}
|
||||
|
||||
#if RCT_DEBUG
|
||||
RCTLogError(@"%@ received command %@, which is not a supported command.", @"SampleNativeComponent", commandName);
|
||||
#endif
|
||||
}
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateShadowNodeCpp.js
|
||||
*/
|
||||
|
||||
#include "ShadowNodes.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
extern const char SampleNativeComponentComponentName[] = "SampleNativeComponent";
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateShadowNodeH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "EventEmitters.h"
|
||||
#include "Props.h"
|
||||
#include "States.h"
|
||||
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
||||
#include <jsi/jsi.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
JSI_EXPORT extern const char SampleNativeComponentComponentName[];
|
||||
|
||||
/*
|
||||
* `ShadowNode` for <SampleNativeComponent> component.
|
||||
*/
|
||||
using SampleNativeComponentShadowNode = ConcreteViewShadowNode<
|
||||
SampleNativeComponentComponentName,
|
||||
SampleNativeComponentProps,
|
||||
SampleNativeComponentEventEmitter,
|
||||
SampleNativeComponentState>;
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateStateCpp.js
|
||||
*/
|
||||
#include "States.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateStateH.js
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
#include <folly/dynamic.h>
|
||||
#endif
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
class SampleNativeComponentState {
|
||||
public:
|
||||
SampleNativeComponentState() = default;
|
||||
|
||||
#ifdef RN_SERIALIZABLE_STATE
|
||||
SampleNativeComponentState(SampleNativeComponentState const &previousState, folly::dynamic data){};
|
||||
folly::dynamic getDynamic() const {
|
||||
return {};
|
||||
};
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,26 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleCpp.js
|
||||
*/
|
||||
|
||||
#include "OSSLibraryExampleSpecJSI.h"
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
static jsi::Value __hostFunction_NativeSampleModuleCxxSpecJSI_getRandomNumber(jsi::Runtime &rt, TurboModule &turboModule, const jsi::Value* args, size_t count) {
|
||||
return static_cast<NativeSampleModuleCxxSpecJSI *>(&turboModule)->getRandomNumber(
|
||||
rt
|
||||
);
|
||||
}
|
||||
|
||||
NativeSampleModuleCxxSpecJSI::NativeSampleModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule("NativeSampleModule", jsInvoker) {
|
||||
methodMap_["getRandomNumber"] = MethodMetadata {0, __hostFunction_NativeSampleModuleCxxSpecJSI_getRandomNumber};
|
||||
}
|
||||
|
||||
|
||||
} // namespace facebook::react
|
||||
@@ -1,67 +0,0 @@
|
||||
/**
|
||||
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
||||
*
|
||||
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
||||
* once the code is regenerated.
|
||||
*
|
||||
* @generated by codegen project: GenerateModuleH.js
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ReactCommon/TurboModule.h>
|
||||
#include <react/bridging/Bridging.h>
|
||||
|
||||
namespace facebook::react {
|
||||
|
||||
|
||||
class JSI_EXPORT NativeSampleModuleCxxSpecJSI : public TurboModule {
|
||||
protected:
|
||||
NativeSampleModuleCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
||||
|
||||
public:
|
||||
virtual double getRandomNumber(jsi::Runtime &rt) = 0;
|
||||
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class JSI_EXPORT NativeSampleModuleCxxSpec : public TurboModule {
|
||||
public:
|
||||
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
||||
return delegate_.create(rt, propName);
|
||||
}
|
||||
|
||||
static constexpr std::string_view kModuleName = "NativeSampleModule";
|
||||
|
||||
protected:
|
||||
NativeSampleModuleCxxSpec(std::shared_ptr<CallInvoker> jsInvoker)
|
||||
: TurboModule(std::string{NativeSampleModuleCxxSpec::kModuleName}, jsInvoker),
|
||||
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
||||
|
||||
|
||||
private:
|
||||
class Delegate : public NativeSampleModuleCxxSpecJSI {
|
||||
public:
|
||||
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
||||
NativeSampleModuleCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
||||
|
||||
}
|
||||
|
||||
double getRandomNumber(jsi::Runtime &rt) override {
|
||||
static_assert(
|
||||
bridging::getParameterCount(&T::getRandomNumber) == 1,
|
||||
"Expected getRandomNumber(...) to have 1 parameters");
|
||||
|
||||
return bridging::callFromJs<double>(
|
||||
rt, &T::getRandomNumber, jsInvoker_, instance_);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class NativeSampleModuleCxxSpec;
|
||||
T *instance_;
|
||||
};
|
||||
|
||||
Delegate delegate_;
|
||||
};
|
||||
|
||||
} // namespace facebook::react
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user