Skip to content

Commit e6ebdc3

Browse files
coadometa-codesync[bot]
authored andcommitted
Keep RCTHermesInstanceFactory.h off the "for frameworks" C API header (#59111)
Summary: Pull Request resolved: #59111 `RCTHermesInstanceFactory.h` is part of React's umbrella header, so every `import React` compiles it. It imported `<react/runtime/JSRuntimeFactoryCAPI.h>`, 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] ___ landed-with-radar-review Differential Revision: D125448714 fbshipit-source-id: b7243793a6052c4b6ead001e313b96d761d012d2
1 parent dd9b6c5 commit e6ebdc3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎packages/react-native/React/Runtime/RCTHermesInstanceFactory.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
#import <react/runtime/JSRuntimeFactoryCAPI.h>
9-
108
#pragma once
119

10+
typedef void *JSRuntimeFactoryRef;
11+
1212
#ifdef __cplusplus
1313
extern "C" {
1414
#endif

0 commit comments

Comments
 (0)