Build the template app with RN_STRICT_API (#59224)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/59224

Turn on the C++ stable API checks (`RN_STRICT_API`) in the template apps CI builds, so the opt-ins, React Native's app-facing headers and the generated codegen and autolinking code are compiled in strict mode the way a new app would build them:

- `private/helloworld`: `strictCxxApiEnabled=true` in `android/gradle.properties`, and the Podfile sets `RN_STRICT_API=1` unless the environment already sets it (`RN_STRICT_API=0 pod install` opts out).
- Community template CI (cloned at build time): `build-android-templateapp.yml` appends `strictCxxApiEnabled=true` to the generated app's `gradle.properties`, and `e2e-ios-templateapp.yml` runs its `pod install` with `RN_STRICT_API=1`.

Changelog: [Internal]

___

landed-with-radar-review

Differential Revision: D126330998

fbshipit-source-id: 051b55482f4fd94aabe63c202e3415353d152b9b
This commit is contained in:
Dawid Małecki authored and meta-codesync[bot] committed 2026-10-22 00:57:03 -07:00
1 parent 0bab0523ac
commit 5b6f18b036
4 files changed
+6 -1

No files matched your search

@@ -58,6 +58,7 @@ jobs:
--pathToLocalReactNative "$REACT_NATIVE_PKG"
echo -e "\nreact.internal.mavenLocalRepo=$MAVEN_LOCAL" >> /tmp/RNTestProject/android/gradle.properties
echo "strictCxxApiEnabled=true" >> /tmp/RNTestProject/android/gradle.properties
CAPITALIZED_FLAVOR=$(echo "${{ matrix.flavor }}" | awk '{print toupper(substr($0, 1, 1)) substr($0, 2)}')
cd /tmp/RNTestProject/android
+1 -1
View File
@@ -81,7 +81,7 @@ jobs:
export RCT_USE_LOCAL_RN_DEP=/tmp/third-party/ReactNativeDependencies${{ matrix.flavor }}.xcframework.tar.gz
# Disable prebuilds for now, as they are causing issues with E2E tests for 0.82-stable branch
export RCT_TESTONLY_RNCORE_TARBALL_PATH="/tmp/ReactCore/ReactCore${{ matrix.flavor }}.xcframework.tar.gz"
RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
RN_STRICT_API=1 RCT_NEW_ARCH_ENABLED=$NEW_ARCH_ENABLED bundle exec pod install
xcodebuild \
-scheme "RNTestProject" \
@@ -11,6 +11,7 @@ reactNativeArchitectures=arm64-v8a
newArchEnabled=true
hermesEnabled=true
edgeToEdgeEnabled=false
strictCxxApiEnabled=true
# Opt out of built-in kotlin and new DSL behavior that ships with AGP 9.
# Starting from AGP 10.x these opt outs will be removed.
+3
View File
@@ -3,6 +3,9 @@ require "../../../packages/react-native/scripts/cocoapods/autolinking.rb"
platform :ios, min_ios_version_supported
prepare_react_native_project!
# Build with the C++ stable API enforced. Run `RN_STRICT_API=0 pod install` to opt out.
ENV['RN_STRICT_API'] ||= '1'
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green