Repository navigation
Commit e6ebdc3
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: b7243793a6052c4b6ead001e313b96d761d012d21 parent dd9b6c5 commit e6ebdc3
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
| 10 | + | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments