Reclassify renderer CSS as for-frameworks (#58788)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/58788

Reclassify the renderer CSS headers (`react/renderer/css/*.h`) as framework-tier APIs by switching them from the public umbrella guard to the for-frameworks guard. Framework integrations keep access to the fine-grained headers and acknowledge that usage by defining `RN_ALLOW_FRAMEWORKS`.

Remove the `React/CSS.h` umbrella and stop publishing it from Buck, CocoaPods, Android prefab, the iOS prebuild header config, and the iOS prebuild header linking step. Its only consumer, the attributed string conversions header (itself framework-tier), now includes the CSS headers it uses (`CSSFontVariant.h` and `CSSValueParser.h`) directly.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D119642784

fbshipit-source-id: 676c78f396b4f6a23d118168a8a2a0e8121c0b4b
This commit is contained in:
Dawid Małecki authored and meta-codesync[bot] committed 2026-10-05 08:49:11 -07:00
1 parent 52efed6437
commit 0aadc942ce
34 files changed
+59 -103

No files matched your search

@@ -143,7 +143,6 @@ val preparePrefab by
Pair("../ReactCommon/react/renderer/core/React/", "React/"),
// react_renderer_css
Pair("../ReactCommon/react/renderer/css/", "react/renderer/css/"),
Pair("../ReactCommon/react/renderer/css/React/", "React/"),
// react_debug
Pair("../ReactCommon/react/debug/", "react/debug/"),
Pair("../ReactCommon/react/debug/React/", "React/"),
@@ -9,7 +9,6 @@
#include <react/cxxstableapi/FrameworksGuard.h>
#include <React/CSS.h>
#include <React/Debug.h>
#include <React/RendererCore.h>
#include <React/View.h>
@@ -18,6 +17,8 @@
#include <react/renderer/attributedstring/ParagraphAttributes.h>
#include <react/renderer/attributedstring/TextAttributes.h>
#include <react/renderer/attributedstring/primitives.h>
#include <react/renderer/css/CSSFontVariant.h>
#include <react/renderer/css/CSSValueParser.h>
#include <unordered_map>
#ifdef RN_SERIALIZABLE_STATE
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <cmath>
#include <cstdint>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <variant>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <algorithm>
#include <cmath>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <react/renderer/css/CSSDataType.h>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <any>
#include <concepts>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <array>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <react/renderer/css/CSSDataType.h>
#include <react/renderer/css/CSSKeyword.h>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <string_view>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <cstdint>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <react/renderer/css/CSSCompoundDataType.h>
#include <react/renderer/css/CSSLength.h>
#include <react/renderer/css/CSSPercentage.h>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <cstdint>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <type_traits>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <string_view>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <variant>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <tuple>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <concepts>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <string_view>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <cmath>
#include <string_view>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <array>
#include <optional>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <type_traits>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
#include <type_traits>
@@ -7,7 +7,7 @@
#pragma once
#include <react/cxxstableapi/UmbrellaGuard.h>
#include <react/cxxstableapi/FrameworksGuard.h>
#include <optional>
@@ -45,11 +45,5 @@ Pod::Spec.new do |s|
add_dependency(s, "React-utils")
s.dependency "React-cxxstableapi"
s.subspec "cssUmbrella" do |ss|
ss.source_files = "React/*.h"
ss.header_dir = ""
ss.header_mappings_dir = "."
end
mark_as_react_native_build(s)
end
@@ -1,62 +0,0 @@
/*
* 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/css` module - public entry point.
//
// #include <React/CSS.h>
//
// Re-exports the module's public interface headers. React Native's own code
// should keep using the fine-grained `<react/renderer/css/...>` includes,
// except in headers it exports to consumers: those are preprocessed in the
// consumer's translation unit, where the fine-grained include hits this
// module's <react/cxxstableapi/UmbrellaGuard.h>. `RN_ALLOW_FRAMEWORKS` does not
// suppress that guard, so a "for frameworks" header must reach this module
// through the umbrella.
// =============================================================================
// Marks that the following headers are pulled in through the umbrella, so their
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) 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 <react/renderer/css/CSSAngle.h>
#include <react/renderer/css/CSSAngleUnit.h>
#include <react/renderer/css/CSSBackgroundImage.h>
#include <react/renderer/css/CSSColor.h>
#include <react/renderer/css/CSSColorFunction.h>
#include <react/renderer/css/CSSCompoundDataType.h>
#include <react/renderer/css/CSSDataType.h>
#include <react/renderer/css/CSSFilter.h>
#include <react/renderer/css/CSSFontVariant.h>
#include <react/renderer/css/CSSHexColor.h>
#include <react/renderer/css/CSSKeyword.h>
#include <react/renderer/css/CSSLength.h>
#include <react/renderer/css/CSSLengthPercentage.h>
#include <react/renderer/css/CSSLengthUnit.h>
#include <react/renderer/css/CSSList.h>
#include <react/renderer/css/CSSNamedColor.h>
#include <react/renderer/css/CSSNumber.h>
#include <react/renderer/css/CSSPercentage.h>
#include <react/renderer/css/CSSRatio.h>
#include <react/renderer/css/CSSShadow.h>
#include <react/renderer/css/CSSSyntaxParser.h>
#include <react/renderer/css/CSSToken.h>
#include <react/renderer/css/CSSTokenizer.h>
#include <react/renderer/css/CSSTransform.h>
#include <react/renderer/css/CSSTransformOrigin.h>
#include <react/renderer/css/CSSValueParser.h>
#include <react/renderer/css/CSSZero.h>
#undef RN_UMBRELLA_CONTEXT
#pragma pop_macro("RN_UMBRELLA_CONTEXT")
@@ -0,0 +1,30 @@
/**
* 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.
*
* @flow strict-local
* @format
*/
'use strict';
const {PodspecExceptions} = require('../headers-config');
describe('React renderer CSS headers', () => {
test('publishes fine-grained headers without a stable umbrella', () => {
const rendererCss =
PodspecExceptions[
'ReactCommon/react/renderer/css/React-renderercss.podspec'
];
expect(rendererCss.subSpecs).toEqual([
{
name: 'css',
headerPatterns: ['*.h'],
headerDir: 'react/renderer/css',
},
]);
});
});
@@ -655,11 +655,6 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = {
headerPatterns: ['*.h'],
headerDir: 'react/renderer/css',
},
{
name: 'cssUmbrella',
headerPatterns: ['React/*.h'],
headerDir: 'React',
},
],
},
'ReactCommon/react/utils/React-utils.podspec': {
-1
View File
@@ -108,7 +108,6 @@ async function setup(
link('ReactCommon/react/renderer/componentregistry/React', 'React');
link('ReactCommon/react/renderer/core');
link('ReactCommon/react/renderer/core/React', 'React');
link('ReactCommon/react/renderer/css/React', 'React');
link('ReactCommon/react/renderer/components/image/React', 'React');
link('ReactCommon/react/renderer/mapbuffer/React', 'React');
link('ReactCommon/react/bridging');