From 1b334af20dea10f720356b034423cac11627dbd7 Mon Sep 17 00:00:00 2001 From: Jakub Piasecki Date: Thu, 3 Sep 2026 01:55:23 -0700 Subject: [PATCH] Cover `componentregistry` with Stable API guards Summary: Classifies `react/renderer/componentregistry:componentregistry` as a public target under the C++ stable API three-tier visibility model and introduces the module umbrella `React/ComponentRegistry.h` as its public entry point. This module has no podspec of its own - it ships as a subspec of `React-Fabric` - so the `componentregistryUmbrella` subspec and the matching `headers-config.js` entry are added to the parent pod. The umbrella re-exports all five of the module's headers. The sibling `react/renderer/componentregistry/native:native` target is private under the same model. The guards are inert unless a consumer defines `RN_STRICT_API`, so there is no behavior change. Changelog: [General][Added] - Add `` umbrella header as the public entry point for `react/renderer/componentregistry` Differential Revision: D118612734 --- .../ReactAndroid/build.gradle.kts | 1 + .../ReactCommon/React-Fabric.podspec | 6 +++ .../renderer/componentregistry/CMakeLists.txt | 2 + .../ComponentDescriptorFactory.h | 2 + .../ComponentDescriptorProvider.h | 2 + .../ComponentDescriptorProviderRegistry.h | 2 + .../ComponentDescriptorRegistry.h | 2 + .../React/ComponentRegistry.h | 37 +++++++++++++++++++ .../componentNameByReactViewName.h | 2 + .../scripts/ios-prebuild/headers-config.js | 6 +++ 10 files changed, 62 insertions(+) create mode 100644 packages/react-native/ReactCommon/react/renderer/componentregistry/React/ComponentRegistry.h diff --git a/packages/react-native/ReactAndroid/build.gradle.kts b/packages/react-native/ReactAndroid/build.gradle.kts index 3d04af49ff47..c7e764e03857 100644 --- a/packages/react-native/ReactAndroid/build.gradle.kts +++ b/packages/react-native/ReactAndroid/build.gradle.kts @@ -133,6 +133,7 @@ val preparePrefab by "../ReactCommon/react/renderer/componentregistry/", "react/renderer/componentregistry/", ), + Pair("../ReactCommon/react/renderer/componentregistry/React/", "React/"), // react_renderer_consistency Pair( "../ReactCommon/react/renderer/consistency/", diff --git a/packages/react-native/ReactCommon/React-Fabric.podspec b/packages/react-native/ReactCommon/React-Fabric.podspec index bb7c16f10bea..f00880135620 100644 --- a/packages/react-native/ReactCommon/React-Fabric.podspec +++ b/packages/react-native/ReactCommon/React-Fabric.podspec @@ -126,6 +126,12 @@ Pod::Spec.new do |s| ss.header_dir = "react/renderer/componentregistry" end + s.subspec "componentregistryUmbrella" do |ss| + ss.source_files = "react/renderer/componentregistry/React/*.h" + ss.header_dir = "" + ss.header_mappings_dir = "react/renderer/componentregistry" + end + s.subspec "componentregistrynative" do |ss| ss.source_files = podspec_sources("react/renderer/componentregistry/native/**/*.{m,mm,cpp,h}", "react/renderer/componentregistry/native/**/*.{h}") ss.header_dir = "react/renderer/componentregistry/native" diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/CMakeLists.txt b/packages/react-native/ReactCommon/react/renderer/componentregistry/CMakeLists.txt index 3f96765a2e49..84c320d1a7e0 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/CMakeLists.txt +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/CMakeLists.txt @@ -12,11 +12,13 @@ file(GLOB react_renderer_componentregistry_SRC CONFIGURE_DEPENDS *.cpp) add_library(react_renderer_componentregistry OBJECT ${react_renderer_componentregistry_SRC}) target_include_directories(react_renderer_componentregistry PUBLIC ${REACT_COMMON_DIR}) +target_include_directories(react_renderer_componentregistry INTERFACE ${REACT_COMMON_DIR}/react/renderer/componentregistry) target_link_libraries(react_renderer_componentregistry folly_runtime glog_init jsi + react_cxxstableapi react_debug react_renderer_core react_renderer_debug diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h index ef0bbc50ecd7..556bf8ed2b3d 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorFactory.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h index f1e6c7a4010f..a356337b52e0 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProvider.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h index 9d9bad369453..731e66f469be 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h index 54e5ff55259f..1d1d9819a9b0 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/ComponentDescriptorRegistry.h @@ -7,6 +7,8 @@ #pragma once +#include + #include #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/React/ComponentRegistry.h b/packages/react-native/ReactCommon/react/renderer/componentregistry/React/ComponentRegistry.h new file mode 100644 index 000000000000..c9d2db6a481f --- /dev/null +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/React/ComponentRegistry.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +// ============================================================================= +// Umbrella header for the `react/renderer/componentregistry` module - public +// entry point. +// +// #include +// +// Re-exports the module's public interface headers. React Native's own code +// should keep using the fine-grained `` +// includes; only outside consumers use this umbrella. +// ============================================================================= + +// Marks that the following headers are pulled in through the umbrella, so their +// shared guard () accepts them. The marker +// is saved and restored rather than defined and undefined: the scope ends at +// this block, so later *direct* includes in the same TU are still caught, and +// it nests inside an enclosing umbrella rather than disarming it. +#pragma push_macro("RN_UMBRELLA_CONTEXT") +#undef RN_UMBRELLA_CONTEXT +#define RN_UMBRELLA_CONTEXT 1 + +#include +#include +#include +#include +#include + +#undef RN_UMBRELLA_CONTEXT +#pragma pop_macro("RN_UMBRELLA_CONTEXT") diff --git a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h index a37d9fd0c889..88621a77f3c0 100644 --- a/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h +++ b/packages/react-native/ReactCommon/react/renderer/componentregistry/componentNameByReactViewName.h @@ -7,6 +7,8 @@ #pragma once +#include + #include namespace facebook::react { diff --git a/packages/react-native/scripts/ios-prebuild/headers-config.js b/packages/react-native/scripts/ios-prebuild/headers-config.js index 78e72e95d615..0c06341179f4 100644 --- a/packages/react-native/scripts/ios-prebuild/headers-config.js +++ b/packages/react-native/scripts/ios-prebuild/headers-config.js @@ -96,6 +96,12 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = { headerDir: 'react/renderer/componentregistry', }, + { + name: 'componentregistryUmbrella', + headerPatterns: ['react/renderer/componentregistry/React/*.h'], + headerDir: 'React', + }, + { name: 'componentregistrynative', headerPatterns: ['react/renderer/componentregistry/native/**/*.h'],