Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-react-native/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ runs:
rm example/ios/Podfile.lock
rm example/macos/Podfile.lock
rm example/visionos/Podfile.lock
npm run set-react-version -- ${{ inputs.version }}
node --run set-react-version -- ${{ inputs.version }}
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: ./.github/actions/setup-toolchain
- name: Lint commit message
run: |
npm run lint:commit
node --run lint:commit
review:
permissions:
issues: write # comment on PRs (suggestion-bot)
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ node --test test/pack.test.mjs
## Testing Specific React Native Versions

`react-native-test-app` supports multiple versions of React Native. Use
`set-react-version` to set the version, e.g. to use 0.73:
`set-react-version` to set the version, e.g. to use 0.80:

```sh
npm run set-react-version 0.73
node --run set-react-version -- 0.80
```

This will modify both `package.json` and `example/package.json` to use packages
Expand All @@ -218,11 +218,11 @@ update the title and fill out all the required fields. You can find the relevant
discussion link at [`react-native-releases`][].

Use the [`test:matrix`][] script to both test and capture screenshots. We'll
need the screenshots for the PR we'll create later. For instance, to test 0.73,
need the screenshots for the PR we'll create later. For instance, to test 0.80,
run:

```sh
npm run test:matrix 0.73
node --run test:matrix -- 0.80
```

