From 1b30a1f5a2cd9d7905c2aff20680e4304191c620 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Fri, 4 Sep 2026 04:51:25 -0700 Subject: [PATCH] Cover react/runtime with Stable API guards (#58167) Summary: Pull Request resolved: https://github.com/react/react-native/pull/58167 Classifies `react/runtime:runtime` and `react/runtime:runtime-platform` as "for frameworks" targets under the three-tier C++ stable API visibility model. Consumers that opt into `RN_STRICT_API` now get a warning if they include their headers directly, which they can acknowledge with `RN_ALLOW_FRAMEWORKS`; without that flag the guards are inert, so no existing build changes behaviour. The Apple platform layer is covered alongside the core runtime, so `RCTHost.h` and `RCTInstance.h` are in scope. `React-RuntimeCore` already depended on `React-cxxstableapi` from an earlier migration in the same pod; `React-RuntimeApple` gains the dependency here. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D117690303 fbshipit-source-id: 5e80284eefe6be4b556aacf4415c8c8ba228471e --- .../react-native/ReactCommon/react/runtime/BindingsInstaller.h | 2 ++ .../react/runtime/BridgelessNativeMethodCallInvoker.h | 2 ++ .../ReactCommon/react/runtime/BufferedRuntimeExecutor.h | 2 ++ packages/react-native/ReactCommon/react/runtime/CMakeLists.txt | 1 + .../ReactCommon/react/runtime/PlatformTimerRegistry.h | 2 ++ packages/react-native/ReactCommon/react/runtime/ReactInstance.h | 2 ++ packages/react-native/ReactCommon/react/runtime/TimerManager.h | 2 ++ .../react/runtime/platform/ios/React-RuntimeApple.podspec | 1 + .../react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h | 2 ++ .../platform/ios/ReactCommon/RCTContextContainerHandling.h | 2 ++ .../react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h | 2 ++ .../react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h | 2 ++ .../react/runtime/platform/ios/ReactCommon/RCTHost.h | 2 ++ .../react/runtime/platform/ios/ReactCommon/RCTInstance.h | 2 ++ .../react/runtime/platform/ios/ReactCommon/RCTJSThreadManager.h | 2 ++ .../react/runtime/platform/ios/ReactCommon/RCTJscInstance.h | 2 ++ .../ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.h | 2 ++ .../platform/ios/ReactCommon/RCTPerformanceLoggerUtils.h | 2 ++ 18 files changed, 34 insertions(+) diff --git a/packages/react-native/ReactCommon/react/runtime/BindingsInstaller.h b/packages/react-native/ReactCommon/react/runtime/BindingsInstaller.h index fb4226f5069..2ac39d75d7e 100644 --- a/packages/react-native/ReactCommon/react/runtime/BindingsInstaller.h +++ b/packages/react-native/ReactCommon/react/runtime/BindingsInstaller.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/ReactCommon/react/runtime/BridgelessNativeMethodCallInvoker.h b/packages/react-native/ReactCommon/react/runtime/BridgelessNativeMethodCallInvoker.h index 57dc1999b6f..19afec86b7b 100644 --- a/packages/react-native/ReactCommon/react/runtime/BridgelessNativeMethodCallInvoker.h +++ b/packages/react-native/ReactCommon/react/runtime/BridgelessNativeMethodCallInvoker.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h b/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h index 274015587fd..54178ba6f98 100644 --- a/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h +++ b/packages/react-native/ReactCommon/react/runtime/BufferedRuntimeExecutor.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt b/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt index 0cf910be5bf..da494a13803 100644 --- a/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/runtime/CMakeLists.txt @@ -34,6 +34,7 @@ target_link_libraries( jsi jsitooling jsireact + react_cxxstableapi react_utils jsinspector react_featureflags diff --git a/packages/react-native/ReactCommon/react/runtime/PlatformTimerRegistry.h b/packages/react-native/ReactCommon/react/runtime/PlatformTimerRegistry.h index c0bb2ce3716..de6ab551298 100644 --- a/packages/react-native/ReactCommon/react/runtime/PlatformTimerRegistry.h +++ b/packages/react-native/ReactCommon/react/runtime/PlatformTimerRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/ReactInstance.h b/packages/react-native/ReactCommon/react/runtime/ReactInstance.h index b850d0fac31..33b5910baa0 100644 --- a/packages/react-native/ReactCommon/react/runtime/ReactInstance.h +++ b/packages/react-native/ReactCommon/react/runtime/ReactInstance.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/TimerManager.h b/packages/react-native/ReactCommon/react/runtime/TimerManager.h index 9da5669d7fc..7ace46ee81f 100644 --- a/packages/react-native/ReactCommon/react/runtime/TimerManager.h +++ b/packages/react-native/ReactCommon/react/runtime/TimerManager.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec b/packages/react-native/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec index 947cd5c69d1..175b9968cbc 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/React-RuntimeApple.podspec @@ -55,6 +55,7 @@ Pod::Spec.new do |s| s.dependency "React-jserrorhandler" s.dependency "React-jsinspector" s.dependency "React-featureflags" + s.dependency "React-cxxstableapi" add_dependency(s, "React-jsitooling", :framework_name => "JSITooling") add_dependency(s, "React-RCTFBReactNativeSpec") add_dependency(s, "React-utils", :additional_framework_paths => ["react/utils/platform/ios"]) diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h index 7d566f513e1..827f11d9891 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/ObjCTimerRegistry.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTContextContainerHandling.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTContextContainerHandling.h index 1fc73afe85d..411b928bc2e 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTContextContainerHandling.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTContextContainerHandling.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h index c7bc46026c5..ad2cf29bcf6 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHermesInstance.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h index d039fa668f0..e7cfe255d02 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import "RCTHost.h" #import "RCTContextContainerHandling.h" diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h index d845c8e4690..cd2f5d546c4 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h index 72b7585184e..b0aaf2dff5f 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJSThreadManager.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJSThreadManager.h index ce64c55fdf0..0b98de49f79 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJSThreadManager.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJSThreadManager.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJscInstance.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJscInstance.h index e0da9c1fd6a..24e507de19b 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJscInstance.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTJscInstance.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import #import #import diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.h index 8711745df84..316bdfc81bf 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTLegacyUIManagerConstantsProvider.h @@ -7,6 +7,8 @@ #pragma once +#include + #ifndef RCT_REMOVE_LEGACY_COMPONENT_INTEROP #include diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.h b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.h index 85a86fc07f9..9c080bf1cea 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.h +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTPerformanceLoggerUtils.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#include + #import @class RCTPerformanceLogger;