Skip to content

Add Android opt-in for RN_STRICT_API (#58849) - #58849

Closed
j-piasecki wants to merge 1 commit into
react:mainfrom
j-piasecki:export-D123399797
Closed

j-piasecki wants to merge 1 commit into
react:mainfrom
j-piasecki:export-D123399797

Conversation

@j-piasecki

@j-piasecki j-piasecki commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Adds a strictCxxApiEnabled (or react.strictCxxApiEnabled) Gradle property that defines RN_STRICT_API for an app's own native code: the app library, autolinked libraries and app codegen, through common_flags in ReactNative-application.cmake. React Native's own code is unaffected, since it defines RN_BUILDING. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by #pragma once and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add strictCxxApiEnabled Gradle property to enforce React Native's C++ stable API in app native code

Reviewed By: cipolleschi

Differential Revision: D123399797

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 5, 2026
@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner labels Oct 5, 2026
@meta-codesync

meta-codesync Bot commented Oct 5, 2026

Copy link
Copy Markdown

@j-piasecki has exported this pull request. If you are a Meta employee, you can view the originating Diff in D123399797.

@facebook-github-tools facebook-github-tools Bot added the p: Facebook Partner: Facebook label Oct 5, 2026
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 5, 2026
Summary:

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Differential Revision: D123399797
@meta-codesync meta-codesync Bot changed the title Add Android opt-in for RN_STRICT_API Add Android opt-in for RN_STRICT_API (#58849) Oct 5, 2026
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 5, 2026
Summary:
Pull Request resolved: react#58849

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 7, 2026
Summary:

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 7, 2026
Summary:
Pull Request resolved: react#58849

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 7, 2026
Summary:
Pull Request resolved: react#58849

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 7, 2026
Summary:
Pull Request resolved: react#58849

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 9, 2026
Summary:

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Reviewed By: cipolleschi

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 9, 2026
Summary:

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Reviewed By: cipolleschi

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 9, 2026
Summary:
Pull Request resolved: react#58849

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Reviewed By: cipolleschi

Differential Revision: D123399797
j-piasecki added a commit to j-piasecki/react-native that referenced this pull request Oct 12, 2026
Summary:

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Reviewed By: cipolleschi

Differential Revision: D123399797
Summary:

Adds a `strictCxxApiEnabled` (or `react.strictCxxApiEnabled`) Gradle property that defines `RN_STRICT_API` for an app's own native code: the app library, autolinked libraries and app codegen, through `common_flags` in `ReactNative-application.cmake`. React Native's own code is unaffected, since it defines `RN_BUILDING`. The shared precompiled header now includes React Native through module umbrellas, as its direct includes would otherwise fail under the flag. Codegen targets reuse that precompiled header, so a direct include of any header it already contains is skipped by `#pragma once` and the guards are effectively not enforced in those targets.

Changelog:
[Android][Added] - Add `strictCxxApiEnabled` Gradle property to enforce React Native's C++ stable API in app native code

Reviewed By: cipolleschi

Differential Revision: D123399797

@cortinico cortinico left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in b5d9b6c Oct 13, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Oct 13, 2026
@meta-codesync

meta-codesync Bot commented Oct 13, 2026

Copy link
Copy Markdown

This pull request has been merged in b5d9b6c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants