From a80936d3f3c95697a659bf1672624703061ef52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20Ma=C5=82ecki?= Date: Thu, 15 Oct 2026 06:23:25 -0700 Subject: [PATCH] Keep RCTHermesInstanceFactory.h off the "for frameworks" C API header Summary: `RCTHermesInstanceFactory.h` is part of React's umbrella header, so every `import React` compiles it. It imported ``, which the C++ stable API classifies as "for frameworks", only to get the opaque `JSRuntimeFactoryRef` handle. So an app that defines `RN_STRICT_API` gets a "for frameworks" warning from React Native's own header that it cannot act on: with the prebuilt SwiftPM artifacts the warning fires while the `React` module is built with the app's macros. Declare the handle in the header instead, the same way `RCTJSRuntimeConfiguratorProtocol.h` already does (`typedef void *JSRuntimeFactoryRef;`). The type and ABI are unchanged, and identical typedefs may be repeated in C and C++, so a translation unit that also includes `JSRuntimeFactoryCAPI.h` still compiles. Code that needs the rest of the C API, such as `js_runtime_factory_destroy`, imports `JSRuntimeFactoryCAPI.h` directly, as `RCTRootViewFactory.mm` already does. With this, no header in React's umbrella reaches a stable API guard when compiled as Objective-C. Changelog: [Internal] Differential Revision: D125448714 --- .../react-native/React/Runtime/RCTHermesInstanceFactory.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native/React/Runtime/RCTHermesInstanceFactory.h b/packages/react-native/React/Runtime/RCTHermesInstanceFactory.h index 8ebbad051895..2228b0bb98f3 100644 --- a/packages/react-native/React/Runtime/RCTHermesInstanceFactory.h +++ b/packages/react-native/React/Runtime/RCTHermesInstanceFactory.h @@ -5,10 +5,10 @@ * LICENSE file in the root directory of this source tree. */ -#import - #pragma once +typedef void *JSRuntimeFactoryRef; + #ifdef __cplusplus extern "C" { #endif