Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-native/ReactAndroid/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ val preparePrefab by
Pair("../ReactCommon/react/renderer/uimanager/React/", "React/"),
// react_utils
Pair("../ReactCommon/react/utils/", "react/utils/"),
Pair("../ReactCommon/react/utils/React/", "React/"),
// rrc_image
Pair(
"../ReactCommon/react/renderer/components/image/",
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/Base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <string>
#include <string_view>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ target_link_libraries(react_utils
glog
glog_init
jsi
react_cxxstableapi
react_debug)
target_compile_reactnative_options(react_utils PRIVATE)
target_compile_options(react_utils PRIVATE -Wpedantic)
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <memory>
#include <mutex>
#include <optional>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <cmath>

namespace facebook::react {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/MoveWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <memory>

namespace facebook::react {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/OnScopeExit.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <utility>

namespace facebook::react {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/PackTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <type_traits>

namespace facebook::react::traits {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = podspec_sources(source_files, ["*.h", "platform/ios/**/*.h"])
s.header_dir = "react/utils"
s.exclude_files = "tests"
s.exclude_files = ["tests", "React"]

if ENV['USE_FRAMEWORKS']
header_search_paths = header_search_paths + ["\"$(PODS_TARGET_SRCROOT)/platform/ios\""]
Expand All @@ -46,6 +46,7 @@ Pod::Spec.new do |s|
"DEFINES_MODULE" => "YES" }

s.dependency "React-jsi", version
s.dependency "React-cxxstableapi"

if use_hermes()
s.dependency "hermes-engine"
Expand All @@ -55,5 +56,11 @@ Pod::Spec.new do |s|

add_dependency(s, "React-debug")

s.subspec "utilsUmbrella" do |ss|
ss.source_files = "React/*.h"
ss.header_dir = "React"
ss.header_mappings_dir = "React"
end

mark_as_react_native_build(s)
end
46 changes: 46 additions & 0 deletions packages/react-native/ReactCommon/react/utils/React/Utils.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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/utils` module - public entry point.
//
// #include <React/Utils.h>
//
// Re-exports the module's public interface headers. React Native's own code
// should keep using the fine-grained `<react/utils/...>` includes; only outside
// consumers use this umbrella.
// =============================================================================

// Marks that the following headers are pulled in through the umbrella, so their
// shared guard (<react/cxxstableapi/UmbrellaGuard.h>) accepts them. Scoped to
// this block so later *direct* includes in the same TU are still caught.
#define RN_UMBRELLA_CONTEXT

#include <react/utils/Base64.h>
#include <react/utils/ContextContainer.h>
#include <react/utils/FloatComparison.h>
#include <react/utils/LowPriorityExecutor.h>
#include <react/utils/ManagedObjectWrapper.h>
#include <react/utils/MoveWrapper.h>
#include <react/utils/OnScopeExit.h>
#include <react/utils/PackTraits.h>
#include <react/utils/RunLoopObserver.h>
#include <react/utils/SharedFunction.h>
#include <react/utils/SimpleThreadSafeCache.h>
#include <react/utils/Telemetry.h>
#include <react/utils/TemplateStringLiteral.h>
#include <react/utils/Uuid.h>
#include <react/utils/fnv1a.h>
#include <react/utils/hash_combine.h>
#include <react/utils/iequals.h>
#include <react/utils/jsi-utils.h>
#include <react/utils/toLower.h>
#include <react/utils/to_underlying.h>

#undef RN_UMBRELLA_CONTEXT
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <atomic>
#include <functional>
#include <memory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <functional>
#include <memory>
#include <mutex>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <concepts>
#include <list>
#include <mutex>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/Telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <chrono>
#include <type_traits>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <algorithm>
#include <array>
#include <string_view>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/Uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <string>

namespace facebook::react {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/fnv1a.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <cstdint>
#include <functional>
#include <string_view>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/hash_combine.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <functional>
#include <type_traits>

Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/iequals.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <react/utils/toLower.h>
#include <string_view>

Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/jsi-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <jsi/jsi.h>
#include <string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

namespace facebook::react::LowPriorityExecutor {

void execute(std::function<void()> &&workItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <functional>

namespace facebook::react::LowPriorityExecutor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <functional>

namespace facebook::react::LowPriorityExecutor {
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/toLower.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

namespace facebook::react {

/**
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native/ReactCommon/react/utils/to_underlying.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#pragma once

#include <react/cxxstableapi/UmbrellaGuard.h>

#include <type_traits>

namespace facebook::react {
Expand Down
18 changes: 18 additions & 0 deletions packages/react-native/scripts/ios-prebuild/headers-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,24 @@ const PodspecExceptions /*: {[key: string]: PodSpecConfiguration} */ = {
'Libraries/PushNotificationIOS/React-RCTPushNotification.podspec': {
disabled: true,
},
'ReactCommon/react/utils/React-utils.podspec': {
name: 'React-utils',
headerPatterns: [],
headerDir: '',
subSpecs: [
{
name: 'utils',
headerPatterns: ['*.h', 'platform/ios/**/*.h'],
excludePatterns: ['tests', 'React'],
headerDir: 'react/utils',
},
{
name: 'utilsUmbrella',
headerPatterns: ['React/*.h'],
headerDir: 'React',
},
],
},
};

module.exports = {PodspecExceptions};
Loading