mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Keep RCTHermesInstanceFactory.h off the "for frameworks" C API header (#59111)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/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
This commit is contained in:
1 parent
dd9b6c52ab
commit
e6ebdc3794
1 file changed
+2
-2
@@ -5,10 +5,10 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <react/runtime/JSRuntimeFactoryCAPI.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef void *JSRuntimeFactoryRef;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user