At the minimum, we should be testing the lowest supported version (0.66 at the
Expand Down Expand Up @@ -333,14 +333,14 @@ gate them behind a version check. For example, we only use
The schema for `app.json` is documented here:
https://github.com/microsoft/react-native-test-app/wiki/Manifest-(app.json)

This page is wholly generated with the command, `npm run generate:docs`. You can
copy the output and replace the page content in its entirety.
This page is wholly generated with the command, `node --run generate:docs`. You
can copy the output and replace the page content in its entirety.

Documentation is generated by [`generate-schema.mjs`][] and sources Markdown
files under [`scripts/docs/`][].

When making changes to docs, also ensure that `schema.json` gets updated by
running `npm run generate:schema`.
running `node --run generate:schema`.

## Release Announcements

Expand Down
155 changes: 27 additions & 128 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,19 @@ buildDir = "${rootDir}/${name}/build"

def reactNativePath = file(findNodeModulesPath("react-native", rootDir))

if (autodetectReactNativeVersion || enableNewArchitecture) {
apply(plugin: "com.facebook.react")

react {
reactNativeDir = reactNativePath
codegenDir = file(
reactNativeVersion >= v(0, 72, 0)
? findNodeModulesPath("@react-native/codegen", reactNativePath)
: findNodeModulesPath("react-native-codegen", reactNativePath)
)
}
apply(plugin: "com.facebook.react")

// We don't want the React plugin to bundle.
tasks.whenTaskAdded { task ->
// The task name can be found in `react-native-gradle-plugin`:
// https://github.com/facebook/react-native/blob/0.71-stable/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54
if (task.name.startsWith("createBundle") && task.name.endsWith("JsAndAssets")) {
task.enabled = false
}
react {
reactNativeDir = reactNativePath
codegenDir = file(findNodeModulesPath("@react-native/codegen", reactNativePath))
}

// We don't want the React plugin to bundle.
tasks.whenTaskAdded { task ->
// The task name can be found in `react-native-gradle-plugin`:
// https://github.com/facebook/react-native/blob/0.71-stable/packages/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/TaskConfiguration.kt#L54
if (task.name.startsWith("createBundle") && task.name.endsWith("JsAndAssets")) {
task.enabled = false
}
}

Expand Down Expand Up @@ -78,10 +72,8 @@ android {
ndkVersion = project.ext.ndkVersion
}

if (usePrefabs) {
buildFeatures {
prefab = true
}
buildFeatures {
prefab = true
}

kotlinOptions {
Expand All @@ -107,14 +99,12 @@ android {

resValue("string", "app_name", project.ext.react.appName)

def cppStd = reactNativeVersion >= v(0, 74, 0) ? "-std=c++20" : "-std=c++17"
def cppStd = "-std=c++20"
if (enableNewArchitecture) {
externalNativeBuild {
cmake {
arguments("-DANDROID_STL=c++_shared",
"-DNODE_MODULES_DIR=${reactNativePath}/..",
"-DPROJECT_BUILD_DIR=${buildDir}",
"-DREACT_ANDROID_BUILD_DIR=${reactNativePath}/ReactAndroid/build",
"-DREACT_ANDROID_DIR=${reactNativePath}/ReactAndroid")
cppFlags(cppStd, "-frtti", "-fexceptions", "-DWITH_INSPECTOR=1")
}
Expand Down Expand Up @@ -142,28 +132,6 @@ android {
}
}

if (!enableNewArchitecture && !usePrefabs) {
def version = getPackageVersion("react-native", rootDir)
def allAar = file("${reactNativePath}/android/com/facebook/react/react-native/${version}/react-native-${version}.aar")

def prepareDebugJSI = tasks.register("prepareDebugJSI", Copy) {
def debugAar = file("${reactNativePath}/android/com/facebook/react/react-native/${version}/react-native-${version}-debug.aar")
from(zipTree(debugAar.exists() ? debugAar : allAar).matching({ it.include "**/libjsi.so" }))
into("${buildDir}/outputs/jniLibs/debug")
}

def prepareReleaseJSI = tasks.register("prepareReleaseJSI", Copy) {
def releaseAar = file("${reactNativePath}/android/com/facebook/react/react-native/${version}/react-native-${version}-release.aar")
from(zipTree(releaseAar.exists() ? releaseAar : allAar).matching({ it.include "**/libjsi.so" }))
into("${buildDir}/outputs/jniLibs/release")
}

afterEvaluate {
preDebugBuild.dependsOn(prepareDebugJSI)
preReleaseBuild.dependsOn(prepareReleaseJSI)
}
}

lintOptions {
lintConfig = file("lint.xml")
}
Expand Down Expand Up @@ -198,52 +166,12 @@ android {
? "src/old-arch/java"
: reactNativeVersion >= v(0, 81, 0)
? "src/new-arch-0.81/java"
: reactNativeVersion >= v(0, 73, 0)
? "src/new-arch-0.73/java"
: "src/new-arch/java",

// TODO: Remove this block when we drop support for 0.74
// https://github.com/facebook/react-native/commit/3283202248a36dbda553745afc46a3e3e2ab41a6
reactNativeVersion >= v(0, 75, 0)
? "src/reactactivitydelegate-0.75/java"
// TODO: Remove this block when we drop support for 0.73
: reactNativeVersion >= v(0, 74, 0)
? "src/reactactivitydelegate-0.74/java"
// TODO: Remove this block when we drop support for 0.71
// https://github.com/facebook/react-native/commit/e5dd9cdc6688e63e75a7e0bebf380be1a9a5fe2b
: reactNativeVersion >= v(0, 72, 0)
? "src/reactactivitydelegate-0.72/java"
: "src/reactactivitydelegate-pre-0.72/java",

// TODO: Remove this block when we drop support for 0.74
// https://github.com/facebook/react-native/commit/a1e81185416a53c7c7d0cfc67e40079fd0073e7c
reactNativeVersion >= v(0, 75, 0)
? "src/devserverhelper-0.75/java"
// TODO: Remove this block when we drop support for 0.73
// https://github.com/facebook/react-native/commit/cfa02eec50469059542ccbacbc51643b525ad461
: reactNativeVersion >= v(0, 74, 0)
? "src/devserverhelper-0.74/java"
// TODO: Remove this block when we drop support for 0.72
// https://github.com/facebook/react-native/commit/da358d0ec7a492edb804b9cdce70e7516ee518ae
: reactNativeVersion >= v(0, 73, 0)
? "src/devserverhelper-0.73/java"
: "src/devserverhelper-pre-0.73/java",

// TODO: Remove this block when we drop support for 0.75
// https://github.com/react-native-community/template/commit/f738a366b194dd21d4d2bc14c9215b630714dd70
reactNativeVersion >= v(0, 76, 0)
? "src/reactapplication-0.76/java"
// TODO: Remove this block when we drop support for 0.72
// https://github.com/facebook/react-native/commit/c3f672cef7d4f287d3d729d33650f917ed132a0c
: reactNativeVersion < v(0, 73, 0)
? "src/reactapplication-pre-0.73/java"
: "src/reactapplication-0.73/java",

// TODO: Remove this block when we drop support for 0.75
// https://github.com/react-native-community/template/commit/f738a366b194dd21d4d2bc14c9215b630714dd70
reactNativeVersion >= v(0, 76, 0)
? "src/reacthost-0.76/java"
: "src/reacthost-legacy/java",
: "src/new-arch-0.73/java",

"src/devserverhelper-0.75/java",
"src/reactactivitydelegate-0.75/java",
"src/reactapplication-0.76/java",
"src/reacthost-0.76/java",
]
}

Expand All @@ -260,22 +188,8 @@ android {
dependencies {
implementation project(":support")

if (project.ext.react.enableHermes) {
if (autodetectReactNativeVersion) {
implementation("com.facebook.react:hermes-android")
} else {
implementation("com.facebook.react:hermes-engine:+") {
exclude(group: "com.facebook.fbjni")
}
}
}

if (autodetectReactNativeVersion) {
implementation("com.facebook.react:react-android")
} else {
def version = getPackageVersion("react-native", rootDir)
implementation("com.facebook.react:react-native:${version}")
}
implementation("com.facebook.react:hermes-android")
implementation("com.facebook.react:react-android")

implementation(libraries.androidAppCompat)
implementation(libraries.androidCoreKotlinExtensions)
Expand All @@ -288,25 +202,10 @@ dependencies {
implementation(libraries.mlKitBarcodeScanning)
}

if (reactNativeVersion == 0 || reactNativeVersion >= v(0, 75, 0)) {
// https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162
def dependencies = autolinkingInfo(buildDir)
dependencies.each { path, info ->
info.configurations.each { configuration ->
add(configuration, project(path))
}
}
}
}

if (!enableNewArchitecture && !usePrefabs) {
configurations.all {
resolutionStrategy {
// Force version here otherwise Gradle will pick up a newer version:
// https://github.com/facebook/react-native/issues/35210
def version = getPackageVersion("react-native", rootDir)
force("com.facebook.react:react-native:${version}")
force("com.facebook.react:hermes-engine:${version}")
// https://github.com/facebook/react-native/blob/b0c0bb45911434ea654ba7e2feff4686061eba7a/packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/ReactExtension.kt#L162
autolinkingInfo(buildDir).each { path, info ->
info.configurations.each { configuration ->
add(configuration, project(path))
}
}
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions android/app/src/main/jni/AutolinkingCompat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,10 @@

#endif // __has_include(<FBReactNativeSpec.h>) // >= 0.81

#if __has_include(<autolinking.h>) // >= 0.75

#include <autolinking.h>

#define autolinking_ModuleProvider facebook::react::autolinking_ModuleProvider
#define autolinking_cxxModuleProvider facebook::react::autolinking_cxxModuleProvider
#define autolinking_registerProviders facebook::react::autolinking_registerProviders

#else // < 0.75

#include <rncli.h>

#define autolinking_ModuleProvider facebook::react::rncli_ModuleProvider
#define autolinking_cxxModuleProvider facebook::react::rncli_cxxModuleProvider
#define autolinking_registerProviders facebook::react::rncli_registerProviders

#endif // __has_include(<autolinking.h>)

#endif // REACTAPP_JNI_AUTOLINKINGCOMPAT_H_
2 changes: 0 additions & 2 deletions android/app/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set(REACTTESTAPP_SOURCE_FILES

# Suppress 'Manually-specified variables were not used by the project' warning
set(UNUSED_VARIABLES
${NODE_MODULES_DIR} # TODO: No longer used in 0.72
${REACT_ANDROID_BUILD_DIR} # TODO: No longer used in 0.72
${REACT_COMMON_DIR}
${REACT_JNILIBS_DIR}
)
Expand Down
9 changes: 3 additions & 6 deletions android/app/src/main/jni/ComponentsRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

#if !__has_include(<DefaultTurboModuleManagerDelegate.h>)

// clang-format off
#include "AutolinkingCompat.h"

#if __has_include(<react/fabric/CoreComponentsRegistry.h>) // >= 0.71
#include <react/fabric/CoreComponentsRegistry.h>
#else // < 0.71
#include <CoreComponentsRegistry.h>
#endif // __has_include(<react/fabric/CoreComponentsRegistry.h>)
// clang-format on

#include <DefaultComponentsRegistry.h>

#include <react/fabric/CoreComponentsRegistry.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <react/renderer/componentregistry/ComponentDescriptorRegistry.h>
#include <react/renderer/components/rncore/ComponentDescriptors.h>
Expand Down
4 changes: 0 additions & 4 deletions android/app/src/main/jni/ComponentsRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@

#include <fbjni/fbjni.h>

#if __has_include(<react/fabric/ComponentFactory.h>) // >= 0.71
#include <react/fabric/ComponentFactory.h>
#else // < 0.71
#include <ComponentFactory.h>
#endif

namespace ReactTestApp
{
Expand Down
2 changes: 0 additions & 2 deletions android/app/src/main/jni/OnLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ namespace
std::shared_ptr<TurboModule> javaModuleProvider(const std::string &name,
const JavaTurboModule::InitParams &params)
{
#if __has_include(<autolinking.h>) // >= 0.75
// We first try to look up core modules
if (auto module = rncore_ModuleProvider(name, params)) {
return module;
}
#endif // __has_include(<autolinking.h>)

// And we fallback to the module providers autolinked by RN CLI
return autolinking_ModuleProvider(name, params);
Expand Down
Loading
Loading