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,40 @@
# 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 rrc_safeareaview_SRCS CONFIGURE_DEPENDS *.cpp)
add_library(
rrc_safeareaview
STATIC
${rrc_safeareaview_SRCS}
)
target_include_directories(rrc_safeareaview PUBLIC .)
target_link_libraries(
rrc_safeareaview
glog
fbjni
folly_runtime
glog_init
react_codegen_rncore
react_debug
react_renderer_componentregistry
react_renderer_core
react_renderer_debug
react_renderer_graphics
react_renderer_uimanager
reactnativejni
rrc_view
yoga
)
target_compile_reactnative_options(rrc_safeareaview PRIVATE)
target_compile_options(rrc_safeareaview PRIVATE -Wpedantic)

View File

@@ -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.
*/
#pragma once
#include <react/renderer/components/safeareaview/SafeAreaViewShadowNode.h>
#include <react/renderer/core/ConcreteComponentDescriptor.h>
namespace facebook::react {
/*
* Descriptor for <SafeAreaView> component.
*/
class SafeAreaViewComponentDescriptor final : public ConcreteComponentDescriptor<SafeAreaViewShadowNode> {
using ConcreteComponentDescriptor::ConcreteComponentDescriptor;
void adopt(ShadowNode &shadowNode) const override
{
auto &layoutableShadowNode = static_cast<YogaLayoutableShadowNode &>(shadowNode);
auto &stateData = static_cast<const SafeAreaViewShadowNode::ConcreteState &>(*shadowNode.getState()).getData();
layoutableShadowNode.setPadding(stateData.padding);
ConcreteComponentDescriptor::adopt(shadowNode);
}
};
} // namespace facebook::react

View File

@@ -0,0 +1,15 @@
/*
* 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 "SafeAreaViewShadowNode.h"
namespace facebook::react {
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
const char SafeAreaViewComponentName[] = "SafeAreaView";
} // namespace facebook::react

View File

@@ -0,0 +1,28 @@
/*
* 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/components/FBReactNativeSpec/EventEmitters.h>
#include <react/renderer/components/FBReactNativeSpec/Props.h>
#include <react/renderer/components/safeareaview/SafeAreaViewState.h>
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
namespace facebook::react {
// NOLINTNEXTLINE(modernize-avoid-c-arrays)
extern const char SafeAreaViewComponentName[];
/*
* `ShadowNode` for <SafeAreaView> component.
*/
class SafeAreaViewShadowNode final
: public ConcreteViewShadowNode<SafeAreaViewComponentName, SafeAreaViewProps, ViewEventEmitter, SafeAreaViewState> {
using ConcreteViewShadowNode::ConcreteViewShadowNode;
};
} // namespace facebook::react

View File

@@ -0,0 +1,19 @@
/*
* 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 "SafeAreaViewState.h"
namespace facebook::react {
#ifdef ANDROID
folly::dynamic SafeAreaViewState::getDynamic() const {
return folly::dynamic::object("left", padding.left)("top", padding.top)(
"right", padding.right)("bottom", padding.bottom);
}
#endif
} // namespace facebook::react

View File

@@ -0,0 +1,41 @@
/*
* 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/graphics/RectangleEdges.h>
#ifdef ANDROID
#include <folly/dynamic.h>
#endif
namespace facebook::react {
/*
* State for <SafeAreaView> component.
*/
class SafeAreaViewState final {
public:
#ifdef ANDROID
SafeAreaViewState() = default;
SafeAreaViewState(const SafeAreaViewState & /*previousState*/, folly::dynamic data)
: padding(
EdgeInsets{
(Float)data["left"].getDouble(),
(Float)data["top"].getDouble(),
(Float)data["right"].getDouble(),
(Float)data["bottom"].getDouble(),
}) {};
folly::dynamic getDynamic() const;
#endif
EdgeInsets padding{};
};
} // namespace facebook::react