guardia-messenger/node_modules/react-native/ReactCommon/react/renderer/components/text/BaseTextShadowNode.cpp
DESKTOP-TKLFCPRython f29f525c77 refactor: 101.79.17.164 → zioinfo.co.kr 전체 도메인 변환 + Manager UI 배포
- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스)
- Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포
- 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-31 10:09:17 +09:00

76 lines
2.7 KiB
C++

/*
* 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 "BaseTextShadowNode.h"
#include <react/renderer/components/text/RawTextProps.h>
#include <react/renderer/components/text/RawTextShadowNode.h>
#include <react/renderer/components/text/TextProps.h>
#include <react/renderer/components/text/TextShadowNode.h>
#include <react/renderer/mounting/ShadowView.h>
namespace facebook::react {
inline ShadowView shadowViewFromShadowNode(const ShadowNode& shadowNode) {
auto shadowView = ShadowView{shadowNode};
// Clearing `props` and `state` (which we don't use) allows avoiding retain
// cycles.
shadowView.props = nullptr;
shadowView.state = nullptr;
return shadowView;
}
void BaseTextShadowNode::buildAttributedString(
const TextAttributes& baseTextAttributes,
const ShadowNode& parentNode,
AttributedString& outAttributedString,
Attachments& outAttachments) {
for (const auto& childNode : parentNode.getChildren()) {
// RawShadowNode
auto rawTextShadowNode =
dynamic_cast<const RawTextShadowNode*>(childNode.get());
if (rawTextShadowNode != nullptr) {
auto fragment = AttributedString::Fragment{};
fragment.string = rawTextShadowNode->getConcreteProps().text;
fragment.textAttributes = baseTextAttributes;
// Storing a retaining pointer to `ParagraphShadowNode` inside
// `attributedString` causes a retain cycle (besides that fact that we
// don't need it at all). Storing a `ShadowView` instance instead of
// `ShadowNode` should properly fix this problem.
fragment.parentShadowView = shadowViewFromShadowNode(parentNode);
outAttributedString.appendFragment(fragment);
continue;
}
// TextShadowNode
auto textShadowNode = dynamic_cast<const TextShadowNode*>(childNode.get());
if (textShadowNode != nullptr) {
auto localTextAttributes = baseTextAttributes;
localTextAttributes.apply(
textShadowNode->getConcreteProps().textAttributes);
buildAttributedString(
localTextAttributes,
*textShadowNode,
outAttributedString,
outAttachments);
continue;
}
// Any *other* kind of ShadowNode
auto fragment = AttributedString::Fragment{};
fragment.string = AttributedString::Fragment::AttachmentCharacter();
fragment.parentShadowView = shadowViewFromShadowNode(*childNode);
fragment.textAttributes = baseTextAttributes;
outAttributedString.appendFragment(fragment);
outAttachments.push_back(Attachment{
childNode.get(), outAttributedString.getFragments().size() - 1});
}
}
} // namespace facebook::react