first commit

This commit is contained in:
2026-03-10 16:18:05 +00:00
commit 11f9c069b5
31635 changed files with 3187747 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
# 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.
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
include(${REACT_COMMON_DIR}/cmake-utils/react-native-flags.cmake)
file(GLOB react_renderer_consistency_SRC CONFIGURE_DEPENDS *.cpp)
add_library(react_renderer_consistency OBJECT ${react_renderer_consistency_SRC})
target_include_directories(react_renderer_consistency PUBLIC ${REACT_COMMON_DIR})
target_compile_reactnative_options(react_renderer_consistency PRIVATE)
target_compile_options(react_renderer_consistency PRIVATE -Wpedantic)

View File

@@ -0,0 +1,43 @@
# 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.
require "json"
package = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "package.json")))
version = package['version']
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which were presumably in.
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
header_search_paths = []
if ENV['USE_FRAMEWORKS']
header_search_paths << "\"$(PODS_TARGET_SRCROOT)/../../..\"" # this is needed to allow the rendererconsistency access its own files
end
Pod::Spec.new do |s|
s.name = "React-rendererconsistency"
s.version = version
s.summary = "Fabric UI consistency primitives"
s.homepage = "https://reactnative.dev/"
s.license = package["license"]
s.author = "Meta Platforms, Inc. and its affiliates"
s.platforms = min_supported_versions
s.source = source
s.source_files = podspec_sources("**/*.{cpp,h}", "**/*.h")
s.header_dir = "react/renderer/consistency"
s.exclude_files = "tests"
s.pod_target_xcconfig = {
"CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
"HEADER_SEARCH_PATHS" => header_search_paths.join(' ')}
resolve_use_frameworks(s, header_mappings_dir: "../../..", module_name: "React_rendererconsistency")
end

View File

@@ -0,0 +1,53 @@
/*
* 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
#include <react/renderer/consistency/ShadowTreeRevisionConsistencyManager.h>
namespace facebook::react {
/**
* This is a RAII class that locks the shadow tree revisions during its
* lifetime.
*
* @example
* {
* ScopedShadowTreeRevisionLock lock(consistencyManager);
* runJavaScriptTask(); // During this execution, the lock will be active.
* }
*/
class ScopedShadowTreeRevisionLock {
public:
explicit ScopedShadowTreeRevisionLock(ShadowTreeRevisionConsistencyManager *consistencyManager) noexcept
: consistencyManager_(consistencyManager)
{
if (consistencyManager_ != nullptr) {
consistencyManager_->lockRevisions();
}
}
// Non-movable
ScopedShadowTreeRevisionLock(const ScopedShadowTreeRevisionLock &) = delete;
ScopedShadowTreeRevisionLock(ScopedShadowTreeRevisionLock &&) = delete;
// Non-copyable
ScopedShadowTreeRevisionLock &operator=(const ScopedShadowTreeRevisionLock &) = delete;
ScopedShadowTreeRevisionLock &operator=(ScopedShadowTreeRevisionLock &&) = delete;
~ScopedShadowTreeRevisionLock() noexcept
{
if (consistencyManager_ != nullptr) {
consistencyManager_->unlockRevisions();
}
}
private:
ShadowTreeRevisionConsistencyManager *consistencyManager_;
};
} // namespace facebook::react

View File

@@ -0,0 +1,14 @@
/*
* 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.
*/
#include "ShadowTreeRevisionConsistencyManager.h"
namespace facebook::react {
// This is a placeholder for CMakeFile not to complain
} // namespace facebook::react

View File

@@ -0,0 +1,24 @@
/*
* 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
namespace facebook::react {
/**
* This interface is used for UI consistency, indicating the timeframe where
* users should see the same revision of the shadow tree.
*/
class ShadowTreeRevisionConsistencyManager {
public:
virtual ~ShadowTreeRevisionConsistencyManager() = default;
virtual void lockRevisions() = 0;
virtual void unlockRevisions() = 0;
};
} // namespace facebook::react